Skip to content

Instantly share code, notes, and snippets.

@jhoblitt
Created April 6, 2026 23:19
Show Gist options
  • Select an option

  • Save jhoblitt/acfe004a8bdc1156fa1bc95af588532d to your computer and use it in GitHub Desktop.

Select an option

Save jhoblitt/acfe004a8bdc1156fa1bc95af588532d to your computer and use it in GitHub Desktop.
A script for watching Rook version updates rollout. Suitible to be cut'n'pasted into a remote shell.
MON (5 total):
READY:
VERSION COUNT PCT
v1.13.10 5 100.0%
MGR (2 total):
READY:
VERSION COUNT PCT
v1.13.10 2 100.0%
OSD (440 total):
READY:
VERSION COUNT PCT
v1.12.11 276 62.7%
v1.13.10 160 36.4%
NOT READY:
VERSION COUNT PCT
v1.13.10 4 0.9%
RGW (1 total):
READY:
VERSION COUNT PCT
v1.13.10 1 100.0%
CRASHCOLLECTOR (43 total):
READY:
VERSION COUNT PCT
v1.13.10 43 100.0%
TOTAL (491):
VERSION COUNT PCT
v1.12.11 276 56.2%
v1.13.10 215 43.8%
cat > /tmp/rollout-status.sh << 'EOF'
kubectl -n rook-ceph get deploy -l rook-version -o jsonpath='{range .items[*]}{.metadata.labels.app}{" "}{.status.readyReplicas}{"/"}{.spec.replicas}{" "}{.metadata.labels.rook-version}{"\n"}{end}' | awk '{
split($2,a,"/")
app=$1
sub(/rook-ceph-/,"",app)
if(app~/^rgw/) app="rgw"
ver=$3
if(app!~/^(osd|mon|mgr|crashcollector|rgw)$/) next
k=app SUBSEP ver
grand[app]++
gtotal++
seen[app]=1
ready=(a[1]=="")?0:a[1]+0
if(ready==a[2]+0){r[k]++} else{n[k]++}
t[k]++
vertotal[ver]++
} END{
fmt=" %-10s %-12s %6d %6.1f%%\n"
hdr=" %-10s %-12s %6s %7s\n"
order[1]="mon"; order[2]="mgr"; order[3]="osd"; order[4]="rgw"; order[5]="crashcollector"
for(i=1; i<=5; i++){
app=order[i]
if(!seen[app]) continue
printf "\n%s (%d total):\n", toupper(app), grand[app]
has_ready=0
for(k in r){split(k,p,SUBSEP); if(p[1]==app) has_ready=1}
if(has_ready){
printf " READY:\n"
printf hdr,"VERSION","","COUNT","PCT"
for(k in r){split(k,p,SUBSEP); if(p[1]==app) printf fmt,"",p[2],r[k],r[k]/grand[app]*100}
}
has_notready=0
for(k in n){split(k,p,SUBSEP); if(p[1]==app) has_notready=1}
if(has_notready){
printf " NOT READY:\n"
printf hdr,"VERSION","","COUNT","PCT"
for(k in n){split(k,p,SUBSEP); if(p[1]==app) printf fmt,"",p[2],n[k],n[k]/grand[app]*100}
}
}
printf "\nTOTAL (%d):\n", gtotal
printf hdr,"","VERSION","COUNT","PCT"
for(v in vertotal){
printf fmt,"",v,vertotal[v],vertotal[v]/gtotal*100
}
printf "\n"
}'
EOF
watch -n 10 bash /tmp/rollout-status.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment