Skip to content

Commit

Permalink
patch databases to use implicit version 15.3
Browse files Browse the repository at this point in the history
  • Loading branch information
drewwells committed Dec 10, 2024
1 parent cc7c934 commit 1cab5a2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions scripts/patch-databases.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash -x

# This script performs a common maintenance operation of updating
# status fields to version "15.3" from "15".
# Usage: DRY_RUN="--dry-run=server" ./scripts/patch-databases.sh

kubectl get databaseclaim -A -o json | jq -r '.items[] | select((.spec.dbVersion == null or .spec.dbVersion == "") and (.status.activeDB.dbversion != "15.3")) | [.metadata.namespace, .metadata.name] | @tsv' | while IFS=$'\t' read -r namespace name; do
kubectl get databaseclaim -n "$namespace" "$name" -ojsonpath='{.metadata.namespace}/{.metadata.name}:{.status.activeDB.dbversion}{"\n"}'
kubectl patch ${DRY_RUN} databaseclaim "$name" -n "$namespace" --type=merge --subresource=status -p '{"status":{"activeDB":{"dbversion":"15"}}}'

kubectl patch ${DRY_RUN} databaseclaim "$name" -n "$namspace" --type=merge -p '{"metadata":{"annotations":{"reconcile-now":"true"}}}'
done

0 comments on commit 1cab5a2

Please sign in to comment.