Last active
January 5, 2023 11:47
-
-
Save jgato/8d0b50bc521873431942b2fa01357665 to your computer and use it in GitHub Desktop.
Find out the Agent object corresponding to a BMH
This file contains 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
# It returns all the BMH of an spoke cluster | |
# and its corresponding Agent | |
# it could be useful when scaling down a cluster with ZTP | |
# ZTP only controls (and delete) the BMH object | |
# but the Agent is not under the Gitops control | |
# and it has to be manually deleted | |
oc -n <SPOKE_CLUSTER_NS> get Agent.agent-install.openshift.io -o json \ | |
| jq '.items[].metadata | "BMH resource: " + .labels."agent-install.openshift.io/bmh" + " with Agent: " + .name ' | |
# or directly get the agent of a BMH | |
oc -n <SPOKE_CLUSTER_NS> get Agent.agent-install.openshift.io -o json \ | |
| jq '.items[].metadata | select(.labels."agent-install.openshift.io/bmh"=="<DELETED_BMH_NAME>") | .name' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment