Files
cozystack/hack/testdata/migration-60-foundationdb/kubectl
T
Myasnikov Daniil a2d9cc766c fix(kubernetes, opensearch, foundationdb)!: restrict managed application images
Image overrides let a tenant run an arbitrary container in the
management cluster, including helpers with access to the Talos CA
secrets and the tenant cluster's API credentials. Drop those overrides
and run the images the platform ships.

The Kubernetes and KubernetesNodes helpers (the wait-for-kubeconfig
and Proxmox cloud-config init containers, the bootstrap-token and OIDC
RBAC Jobs, the talos-csr-signer sidecar, the Talos reconcile and unpin
Jobs) take the bundled image references through cozy-lib.image, so
they still follow the configured registry. OpenSearch no longer sets
an image and leaves it to the operator, which follows the version the
chart's version map selects; an explicit version: null now fails the
render instead of falling back to v2. The Talos installer settings for
tenant worker VMs stay.

FoundationDB replaces the free-form cluster.version with version, v7.3
or v7.4, mapped to 7.3.63 and 7.4.1; the 7.1 line is no longer
offered. The chart refuses a render where cluster.version and version
name different release lines, which also covers variants without
platform migrations. Migration 60 carries an existing cluster.version
over to its release line and leaves the legacy value in place while
the old chart can still render it. It records what needs attention in
the cozystack.io/migration-60-needs-attention annotation on the
cozystack-version ConfigMap: a FoundationDB release it cannot carry
over or whose patch changes, a release that still sets one of the
removed image overrides, an OpenSearch release storing version: null.
A dry run reports them without patching, annotating or advancing the
stamp. Migration 56 stops carrying the removed kubectl override into
adopted node pools.

OpenSearch and FoundationDB get version-map update scripts that keep
the current default while it is still supported.

Stored image overrides are still accepted and the charts ignore them.
On the first reconcile OpenSearch nodes move to the image of their
selected version and Kubernetes components whose image changed
restart. Air-gapped installations need docker.io and ghcr.io mirrored
on the management-cluster nodes.

Assisted-by: LLM
(cherry picked from commit 749d401899)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-10-26 12:24:00 +00:00

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