From 86af1e455b58a802a0b4720220fc1c163fdaf4b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin=20Bj=C3=B6rklin?= Date: Wed, 27 Nov 2024 13:27:26 -0800 Subject: [PATCH] feat: specify namespace to avoid accidentally deploying resources to wrong ns --- charts/azure-aks-aso/templates/cluster.yaml | 5 +++++ charts/azure-aks-aso/templates/clusterclass.yaml | 5 +++++ charts/azure-aks-aso/templates/credentials.yaml | 1 + 3 files changed, 11 insertions(+) diff --git a/charts/azure-aks-aso/templates/cluster.yaml b/charts/azure-aks-aso/templates/cluster.yaml index b061a28..4eef8ee 100644 --- a/charts/azure-aks-aso/templates/cluster.yaml +++ b/charts/azure-aks-aso/templates/cluster.yaml @@ -2,6 +2,7 @@ apiVersion: cluster.x-k8s.io/v1beta1 kind: Cluster metadata: name: {{ include "capz.clusterName" . | quote }} + namespace: {{ .Release.Namespace }} labels: {{- include "capz.commonLabels" . | nindent 4 }} spec: @@ -32,6 +33,7 @@ apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 kind: AzureASOManagedCluster metadata: name: {{ include "capz.clusterName" . | quote }} + namespace: {{ .Release.Namespace }} labels: {{- include "capz.commonLabels" . | nindent 4 }} annotations: @@ -43,6 +45,7 @@ apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 kind: AzureASOManagedControlPlane metadata: name: {{ include "capz.clusterName" . | quote }} + namespace: {{ .Release.Namespace }} annotations: helm.sh/resource-policy: keep spec: @@ -53,6 +56,7 @@ apiVersion: cluster.x-k8s.io/v1beta1 kind: MachinePool metadata: name: {{ printf "%s-%s" (include "capz.clusterName" $) $mpName | quote }} + namespace: {{ $.Release.Namespace }} labels: {{- include "capz.commonLabels" $ | nindent 4 }} annotations: @@ -77,6 +81,7 @@ apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 kind: AzureASOManagedMachinePool metadata: name: {{ printf "%s-%s" (include "capz.clusterName" $) $mpName | quote }} + namespace: {{ $.Release.Namespace }} labels: {{- include "capz.commonLabels" $ | nindent 4 }} annotations: diff --git a/charts/azure-aks-aso/templates/clusterclass.yaml b/charts/azure-aks-aso/templates/clusterclass.yaml index 86e94e9..8839057 100644 --- a/charts/azure-aks-aso/templates/clusterclass.yaml +++ b/charts/azure-aks-aso/templates/clusterclass.yaml @@ -3,6 +3,7 @@ apiVersion: cluster.x-k8s.io/v1beta1 kind: ClusterClass metadata: name: {{ required "value clusterClassName must be set" .Values.clusterClassName | quote }} + namespace: {{ .Release.Namespace }} labels: {{- include "capz.commonLabels" . | nindent 4 }} spec: @@ -81,6 +82,7 @@ apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 kind: AzureASOManagedClusterTemplate metadata: name: {{ .Values.clusterClassName | quote }} + namespace: {{ .Release.Namespace }} labels: {{- include "capz.commonLabels" . | nindent 4 }} annotations: @@ -93,6 +95,7 @@ apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 kind: AzureASOManagedControlPlaneTemplate metadata: name: {{ .Values.clusterClassName | quote }} + namespace: {{ .Release.Namespace }} annotations: helm.sh/resource-policy: keep spec: @@ -103,6 +106,7 @@ apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 kind: KubeadmConfigTemplate metadata: name: {{ .Values.clusterClassName | quote }} + namespace: {{ .Release.Namespace }} spec: template: spec: {} @@ -112,6 +116,7 @@ apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 kind: AzureASOManagedMachinePoolTemplate metadata: name: {{ printf "%s-%s" $.Values.clusterClassName $mpName | quote }} + namespace: {{ $.Release.Namespace }} labels: {{- include "capz.commonLabels" $ | nindent 4 }} annotations: diff --git a/charts/azure-aks-aso/templates/credentials.yaml b/charts/azure-aks-aso/templates/credentials.yaml index aaeb3d6..92d550b 100644 --- a/charts/azure-aks-aso/templates/credentials.yaml +++ b/charts/azure-aks-aso/templates/credentials.yaml @@ -3,6 +3,7 @@ apiVersion: v1 kind: Secret metadata: name: {{ .Values.credentialSecretName | quote }} + namespace: {{ .Release.Namespace }} labels: {{- include "capz.commonLabels" . | nindent 4 }} annotations: