Files
cozystack/scripts/migrations/20
Timofei Larkin 0f8a9ac9ef [installer] Update cozypkg and improve migration 20
This patch makes sure that migration #20 really uses the very latest
chart versions by forcing a reconcile with cozypkg, instead of
annotating the underlying HelmRelease.

```release-note
[installer] Update cozypkg in installer and use it to bulletproof the
20th migration script by reconciling the HelmReleases with the
--with-source flag.
```

Signed-off-by: Timofei Larkin <lllamnyp@gmail.com>
2025-09-25 12:03:22 +03:00

28 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
# Migration 20 --> 21
set -euo pipefail
kubectl delete ingresses.networking.k8s.io --all -n cozy-dashboard --ignore-not-found
kubectl delete cozystackresourcedefinitions --all-namespaces --all --ignore-not-found
kubectl delete crd cozystackresourcedefinitions.cozystack.io --ignore-not-found
timestamp=$(date --rfc-3339=ns)
# Make sure webhook is upgraded first, then run migration
cozypkg -C packages/system/cozystack-controller -n cozy-system reconcile cozystack-controller --force --with-source
kubectl wait hr/cozystack-controller -n cozy-system --timeout=4m --for=condition=ready || exit 1
cozypkg -C packages/system/cozystack-api -n cozy-system reconcile cozystack-api --force --with-source
kubectl wait hr/cozystack-api -n cozy-system --timeout=4m --for=condition=ready || exit 1
kubectl get namespace -o custom-columns=NAME:.metadata.name --no-headers |
grep '^tenant-' |
while read namespace ; do
(set -x; \
kubectl annotate \
pods,services,pvc,secrets,ingresses.networking.k8s.io,workloadmonitors.cozystack.io \
-n "$namespace" --all \
migration.cozystack.io="$timestamp" --overwrite)
done
# Stamp version
kubectl create configmap -n cozy-system cozystack-version \
--from-literal=version=21 --dry-run=client -o yaml | kubectl apply -f-