Skip to content

Commit 3aabb0c

Browse files
committed
fix(platform): stamp the no-delete label on bootstrap cozystack-version
The bootstrap path that creates cozystack-version when the ConfigMap is absent applied it without the platform.cozystack.io/no-delete label, leaving it unguarded by the cozystack-no-delete-guardrail ValidatingAdmissionPolicy. Route it through the shared helper so the bootstrap ConfigMap carries the label like every migration-driven stamp. Assisted-By: Claude <[email protected]> Signed-off-by: Aleksei Sviridkin <[email protected]>
1 parent b199b5e commit 3aabb0c

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎packages/core/platform/images/migrations/run-migrations.sh‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#!/bin/sh
22
set -euo pipefail
33

4+
# shellcheck source=migrations/lib/cozystack-version.sh
5+
. /migrations/lib/cozystack-version.sh
6+
47
NAMESPACE="${NAMESPACE:-cozy-system}"
58
CURRENT_VERSION="${CURRENT_VERSION:-0}"
69
TARGET_VERSION="${TARGET_VERSION:-0}"
@@ -10,9 +13,9 @@ echo "Starting migrations from version $CURRENT_VERSION to $TARGET_VERSION"
1013
# Check if ConfigMap exists
1114
if ! kubectl get configmap --namespace "$NAMESPACE" cozystack-version >/dev/null 2>&1; then
1215
echo "ConfigMap cozystack-version does not exist, creating it with version $TARGET_VERSION"
13-
kubectl create configmap --namespace "$NAMESPACE" cozystack-version \
14-
--from-literal=version="$TARGET_VERSION" \
15-
--dry-run=client --output yaml | kubectl apply --filename -
16+
# Stamp via the shared helper so the bootstrap ConfigMap carries the
17+
# platform.cozystack.io/no-delete label like every migration-driven stamp.
18+
stamp_cozystack_version "$TARGET_VERSION"
1619
echo "ConfigMap created with version $TARGET_VERSION"
1720
exit 0
1821
fi

0 commit comments

Comments
 (0)