Skip to content

Commit 5c11eae

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents 2b51320 + 4810b59 commit 5c11eae

26 files changed

Lines changed: 328 additions & 11 deletions

charts/rhai-on-xks-chart/scripts/verify.sh

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -538,17 +538,10 @@ test_4_uninstall_lifecycle() {
538538
assert_not_exists "istiod deployment" deployment/istiod -n istio-system
539539
assert_no_stuck_istiorevision
540540

541-
# Dependency namespaces persist (cleanupNamespaces=false)
541+
# All namespaces persist (cleanupNamespaces=false, keep annotation)
542542
assert_exists "istio-system namespace (persists)" namespace/istio-system
543-
544-
# Wait for helm-managed namespaces to finish terminating before re-install
545-
log "Waiting for terminating namespaces to be fully gone..."
546543
for ns in redhat-ods-operator redhat-ods-applications "${CM_NS}"; do
547-
if kubectl get namespace "$ns" &>/dev/null; then
548-
log " waiting for namespace/$ns to terminate..."
549-
kubectl wait --for=delete "namespace/$ns" --timeout=120s 2>/dev/null \
550-
|| warn "namespace/$ns still terminating after 120s"
551-
fi
544+
assert_exists "${ns} namespace (persists)" "namespace/${ns}"
552545
done
553546

554547
# Phase B: reinstall with cleanupNamespaces=true, then uninstall
@@ -564,6 +557,8 @@ test_4_uninstall_lifecycle() {
564557
assert_not_exists "${CM_NS} namespace" "namespace/${CM_NS}"
565558
assert_not_exists "istio-system namespace" namespace/istio-system
566559
assert_not_exists "cert-manager-operator namespace" namespace/cert-manager-operator
560+
assert_not_exists "redhat-ods-operator namespace" namespace/redhat-ods-operator
561+
assert_not_exists "redhat-ods-applications namespace" namespace/redhat-ods-applications
567562
}
568563

569564
# ─── Main ───────────────────────────────────────────────────────────────────

charts/rhai-on-xks-chart/templates/cloudmanager/aws/manager/namespace-rhai-cloudmanager-system.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@ apiVersion: v1
33
kind: Namespace
44
metadata:
55
name: {{ .Values.aws.cloudManager.namespace }}
6+
labels:
7+
{{- include "rhai-on-xks-chart.labels" . | nindent 4 }}
8+
annotations:
9+
helm.sh/resource-policy: keep
610
{{- end }}

charts/rhai-on-xks-chart/templates/cloudmanager/azure/manager/namespace-rhai-cloudmanager-system.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@ apiVersion: v1
33
kind: Namespace
44
metadata:
55
name: {{ .Values.azure.cloudManager.namespace }}
6+
labels:
7+
{{- include "rhai-on-xks-chart.labels" . | nindent 4 }}
8+
annotations:
9+
helm.sh/resource-policy: keep
610
{{- end }}

charts/rhai-on-xks-chart/templates/cloudmanager/coreweave/manager/namespace-rhai-cloudmanager-system.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@ apiVersion: v1
33
kind: Namespace
44
metadata:
55
name: {{ .Values.coreweave.cloudManager.namespace }}
6+
labels:
7+
{{- include "rhai-on-xks-chart.labels" . | nindent 4 }}
8+
annotations:
9+
helm.sh/resource-policy: keep
610
{{- end }}

charts/rhai-on-xks-chart/templates/hooks/pre-delete-crs-job.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
{{- $providerKECR := include "rhai-on-xks-chart.enabledProviderKECR" . }}
55
{{- $managedDepNamespaces := (include "rhai-on-xks-chart.kubernetesEngineDependencyNamespaces" (dict "root" . "managedOnly" true) | fromJson).items }}
66
{{- $depNamespaces := concat (.Values.imagePullSecret.dependencyNamespaces | default list) $managedDepNamespaces | uniq }}
7+
{{- $provider := include "rhai-on-xks-chart.activeProvider" . | fromYaml }}
8+
{{- $coreNamespaces := list .Values.rhaiOperator.namespace .Values.rhaiOperator.applicationsNamespace }}
9+
{{- if $provider }}
10+
{{- with (index $provider "cloudManagerNamespace") }}
11+
{{- $coreNamespaces = append $coreNamespaces . }}
12+
{{- end }}
13+
{{- end }}
714
{{- if or $componentCRs $providerKECR }}
815
apiVersion: batch/v1
916
kind: Job
@@ -57,6 +64,13 @@ spec:
5764
echo "Deleting namespace '{{ $ns }}'..."
5865
kubectl delete namespace '{{ $ns }}' --ignore-not-found --timeout=60s
5966
{{- end }}
67+
{{- range $ns := $coreNamespaces }}
68+
{{- if not (regexMatch "^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$" $ns) }}
69+
{{- fail (printf "invalid namespace name %q: must be a valid DNS-1123 label" $ns) }}
70+
{{- end }}
71+
echo "Deleting namespace '{{ $ns }}'..."
72+
kubectl delete namespace '{{ $ns }}' --ignore-not-found --timeout=60s
73+
{{- end }}
6074
{{- end }}
6175
echo "Done."
6276
{{- end }}

charts/rhai-on-xks-chart/templates/hooks/pre-delete-crs-rbac.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
{{- $keResource := include "rhai-on-xks-chart.keResourceName" . }}
66
{{- if or $componentCRs $providerKECR }}
77
{{- $provider := include "rhai-on-xks-chart.activeProvider" . | fromYaml }}
8+
{{- $coreNamespaces := list .Values.rhaiOperator.namespace .Values.rhaiOperator.applicationsNamespace }}
9+
{{- if $provider }}
10+
{{- with (index $provider "cloudManagerNamespace") }}
11+
{{- $coreNamespaces = append $coreNamespaces . }}
12+
{{- end }}
13+
{{- end }}
814
{{- if include "rhai-on-xks-chart.imagePullSecretEnabled" . }}
915
{{- $hookAnnotations := dict "helm.sh/hook" "pre-delete" "helm.sh/hook-delete-policy" "before-hook-creation,hook-succeeded" }}
1016
{{ include "rhai-on-xks-chart.imagePullSecretResource" (dict "root" . "namespace" .Release.Namespace "annotations" $hookAnnotations) }}
@@ -33,13 +39,15 @@ metadata:
3339
helm.sh/hook: pre-delete
3440
helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded
3541
rules:
36-
{{- if and .Values.uninstall.cleanupNamespaces $depNamespaces }}
42+
{{- if .Values.uninstall.cleanupNamespaces }}
43+
{{- $allCleanupNamespaces := concat $depNamespaces $coreNamespaces | uniq }}
44+
{{- if $allCleanupNamespaces }}
3745
- apiGroups:
3846
- ""
3947
resources:
4048
- namespaces
4149
resourceNames:
42-
{{- range $ns := $depNamespaces }}
50+
{{- range $ns := $allCleanupNamespaces }}
4351
- {{ $ns }}
4452
{{- end }}
4553
verbs:
@@ -48,6 +56,7 @@ rules:
4856
- watch
4957
- delete
5058
{{- end }}
59+
{{- end }}
5160
{{- $compRegistry := include "rhai-on-xks-chart.componentCRRegistry" . | fromYaml }}
5261
{{- range $name := keys $compRegistry | sortAlpha }}
5362
{{- $meta := index $compRegistry $name }}

charts/rhai-on-xks-chart/templates/manager/namespace-redhat-ods-applications.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@ apiVersion: v1
33
kind: Namespace
44
metadata:
55
name: {{ .Values.rhaiOperator.applicationsNamespace }}
6+
labels:
7+
{{- include "rhai-on-xks-chart.labels" . | nindent 4 }}
8+
annotations:
9+
helm.sh/resource-policy: keep
610
{{- end }}

charts/rhai-on-xks-chart/templates/manager/namespace-redhat-ods-operator.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@ apiVersion: v1
33
kind: Namespace
44
metadata:
55
name: {{ .Values.rhaiOperator.namespace }}
6+
labels:
7+
{{- include "rhai-on-xks-chart.labels" . | nindent 4 }}
8+
annotations:
9+
helm.sh/resource-policy: keep
610
{{- end }}

charts/rhai-on-xks-chart/test/snapshots/aws-with-all-deps-managed.snap.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,35 @@ apiVersion: v1
44
kind: Namespace
55
metadata:
66
name: rhai-cloudmanager-system
7+
labels:
8+
helm.sh/chart: HELM_CHART_VERSION_REDACTED
9+
app.kubernetes.io/managed-by: Helm
10+
annotations:
11+
helm.sh/resource-policy: keep
712

813
---
914
# Source: rhai-on-xks-chart/templates/manager/namespace-redhat-ods-applications.yaml
1015
apiVersion: v1
1116
kind: Namespace
1217
metadata:
1318
name: redhat-ods-applications
19+
labels:
20+
helm.sh/chart: HELM_CHART_VERSION_REDACTED
21+
app.kubernetes.io/managed-by: Helm
22+
annotations:
23+
helm.sh/resource-policy: keep
1424

1525
---
1626
# Source: rhai-on-xks-chart/templates/manager/namespace-redhat-ods-operator.yaml
1727
apiVersion: v1
1828
kind: Namespace
1929
metadata:
2030
name: redhat-ods-operator
31+
labels:
32+
helm.sh/chart: HELM_CHART_VERSION_REDACTED
33+
app.kubernetes.io/managed-by: Helm
34+
annotations:
35+
helm.sh/resource-policy: keep
2136

2237
---
2338
# Source: rhai-on-xks-chart/templates/pull-secret.yaml

charts/rhai-on-xks-chart/test/snapshots/aws-with-allowed-routes-all.snap.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,35 @@ apiVersion: v1
44
kind: Namespace
55
metadata:
66
name: rhai-cloudmanager-system
7+
labels:
8+
helm.sh/chart: HELM_CHART_VERSION_REDACTED
9+
app.kubernetes.io/managed-by: Helm
10+
annotations:
11+
helm.sh/resource-policy: keep
712

813
---
914
# Source: rhai-on-xks-chart/templates/manager/namespace-redhat-ods-applications.yaml
1015
apiVersion: v1
1116
kind: Namespace
1217
metadata:
1318
name: redhat-ods-applications
19+
labels:
20+
helm.sh/chart: HELM_CHART_VERSION_REDACTED
21+
app.kubernetes.io/managed-by: Helm
22+
annotations:
23+
helm.sh/resource-policy: keep
1424

1525
---
1626
# Source: rhai-on-xks-chart/templates/manager/namespace-redhat-ods-operator.yaml
1727
apiVersion: v1
1828
kind: Namespace
1929
metadata:
2030
name: redhat-ods-operator
31+
labels:
32+
helm.sh/chart: HELM_CHART_VERSION_REDACTED
33+
app.kubernetes.io/managed-by: Helm
34+
annotations:
35+
helm.sh/resource-policy: keep
2136

2237
---
2338
# Source: rhai-on-xks-chart/templates/cloudmanager/aws/rbac/serviceaccount-aws-cloud-manager-operator.yaml

0 commit comments

Comments
 (0)