Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
Kirill Ilin
7c51d6e0e8
[platform] preserve tenant-root HelmRelease during migration
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
2026-02-17 22:27:05 +05:00
2 changed files with 25 additions and 3 deletions

View file

@ -32,6 +32,20 @@ if ! kubectl get namespace "$NAMESPACE" &> /dev/null; then
exit 1
fi
# Preserve tenant-root HelmRelease during upgrade
# In v0.41 the HelmRelease lacks helm.sh/resource-policy: keep, so it would be
# deleted when the old platform chart is uninstalled. Adding the annotation here
# ensures the resource (and its user-set values like ingress: true) survives the
# transition to cozystack-basics, where a lookup merges them into the new template.
echo "Preserving tenant-root HelmRelease..."
if kubectl get helmrelease -n tenant-root tenant-root &> /dev/null; then
kubectl annotate helmrelease -n tenant-root tenant-root helm.sh/resource-policy=keep --overwrite
echo " Added helm.sh/resource-policy: keep annotation"
else
echo " No tenant-root HelmRelease found (will be created during upgrade)"
fi
echo ""
# Read ConfigMap cozystack
echo "Reading ConfigMap cozystack..."
COZYSTACK_CM=$(kubectl get configmap -n "$NAMESPACE" cozystack -o json 2>/dev/null || echo "{}")

View file

@ -4,6 +4,11 @@ kind: Namespace
metadata:
name: tenant-root
---
{{- $existingValues := dict }}
{{- $existing := lookup "helm.toolkit.fluxcd.io/v2" "HelmRelease" "tenant-root" "tenant-root" }}
{{- if and $existing $existing.spec $existing.spec.values }}
{{- $existingValues = omit $existing.spec.values "_cluster" }}
{{- end }}
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
@ -24,6 +29,9 @@ spec:
interval: 1m0s
timeout: 5m0s
values:
_cluster:
oidc-enabled: {{ .Values.oidcEnabled | quote }}
root-host: {{ .Values.rootHost | quote }}
{{- $clusterValues := dict
"oidc-enabled" (.Values.oidcEnabled | toString)
"root-host" (.Values.rootHost | toString)
}}
{{- $mergedValues := merge (dict "_cluster" $clusterValues) $existingValues }}
{{- $mergedValues | toYaml | nindent 4 }}