Last active
September 6, 2024 21:53
-
-
Save tosin2013/6a047ff3b9e82a94329ff2403d074774 to your computer and use it in GitHub Desktop.
Custom Machine Set for OpenShift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -xe | |
curl -OL https://github.com/openshift/openshift-cns-testdrive/raw/ocp4-dev/support/machineset-cli | |
curl -OL https://raw.githubusercontent.com/openshift/openshift-cns-testdrive/ocp4-dev/support/machineset-generator.sh | |
chmod +x machineset-generator.sh | |
chmod +x machineset-cli | |
bash /home/lab-user/machineset-generator.sh 1 infra 0 | oc create -f - | |
export MACHINESET=$(oc get machineset -n openshift-machine-api -l machine.openshift.io/cluster-api-machine-role=infra -o jsonpath='{.items[0].metadata.name}') | |
oc patch machineset $MACHINESET -n openshift-machine-api --type='json' -p='[{"op": "add", "path": "/spec/template/spec/metadata/labels", "value":{"node-role.kubernetes.io/worker":"", "node-role.kubernetes.io/infra":""} }]' | |
oc scale machineset $MACHINESET -n openshift-machine-api --replicas=3 | |
bash /home/lab-user/machineset-generator.sh 3 workerocs 0 | oc create -f - | |
oc get machineset -n openshift-machine-api -l machine.openshift.io/cluster-api-machine-role=workerocs -o name | xargs oc patch -n openshift-machine-api --type='json' -p '[{"op": "add", "path": "/spec/template/spec/metadata/labels", "value":{"node-role.kubernetes.io/worker":"", "role":"storage-node", "cluster.ocs.openshift.io/openshift-storage":""} }]' | |
oc get machineset -n openshift-machine-api -l machine.openshift.io/cluster-api-machine-role=workerocs -o name | xargs oc scale -n openshift-machine-api --replicas=1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment