mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-30 12:16:03 +09:00
Existing tenant clusters keep the shared tenant etcd they run on, and moving one is a per-cluster operator decision that the platform never takes on an upgrade. Retiring Tenant.spec.etcd has to wait until no cluster uses it, so the upgrade lists the clusters that still do. It writes nothing beyond the version stamp. Assisted-by: LLM Signed-off-by: Timofei Larkin <lllamnyp@gmail.com>
44 lines
1.5 KiB
Bash
Executable File
44 lines
1.5 KiB
Bash
Executable File
#!/bin/sh
|
|
# Fake kubectl for hack/migration-63-shared-etcd-report.bats. It serves only
|
|
# the calls migration 63 and lib/cozystack-version.sh make, and logs each one
|
|
# to $FAKE_CMDLOG.
|
|
#
|
|
# FAKE_CMDLOG file to append a one-line record of each call to
|
|
# FAKE_STATE directory holding kcps.json and datastores.json
|
|
# FAKE_NO_KAMAJI non-empty => the KamajiControlPlane CRD is absent
|
|
# FAKE_LIST_FAIL non-empty => listing KamajiControlPlanes exits 1 with this stderr
|
|
set -u
|
|
|
|
log() { [ -n "${FAKE_CMDLOG:-}" ] && printf '%s\n' "$*" >> "$FAKE_CMDLOG"; }
|
|
log "KUBECTL $*"
|
|
|
|
case "$*" in
|
|
*"apply --filename -"*)
|
|
manifest=$(cat)
|
|
case "$manifest" in
|
|
*"kind: ConfigMap"*)
|
|
v=$(printf '%s\n' "$manifest" | sed --quiet 's/^ version: "\{0,1\}\([0-9]\{1,\}\)"\{0,1\}$/\1/p' | head --lines=1)
|
|
log "STAMP ${v:-unknown}"
|
|
exit 0
|
|
;;
|
|
esac
|
|
printf 'fake kubectl: unmodelled apply\n' >&2
|
|
exit 1
|
|
;;
|
|
*"get crd kamajicontrolplanes.controlplane.cluster.x-k8s.io"*)
|
|
[ -n "${FAKE_NO_KAMAJI:-}" ] || echo "customresourcedefinition.apiextensions.k8s.io/kamajicontrolplanes.controlplane.cluster.x-k8s.io"
|
|
exit 0
|
|
;;
|
|
*"get kamajicontrolplanes.controlplane.cluster.x-k8s.io"*)
|
|
if [ -n "${FAKE_LIST_FAIL:-}" ]; then printf '%s\n' "$FAKE_LIST_FAIL" >&2; exit 1; fi
|
|
cat "$FAKE_STATE/kcps.json"
|
|
exit 0
|
|
;;
|
|
*"get datastores.kamaji.clastix.io"*)
|
|
cat "$FAKE_STATE/datastores.json"
|
|
exit 0
|
|
;;
|
|
esac
|
|
printf 'fake kubectl: unmodelled call: %s\n' "$*" >&2
|
|
exit 1
|