oc get nodes -o json \
| jq -r '.items | group_by(.metadata.labels["hypershift.openshift.io/nodePool"])[] | {nodepool: .[0].metadata.labels["hypershift.openshift.io/nodePool"], desired: length, current: (map(select(.status.conditions[] | select(.type=="Ready" and .status=="True"))) | length), nodes: (map(.metadata.name) | join(","))} | [.nodepool,.desired,.current,.nodes] | @tsv'
oc get nodes -o json | jq -r '
.items
| group_by(.metadata.labels["hypershift.openshift.io/nodePool"] // "unknown")
| .[]
| {
nodepool: .[0].metadata.labels["hypershift.openshift.io/nodePool"],
desired: length,
current: (map(select(any(.status.conditions[]; .type=="Ready" and .status=="True"))) | length),
nodes: map(.metadata.name)
}
| "\(.nodepool)\t desired=\(.desired) current=\(.current)\n " + (.nodes | join("\n "))
'
oc get nodes -o json | jq -r '
.items
| group_by(.metadata.labels["hypershift.openshift.io/nodePool"] // "unknown")
| .[]
| {
pool: .[0].metadata.labels["hypershift.openshift.io/nodePool"],
nodes: map({
name: .metadata.name,
current: .metadata.annotations["machineconfiguration.openshift.io/currentConfig"],
desired: .metadata.annotations["machineconfiguration.openshift.io/desiredConfig"]
})
}
| "=== \(.pool) ===",
"Desired config: \((.nodes | group_by(.desired) | map({config: .[0].desired, count: length}) | map("\(.config) (\(.count) nodes)") | join(", ")))",
"Current config: \((.nodes | group_by(.current) | map({config: .[0].current, count: length}) | map("\(.config) (\(.count) nodes)") | join(", ")))",
"Updated: \([.nodes[] | select(.current == .desired)] | length)/\(.nodes | length)",
"Updating: \([.nodes[] | select(.current != .desired)] | length)/\(.nodes | length)",
"",
(.nodes[] | " \(.name)\tcurrent=\(.current)\tdesired=\(.desired)\t" +
(if .current == .desired then "OK" else "UPDATING" end)),
""
'