From 8e027ee9a5ee413e1f4b6147c8f5851100896c1d Mon Sep 17 00:00:00 2001 From: Archisman Date: Wed, 4 Sep 2024 16:29:06 +0530 Subject: [PATCH] Adding support for multiple MachinePools Signed-off-by: Archisman --- .../charts/aws/templates/AWSMachinePool.yaml | 15 +++++--- .../charts/aws/templates/MachinePool.yaml | 17 +++++---- .../capi-cluster/charts/aws/values.yaml | 38 +++++++++++++++---- argocd-helm-charts/capi-cluster/values.yaml | 1 - 4 files changed, 49 insertions(+), 22 deletions(-) diff --git a/argocd-helm-charts/capi-cluster/charts/aws/templates/AWSMachinePool.yaml b/argocd-helm-charts/capi-cluster/charts/aws/templates/AWSMachinePool.yaml index eca22157b..1f0c46c6b 100644 --- a/argocd-helm-charts/capi-cluster/charts/aws/templates/AWSMachinePool.yaml +++ b/argocd-helm-charts/capi-cluster/charts/aws/templates/AWSMachinePool.yaml @@ -1,15 +1,18 @@ {{- if (.Values.global.capa).autoScaler }} +{{- range $index, $machinePool := $.Values.machinePools }} +--- apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: AWSMachinePool metadata: - name: {{ .Values.global.clusterName }}-mp-0 + name: {{ printf "%s-%s" $.Values.global.clusterName $machinePool.name }} spec: - minSize: {{ .Values.workerNodes.minSize | default 1 }} - maxSize: {{ .Values.workerNodes.maxSize | default 3 }} + minSize: {{ $machinePool.minSize | default 1 }} + maxSize: {{ $machinePool.maxSize | default 3 }} awsLaunchTemplate: - ami: {{ toYaml .Values.workerNodes.ami | nindent 6 }} + ami: {{ toYaml $machinePool.ami | nindent 6 }} iamInstanceProfile: nodes.cluster-api-provider-aws.sigs.k8s.io - instanceType: {{ .Values.workerNodes.instanceType }} - sshKeyName: {{ .Values.workerNodes.sshKeyName }} + instanceType: {{ $machinePool.instanceType }} + sshKeyName: {{ $machinePool.sshKeyName }} imageLookupBaseOS: ubuntu-20.04 {{- 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 c3f662e42..949d01d57 100644 --- a/argocd-helm-charts/capi-cluster/charts/aws/templates/MachinePool.yaml +++ b/argocd-helm-charts/capi-cluster/charts/aws/templates/MachinePool.yaml @@ -1,22 +1,25 @@ {{- if (.Values.global.capa).autoScaler }} +{{- range $index, $machinePool := $.Values.machinePools }} +--- apiVersion: cluster.x-k8s.io/v1beta1 kind: MachinePool metadata: - name: {{ .Values.global.clusterName }}-mp-0 + name: {{ printf "%s-%s" $.Values.global.clusterName $machinePool.name }} spec: - clusterName: {{ .Values.global.clusterName }} - replicas: {{ .Values.workerNodes.replicas }} + clusterName: {{ $.Values.global.clusterName }} + replicas: {{ $machinePool.replicas }} template: spec: bootstrap: configRef: apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 kind: KubeadmConfig - name: {{ .Values.global.clusterName }} - clusterName: {{ .Values.global.clusterName }} + name: {{ $.Values.global.clusterName }} + clusterName: {{ $.Values.global.clusterName }} infrastructureRef: apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: AWSMachinePool - name: {{ .Values.global.clusterName }}-mp-0 - version: {{ .Values.global.kubernetes.version }} + name: {{ printf "%s-%s" $.Values.global.clusterName $machinePool.name }} + version: {{ $.Values.global.kubernetes.version }} +{{- end }} {{- end }} diff --git a/argocd-helm-charts/capi-cluster/charts/aws/values.yaml b/argocd-helm-charts/capi-cluster/charts/aws/values.yaml index 48ca5281d..782b8d0f4 100644 --- a/argocd-helm-charts/capi-cluster/charts/aws/values.yaml +++ b/argocd-helm-charts/capi-cluster/charts/aws/values.yaml @@ -1,10 +1,32 @@ -workerNodes: - maxSize: 3 - minSize: 1 - ami: - id: ami-03cd26c84ae9a587c - publicIP: false +secretName: capi-cluster-token +sshKeyName: kubeaid-demo +region: us-east-2 +bastion: + enabled: true +vpc: + cidrBlock: 10.14.0.0/22 +pods: + cidrBlock: 10.244.0.0/16 + controlPlane: + loadBalancerType: nlb + region: us-east-2 + replicas: 1 + instanceType: t2.medium ami: - id: ami-03cd26c84ae9a587c - publicIP: true + id: ami-05145146e3a9db6f3 + +machinePools: + - name: primary + replicas: 1 + region: us-east-2 + instanceType: t2.medium + sshKeyName: kubeaid-demo + ami: + id: ami-05145146e3a9db6f3 + - name: secondary + replicas: 1 + instanceType: t2.medium + sshKeyName: kubeaid-demo + ami: + id: ami-05145146e3a9db6f3 diff --git a/argocd-helm-charts/capi-cluster/values.yaml b/argocd-helm-charts/capi-cluster/values.yaml index c102872dd..09789ab04 100644 --- a/argocd-helm-charts/capi-cluster/values.yaml +++ b/argocd-helm-charts/capi-cluster/values.yaml @@ -14,7 +14,6 @@ global: capz: version: v1.16.0 - selfManged: false provider: