From 4fabab996b6d27eb1cd36aadc832bc5f62f4a5a8 Mon Sep 17 00:00:00 2001 From: Kyle Wuolle Date: Wed, 18 Dec 2024 09:16:32 -0800 Subject: [PATCH 1/3] Updated the aws hosted template so that users can specify the management cluster name which is required for networking to work with AWS. Also switched to using the forked version of the AWS cloud provider helm chart so we can support this. --- .../templates/k0smotroncontrolplane.yaml | 12 ++++++++---- templates/cluster/aws-hosted-cp/values.schema.json | 4 ++++ templates/cluster/aws-hosted-cp/values.yaml | 5 ++++- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/templates/cluster/aws-hosted-cp/templates/k0smotroncontrolplane.yaml b/templates/cluster/aws-hosted-cp/templates/k0smotroncontrolplane.yaml index 3460717d1..7f19f1ea9 100644 --- a/templates/cluster/aws-hosted-cp/templates/k0smotroncontrolplane.yaml +++ b/templates/cluster/aws-hosted-cp/templates/k0smotroncontrolplane.yaml @@ -26,11 +26,11 @@ spec: extensions: helm: repositories: - - name: aws-cloud-controller-manager + - name: mirantis {{- if .Values.extensions.chartRepository }} url: {{ .Values.extensions.chartRepository }} {{- else }} - url: https://kubernetes.github.io/cloud-provider-aws + url: https://charts.mirantis.com {{- end }} - name: aws-ebs-csi-driver {{- if .Values.extensions.chartRepository }} @@ -41,8 +41,8 @@ spec: charts: - name: aws-cloud-controller-manager namespace: kube-system - chartname: aws-cloud-controller-manager/aws-cloud-controller-manager - version: "0.0.8" + chartname: mirantis/aws-cloud-controller-manager + version: "0.0.9" values: | image: {{- if .Values.extensions.imageRepository }} @@ -55,6 +55,10 @@ spec: - --cluster-cidr={{ first .Values.clusterNetwork.pods.cidrBlocks }} - --allocate-node-cidrs=true - --cluster-name={{ include "cluster.name" . }} + cloudConfig: + enabled: {{ ne .Values.managementClusterName "" }} + global: + KubernetesClusterID: {{ .Values.managementClusterName }} # Removing the default `node-role.kubernetes.io/control-plane` node selector # TODO: it does not work nodeSelector: diff --git a/templates/cluster/aws-hosted-cp/values.schema.json b/templates/cluster/aws-hosted-cp/values.schema.json index 4a1786d9f..74a6a427e 100644 --- a/templates/cluster/aws-hosted-cp/values.schema.json +++ b/templates/cluster/aws-hosted-cp/values.schema.json @@ -13,6 +13,10 @@ "clusterIdentity" ], "properties": { + "managementClusterName" : { + "description": "The name of the management cluster that this template is being deployed on", + "type": "string" + }, "workersNumber": { "description": "The number of the worker machines", "type": "integer", diff --git a/templates/cluster/aws-hosted-cp/values.yaml b/templates/cluster/aws-hosted-cp/values.yaml index c018fe1fd..c147402cc 100644 --- a/templates/cluster/aws-hosted-cp/values.yaml +++ b/templates/cluster/aws-hosted-cp/values.yaml @@ -52,4 +52,7 @@ k0s: # k0s extensions. extensions: chartRepository: "" - imageRepository: "" \ No newline at end of file + imageRepository: "" + +# Name of the management cluster that this template is being deployed on +managementClusterName: "" \ No newline at end of file From e46b0d43df8a4e9549717dcbdb090823601b39cb Mon Sep 17 00:00:00 2001 From: Kyle Wuolle Date: Tue, 7 Jan 2025 10:59:33 -0800 Subject: [PATCH 2/3] Make the managementClusterName required and set the cloud config enabled to always be true --- .../cluster/aws-hosted-cp/templates/k0smotroncontrolplane.yaml | 2 +- templates/cluster/aws-hosted-cp/values.schema.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/templates/cluster/aws-hosted-cp/templates/k0smotroncontrolplane.yaml b/templates/cluster/aws-hosted-cp/templates/k0smotroncontrolplane.yaml index 7f19f1ea9..6eb0874f7 100644 --- a/templates/cluster/aws-hosted-cp/templates/k0smotroncontrolplane.yaml +++ b/templates/cluster/aws-hosted-cp/templates/k0smotroncontrolplane.yaml @@ -56,7 +56,7 @@ spec: - --allocate-node-cidrs=true - --cluster-name={{ include "cluster.name" . }} cloudConfig: - enabled: {{ ne .Values.managementClusterName "" }} + enabled: true global: KubernetesClusterID: {{ .Values.managementClusterName }} # Removing the default `node-role.kubernetes.io/control-plane` node selector diff --git a/templates/cluster/aws-hosted-cp/values.schema.json b/templates/cluster/aws-hosted-cp/values.schema.json index 74a6a427e..e892d7d6e 100644 --- a/templates/cluster/aws-hosted-cp/values.schema.json +++ b/templates/cluster/aws-hosted-cp/values.schema.json @@ -10,7 +10,8 @@ "iamInstanceProfile", "instanceType", "securityGroupIDs", - "clusterIdentity" + "clusterIdentity", + "managementClusterName" ], "properties": { "managementClusterName" : { From 15b0007805fad18c3e4bc03ecc0077de43d98392 Mon Sep 17 00:00:00 2001 From: Kyle Wuolle Date: Fri, 10 Jan 2025 10:46:31 -0800 Subject: [PATCH 3/3] Add required check in template per review --- .../cluster/aws-hosted-cp/templates/k0smotroncontrolplane.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/cluster/aws-hosted-cp/templates/k0smotroncontrolplane.yaml b/templates/cluster/aws-hosted-cp/templates/k0smotroncontrolplane.yaml index 6eb0874f7..222005e34 100644 --- a/templates/cluster/aws-hosted-cp/templates/k0smotroncontrolplane.yaml +++ b/templates/cluster/aws-hosted-cp/templates/k0smotroncontrolplane.yaml @@ -58,7 +58,7 @@ spec: cloudConfig: enabled: true global: - KubernetesClusterID: {{ .Values.managementClusterName }} + KubernetesClusterID: {{ required ".Values.managementClusterName is required on AWS hosted deployment" .Values.managementClusterName }} # Removing the default `node-role.kubernetes.io/control-plane` node selector # TODO: it does not work nodeSelector: