mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-08 21:14:56 +09:00
The foundationdb chart no longer reads cluster.version, so a cluster that set it to 7.1 or 7.4 would move to the v7.3 default on the first reconcile after the upgrade: a full-bounce upgrade from 7.1, or a downgrade from 7.4. Migration 60 sets version to the release line of each cluster.version it finds. It keeps cluster.version, because the old chart still renders the release between the migration and the chart upgrade and would fall back to its own default without it. A value outside the supported lines is recorded on the cozystack-version ConfigMap and does not block the upgrade. Assisted-by: LLM Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
53 lines
1.7 KiB
Bash
Executable File
53 lines
1.7 KiB
Bash
Executable File
#!/bin/sh
|
|
# Fake kubectl for hack/migration-60-foundationdb-version.bats. It serves only
|
|
# the calls migration 60 (and lib/cozystack-version.sh) make and appends one
|
|
# line per call to $FAKE_CMDLOG.
|
|
#
|
|
# FAKE_CMDLOG file to append a record of each call to
|
|
# FAKE_HR_LIST file holding the HelmRelease list JSON the fleet scan returns
|
|
# FAKE_LIST_FAIL non-empty => the fleet scan fails
|
|
# FAKE_PATCH_FAIL non-empty => every patch fails
|
|
#
|
|
# Any other call fails loudly, so drift between the script and this fake does
|
|
# not pass unnoticed.
|
|
set -u
|
|
|
|
log() { printf '%s\n' "$*" >> "$FAKE_CMDLOG"; }
|
|
|
|
arg_after() { k="$1"; shift; p=""; for a in "$@"; do [ "$p" = "$k" ] && { printf '%s' "$a"; return; }; p="$a"; done; }
|
|
|
|
args="$*"
|
|
|
|
case "$args" in
|
|
"get helmreleases.helm.toolkit.fluxcd.io --all-namespaces --output json")
|
|
if [ -n "${FAKE_LIST_FAIL:-}" ]; then
|
|
echo 'error: the server was unable to return a response in the time allotted' >&2
|
|
exit 1
|
|
fi
|
|
cat "$FAKE_HR_LIST"
|
|
exit 0
|
|
;;
|
|
"patch helmreleases.helm.toolkit.fluxcd.io "*)
|
|
if [ -n "${FAKE_PATCH_FAIL:-}" ]; then
|
|
echo 'The request is invalid: the server rejected our request due to an error in our request' >&2
|
|
exit 1
|
|
fi
|
|
ns=$(arg_after --namespace "$@")
|
|
log "PATCH $ns $(arg_after "$ns" "$@") $(arg_after --type "$@") $(arg_after --patch "$@")"
|
|
exit 0
|
|
;;
|
|
"annotate configmap "*)
|
|
log "ANNOTATE $*"
|
|
exit 0
|
|
;;
|
|
"apply --filename -")
|
|
v=$(sed -n 's/^ version: "\{0,1\}\([0-9]\{1,\}\)"\{0,1\}$/\1/p' | head -1)
|
|
log "STAMP ${v:-unknown}"
|
|
exit 0
|
|
;;
|
|
esac
|
|
|
|
log "UNHANDLED $args"
|
|
echo "fake kubectl: unmodelled call: $args" >&2
|
|
exit 1
|