Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
mask() {
local n=8 # number of chars to leave
local a="${1:0:${#1}-n}" # take all but the last n chars
local b="${1:${#1}-n}" # take the final n chars
printf "%s%s\n" "${a//?/*}" "$b" # substitute a with asterisks
}
#!/bin/bash
#
# use this script to force the certiifcate renew for the default ingress certificate of a hcp.
#
function convert() {
echo $(date -d "$1" "+%s")
}
function dlog() {
echo $(date -u +"%Y-%m-%d-%I:%M:%S") $1
}
#!/bin/bash
node=${1}
list=$(oc get hc -A --sort-by=.metadata.creationTimestamp -ojson \
| jq -r '.items[] | select(.metadata.name | contains("sdq")) | .metadata.name,.metadata.creationTimestamp,.metadata.namespace')
ma=($list)
for ((i=0;i<${#ma[@]};i+=3))
do
#!/bin/bash
oc patch mch multiclusterhub -n multicluster-hub --type=merge \
-p "{\"spec\":{\"overrides\":{\"components\":[{\"name\":\"cluster-backup\",\"enabled\":true}]}}}"
oc patch mce multiclusterengine -n multicluster-engine --type=merge \
-p "{\"spec\":{\"overrides\":{\"components\":[{\"name\":\"managedserviceaccount-preview\",\"enabled\":true}]}}}"
BACKUP_NS=openshift-velero
SECRET_NAME=velero-iam-credentials
@cdoan1
cdoan1 / rotate-certificate.sh
Created March 16, 2023 15:09
Roate Certificate
#!/bin/bash
function convert() {
echo $(date -d "$1" "+%s")
}
function dlog() {
echo $(date -u +"%Y-%m-%d-%I:%M:%S") $1
}
for certificate in $(oc get certificate -n default -o name)

Sizing Worksheet

I am writing this article to document data related to sizing classification for RHACM 2.2 deployments.

We define three generic size classifications, based on the number of managed clusters under management.

Then, we deploy RHACM 2.2 into each of the size classifications, and measure the system based on the workload.

Today, we will keep the workload very generic.

@cdoan1
cdoan1 / 00_setup_local_mirror_registry.sh
Last active October 7, 2021 17:35
disconnected downstream
#!/bin/bash
#
# Reference: https://www.openshift.com/blog/openshift-4-2-disconnected-install
#
HOSTNAME=`hostname`
USERNAME=admin
PASSWORD=password
yum -y install podman httpd httpd-tools
mkdir -p $(pwd)/registry/{auth,certs,data}
+-----------------------+                  +-------------------+            +-------------------+       +--------------------+
|                       |                  |                   |            |                   |       |                    |
|                       |                  |                   |            |                   |       |                    |
|                       |                  |                   |            |                   |       |                    |
|                       |                  |                   |            |                   |       |                    |
|      Managed Cluster  --------------------      BIG IP       --------------       API         --------|         HUB        |
|                       |                  |      WAF          |            |       Gateway     |       |                    |
|                       |                  |                   |            |                   |       |                    |
@cdoan1
cdoan1 / README.md
Last active August 30, 2021 14:15
argocdCluster
# get CRD sorted
oc get crd -A --sort-by=.metadata.creationTimestamp
# inline template
oc get route keycloak --template "http://{{.spec.host}} "
# Enable DEX