Skip to content

Instantly share code, notes, and snippets.

@thikade
thikade / Compact-Cluster.yaml
Last active April 24, 2024 10:03
Redhat Openshift Agent-based Installer files for SNO & compact-cluster
---
# >>>>>> A 3-node, _compact_ cluster: <<<<<<<<<<<<
## API-VIP and APPS-VIP will be taken care of via keepalived,
## and you just need to provide API IPs and DNS records!
# 192.168.50.2 api.demo.cloud.example.com
# 192.168.50.2 api-int.demo.cloud.example.com
# 192.168.50.3 *.apps.demo.cloud.example.com
##
# install-config.yaml
##
@thikade
thikade / bashrc
Created December 1, 2023 15:02
bashrc
# User specific aliases and functions
HISTTIMEFORMAT="%d/%m/%y %T "
HISTSIZE=1000000
HISTFILESIZE=1000000
# source ~/bin/switch.sh
alias ll="ls -al"
alias sw=switch
@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 / service-loadbalancing.yml
Last active October 12, 2022 10:38
test K8s service loadbalancing. Deploys a client pod, a webserver deployment with 2 replicas, as well as a *stateful* and a *stateless* service to the webserver pods
---
# Use curl to test service loadbalancing on stateful and stateless services:
### simple:
# oc exec client -- curl -sS http://stateless:8080
#
### automated:
# for i in $(seq 1 100); do oc exec client -- curl -sS http://stateless:8080 | head -n1; sleep 1; done
# for i in $(seq 1 100); do oc exec client -- curl -sS http://stateful:8080 | head -n1; sleep 1; done
apiVersion: v1
@thikade
thikade / argocd_healthcheck.yaml
Created September 26, 2022 13:18
Overriden ArgoCD healthcheck for operator subscriptions to nicely work with manual approvals.
apiVersion: v1
kind: ConfigMap
metadata:
labels:
app.kubernetes.io/name: argocd-cm
app.kubernetes.io/part-of: argocd
name: argocd-cm
data:
resource.customizations: |
argoproj.io/Application:
@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 / Java_GC_Tuning.md
Last active March 8, 2023 12:02
Java GC tuning

determine JVM defaults

java -XshowSettings:vm -XX:+PrintFlagsFinal -version

Default Java 1.8.0_275: (-XX:+UseParallelGC)

$ java -XshowSettings:vm -XX:+PrintFlagsFinal  -version 2>&1 | \
  grep -E 'GCTimeRatio|HeapFreeRatio|MaxRAM|MaxHeapSize|UnlockExperimentalVMOptions|UseCGroupMemoryLimitForHeap'
    uintx DefaultMaxRAMFraction                     = 4                                   {product}