fix(platform): clean up orphaned -rd HelmReleases in migrations 28 and 29

Migrations 28 (mysql→mariadb) and 29 (virtual-machine→vm-disk+vm-instance)
only handled user-facing HelmReleases but left the system-level -rd
HelmReleases (mysql-rd, virtual-machine-rd) orphaned in cozy-system.
These HRs reference ExternalArtifacts that no longer exist, causing
persistent reconciliation failures.

Add cleanup steps to delete the orphaned -rd HRs and their Helm secrets.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
This commit is contained in:
Andrei Kvapil
2026-02-25 16:01:58 +01:00
parent e5f7bc5c53
commit e0dfc8a321
2 changed files with 26 additions and 0 deletions

View File

@@ -611,6 +611,19 @@ done
echo ""
echo "=== Migration complete (${#INSTANCES[@]} instance(s)) ==="
# ============================================================
# STEP 8: Clean up orphaned mysql-rd system HelmRelease
# ============================================================
echo ""
echo "--- Step 8: Clean up orphaned mysql-rd HelmRelease ---"
if kubectl -n cozy-system get hr mysql-rd --no-headers 2>/dev/null | grep -q .; then
echo " [DELETE] hr/mysql-rd"
kubectl -n cozy-system delete hr mysql-rd --wait=false
else
echo " [SKIP] hr/mysql-rd already gone"
fi
kubectl -n cozy-system delete secret -l "owner=helm,name=mysql-rd" --ignore-not-found
# Stamp version
kubectl create configmap -n cozy-system cozystack-version \
--from-literal=version=29 --dry-run=client -o yaml | kubectl apply -f-

View File

@@ -715,6 +715,19 @@ done
echo ""
echo "=== Migration complete (${#INSTANCES[@]} instance(s)) ==="
# ============================================================
# STEP 8: Clean up orphaned virtual-machine-rd system HelmRelease
# ============================================================
echo ""
echo "--- Step 8: Clean up orphaned virtual-machine-rd HelmRelease ---"
if kubectl -n cozy-system get hr virtual-machine-rd --no-headers 2>/dev/null | grep -q .; then
echo " [DELETE] hr/virtual-machine-rd"
kubectl -n cozy-system delete hr virtual-machine-rd --wait=false
else
echo " [SKIP] hr/virtual-machine-rd already gone"
fi
kubectl -n cozy-system delete secret -l "owner=helm,name=virtual-machine-rd" --ignore-not-found
# Stamp version
kubectl create configmap -n cozy-system cozystack-version \
--from-literal=version=30 --dry-run=client -o yaml | kubectl apply -f-