From def0201d0fecd74020f3511891f024bc0a3b2553 Mon Sep 17 00:00:00 2001 From: Archisman Date: Wed, 18 Sep 2024 22:36:32 +0530 Subject: [PATCH] Support for specifying taints for a MachinePool | Adding a NOTE about MachinePool labels Signed-off-by: Archisman --- .../charts/aws/templates/KubeadmConfig.yaml | 3 +++ .../charts/aws/templates/MachinePool.yaml | 15 ++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/argocd-helm-charts/capi-cluster/charts/aws/templates/KubeadmConfig.yaml b/argocd-helm-charts/capi-cluster/charts/aws/templates/KubeadmConfig.yaml index ca7e9964b..7d46812ed 100644 --- a/argocd-helm-charts/capi-cluster/charts/aws/templates/KubeadmConfig.yaml +++ b/argocd-helm-charts/capi-cluster/charts/aws/templates/KubeadmConfig.yaml @@ -11,5 +11,8 @@ spec: kubeletExtraArgs: cloud-provider: external name: '{{"{{"}} ds.meta_data.local_hostname {{"}}"}}' + {{- if $machinePool.taints }} + taints: {{- toYaml $machinePool.taints | nindent 8 }} + {{- end }} {{- end }} {{- end }} diff --git a/argocd-helm-charts/capi-cluster/charts/aws/templates/MachinePool.yaml b/argocd-helm-charts/capi-cluster/charts/aws/templates/MachinePool.yaml index cd080fe34..b43dc9f96 100644 --- a/argocd-helm-charts/capi-cluster/charts/aws/templates/MachinePool.yaml +++ b/argocd-helm-charts/capi-cluster/charts/aws/templates/MachinePool.yaml @@ -9,12 +9,17 @@ spec: clusterName: {{ $.Values.global.clusterName }} replicas: {{ $machinePool.replicas }} template: + {{- if $machinePool.labels }} metadata: - labels: - machine-pool: {{ printf "%s-%s" $.Values.global.clusterName $machinePool.name }} - {{- if $machinePool.labels }} - {{- toYaml $machinePool.labels | nindent 8 }} - {{- end }} + # Label should meet one of the following criterias to propagate to Node : + # + # (1) Has node-role.kubernetes.io as prefix. + # (2) Belongs to node-restriction.kubernetes.io domain. + # (3) Belongs to node.cluster.x-k8s.io domain. + # + # REFER : https://cluster-api.sigs.k8s.io/developer/architecture/controllers/metadata-propagation#machine + labels: {{- toYaml $machinePool.labels | nindent 8 }} + {{- end }} spec: bootstrap: configRef: