Skip to content

Instantly share code, notes, and snippets.

@thikade
thikade / helm-get-objects.sh
Last active March 22, 2023 19:22 — forked from bioshazard/helm-get-objects.sh
List and VERIFY all objects in helm deployment
# helm get manifest $RELEASE_NAME | yq -N eval '[.kind, .metadata.name] | join("/")' - | sort
helm get manifest $RELEASE_NAME | yq -N '[.kind,.metadata.name] | join("/") '| sort | \
while read X; do \
Y=$(kubectl get $X -o name 2>/dev/null); \
test $? -eq 0 && Y="OK " || Y="MISSING"; \
echo "$Y $X"; \
done
# sample output:
MISSING ConfigMap/elastic-7
@thikade
thikade / jenkins-decrypt.groovy
Created October 21, 2021 15:11 — forked from tuxfight3r/jenkins-decrypt.groovy
Decrypting Jenkins Password
#To Decrypt Jenkins Password from credentials.xml
#<username>jenkins</username>
#<passphrase>your-sercret-hash-S0SKVKUuFfUfrY3UhhUC3J</passphrase>
#go to the jenkins url
http://jenkins-host/script
#In the console paste the script
hashed_pw='your-sercret-hash-S0SKVKUuFfUfrY3UhhUC3J'
@thikade
thikade / convert-deploymentconfig-to-deployment.md
Last active June 12, 2022 05:13 — forked from tillkahlbrock/convert-deploymentconfig-to-deployment.md
Convert OpenShift DeploymentConfig to Kubernetes Deployment
  1. Change apiVersion from:

    - apiVersion: v1

    (or apiVersion: apps.openshift.io/v1)

    to:

@thikade
thikade / k8s-patch-virtualservice.go
Created May 11, 2021 14:14 — forked from dwmkerr/k8s-patch-virtualservice.go
Example showing how to patch an Istio VirtualService CRDs Golang
// Example showing how to patch Kubernetes resources.
package main
import (
"encoding/json"
"fmt"
"k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/dynamic"
@thikade
thikade / etcd-backup-cron.yaml
Created April 2, 2021 22:43 — forked from dmc5179/etcd-backup-cron.yaml
OpenShift Cron job to backup etcd database
---
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: etcd-backup
spec:
schedule: "0 0 * * *"
jobTemplate:
spec:
template:
@thikade
thikade / gitBash_windows.md
Created October 30, 2020 17:31 — forked from evanwill/gitBash_windows.md
how to add more utilities to git bash for windows, wget, make

How to add more to Git Bash on Windows

Git for Windows comes bundled with the "Git Bash" terminal which is incredibly handy for unix-like commands on a windows machine. It is missing a few standard linux utilities, but it is easy to add ones that have a windows binary available.

The basic idea is that C:\Program Files\Git\mingw64\ is your / directory according to Git Bash (note: depending on how you installed it, the directory might be different. from the start menu, right click on the Git Bash icon and open file location. It might be something like C:\Users\name\AppData\Local\Programs\Git, the mingw64 in this directory is your root. Find it by using pwd -W). If you go to that directory, you will find the typical linux root folder structure (bin, etc, lib and so on).

If you are missing a utility, such as wget, track down a binary for windows and copy the files to the corresponding directories. Sometimes the windows binary have funny prefixes, so

@thikade
thikade / deleteOpenshiftSampleJob.groovy
Last active May 14, 2020 12:24 — forked from nextrevision/deleteJenkinsJobs.groovy
Groovy script to delete all jenkins jobs that match a regex pattern
import jenkins.model.*
def matchedJobs = Jenkins.instance.items.findAll { job ->
job.name =~ /^OpenShift sample$/
}
matchedJobs.each { job ->
println "jobs: ${job.name}"
//job.delete()
}
@thikade
thikade / openshift_cli_tricks.MD
Last active April 3, 2020 13:34 — forked from tuxfight3r/openshift_cli_tricks.MD
openshift cli tricks - using go templates

openshift list all pods and their specs (requests/limits)

oc get pod -o jsonpath='{range .items[*]}{"SPEC:  \n  LIMITS  : "}{.spec.containers[*].resources.limits}{"\n  REQUESTS: "}{.spec.containers[*].resources.requests}{"\n"}{end}'

openshift list all pods and their specs with name (requests /limits)

oc get pod -o jsonpath='{range .items[*]}{"NAME:  "}{.metadata.name}{"\nSPEC:  \n  LIMITS  : "}{.spec.containers[*].resources.limits}{"\n  REQUESTS: "}{.spec.containers[*].resources.requests}{"\n\n"}{end}'
@thikade
thikade / how-to-squash-commits-in-git.md
Last active March 27, 2020 15:11 — forked from patik/how-to-squash-commits-in-git.md
How to squash commits in git

Squashing Git Commits

The standard way that produces a single commit.

Use merge --squash to squash multiple commits into a single commit (without a merge commit!). Omitting -m at the final commit command will display all commit messages of bugfix branch and lets you edit the new commit message.

Switch to the master branch and make sure you are up to date:

git checkout master &amp;&amp; git pull
@thikade
thikade / openshift-cheatsheet.md
Created April 3, 2018 09:21 — forked from rafaeltuelho/openshift-cheatsheet.md
My Openshift Cheatsheet
  • Binary Builds
oc new-build --binary=true --name=ola2 --image-stream=redhat-openjdk18-openshift
oc start-build ola2 --from-file=./target/ola.jar --follow
oc new-app 
  • Turn off/on DC triggers to do a batch of changes without spam many deployments