From fb83d23c3942bfa02727d0cc90f76295fe68dca6 Mon Sep 17 00:00:00 2001 From: Kyle Squizzato Date: Thu, 7 Nov 2024 17:13:50 -0800 Subject: [PATCH] Add support for customizing image and extension chart repoURL across templates (#493) --- .../templates/k0smotroncontrolplane.yaml | 37 +++++++++++++++++++ templates/cluster/aws-hosted-cp/values.yaml | 6 +++ .../templates/k0scontrolplane.yaml | 37 +++++++++++++++++++ .../cluster/aws-standalone-cp/values.yaml | 6 +++ .../templates/k0smotroncontrolplane.yaml | 19 ++++++++++ templates/cluster/azure-hosted-cp/values.yaml | 6 +++ .../templates/k0scontrolplane.yaml | 19 ++++++++++ .../cluster/azure-standalone-cp/values.yaml | 6 +++ .../templates/k0smotroncontrolplane.yaml | 31 ++++++++++++++++ .../cluster/vsphere-hosted-cp/values.yaml | 6 +++ .../templates/k0scontrolplane.yaml | 27 ++++++++++++++ .../cluster/vsphere-standalone-cp/values.yaml | 6 +++ 12 files changed, 206 insertions(+) diff --git a/templates/cluster/aws-hosted-cp/templates/k0smotroncontrolplane.yaml b/templates/cluster/aws-hosted-cp/templates/k0smotroncontrolplane.yaml index 5fb372752..3460717d1 100644 --- a/templates/cluster/aws-hosted-cp/templates/k0smotroncontrolplane.yaml +++ b/templates/cluster/aws-hosted-cp/templates/k0smotroncontrolplane.yaml @@ -27,9 +27,17 @@ spec: helm: repositories: - name: aws-cloud-controller-manager + {{- if .Values.extensions.chartRepository }} + url: {{ .Values.extensions.chartRepository }} + {{- else }} url: https://kubernetes.github.io/cloud-provider-aws + {{- end }} - name: aws-ebs-csi-driver + {{- if .Values.extensions.chartRepository }} + url: {{ .Values.extensions.chartRepository }} + {{- else }} url: https://kubernetes-sigs.github.io/aws-ebs-csi-driver + {{- end }} charts: - name: aws-cloud-controller-manager namespace: kube-system @@ -37,6 +45,9 @@ spec: version: "0.0.8" values: | image: + {{- if .Values.extensions.imageRepository }} + repository: {{ .Values.extensions.imageRepository }} + {{- end }} tag: v1.30.3 args: - --v=2 @@ -53,6 +64,32 @@ spec: chartname: aws-ebs-csi-driver/aws-ebs-csi-driver version: 2.33.0 values: | + {{- if .Values.extensions.imageRepository }} + image: + repository: {{ .Values.extensions.imageRepository }} + sidecars: + provisioner: + image: + repository: {{ .Values.extensions.imageRepository }} + attacher: + image: + repository: {{ .Values.extensions.imageRepository }} + snapshotter: + image: + repository: {{ .Values.extensions.imageRepository }} + livenessProbe: + image: + repository: {{ .Values.extensions.imageRepository }} + resizer: + image: + repository: {{ .Values.extensions.imageRepository }} + nodeDriverRegistrar: + image: + repository: {{ .Values.extensions.imageRepository }} + volumemodifier: + image: + repository: {{ .Values.extensions.imageRepository }} + {{- end }} defaultStorageClass: enabled: true node: diff --git a/templates/cluster/aws-hosted-cp/values.yaml b/templates/cluster/aws-hosted-cp/values.yaml index c19e244b7..c018fe1fd 100644 --- a/templates/cluster/aws-hosted-cp/values.yaml +++ b/templates/cluster/aws-hosted-cp/values.yaml @@ -47,3 +47,9 @@ k0smotron: # K0s parameters k0s: version: v1.31.1+k0s.1 + +# extensions defines custom Helm and image repositories to use for pulling +# k0s extensions. +extensions: + chartRepository: "" + imageRepository: "" \ No newline at end of file diff --git a/templates/cluster/aws-standalone-cp/templates/k0scontrolplane.yaml b/templates/cluster/aws-standalone-cp/templates/k0scontrolplane.yaml index 8d17a3497..f1992609e 100644 --- a/templates/cluster/aws-standalone-cp/templates/k0scontrolplane.yaml +++ b/templates/cluster/aws-standalone-cp/templates/k0scontrolplane.yaml @@ -28,9 +28,17 @@ spec: helm: repositories: - name: aws-cloud-controller-manager + {{- if .Values.extensions.chartRepository }} + url: {{ .Values.extensions.chartRepository }} + {{- else }} url: https://kubernetes.github.io/cloud-provider-aws + {{- end }} - name: aws-ebs-csi-driver + {{- if .Values.extensions.chartRepository }} + url: {{ .Values.extensions.chartRepository}} + {{- else }} url: https://kubernetes-sigs.github.io/aws-ebs-csi-driver + {{- end }} charts: - name: aws-cloud-controller-manager namespace: kube-system @@ -40,6 +48,9 @@ spec: nodeSelector: node-role.kubernetes.io/control-plane: "true" image: + {{- if .Values.extensions.imageRepository }} + repository: {{ .Values.extensions.imageRepository }} + {{- end }} tag: v1.30.3 args: - --v=2 @@ -52,6 +63,32 @@ spec: chartname: aws-ebs-csi-driver/aws-ebs-csi-driver version: 2.33.0 values: | + {{- if .Values.extensions.imageRepository }} + image: + repository: {{ .Values.extensions.imageRepository }} + sidecars: + provisioner: + image: + repository: {{ .Values.extensions.imageRepository }} + attacher: + image: + repository: {{ .Values.extensions.imageRepository }} + snapshotter: + image: + repository: {{ .Values.extensions.imageRepository }} + livenessProbe: + image: + repository: {{ .Values.extensions.imageRepository }} + resizer: + image: + repository: {{ .Values.extensions.imageRepository }} + nodeDriverRegistrar: + image: + repository: {{ .Values.extensions.imageRepository }} + volumemodifier: + image: + repository: {{ .Values.extensions.imageRepository }} + {{- end }} defaultStorageClass: enabled: true node: diff --git a/templates/cluster/aws-standalone-cp/values.yaml b/templates/cluster/aws-standalone-cp/values.yaml index 13499710a..6f0a019db 100644 --- a/templates/cluster/aws-standalone-cp/values.yaml +++ b/templates/cluster/aws-standalone-cp/values.yaml @@ -47,3 +47,9 @@ worker: # K0s parameters k0s: version: v1.31.1+k0s.1 + +# extensions defines custom Helm and image repositories to use for pulling +# k0s extensions. +extensions: + chartRepository: "" + imageRepository: "" diff --git a/templates/cluster/azure-hosted-cp/templates/k0smotroncontrolplane.yaml b/templates/cluster/azure-hosted-cp/templates/k0smotroncontrolplane.yaml index 856da34f6..a9bdcf710 100644 --- a/templates/cluster/azure-hosted-cp/templates/k0smotroncontrolplane.yaml +++ b/templates/cluster/azure-hosted-cp/templates/k0smotroncontrolplane.yaml @@ -26,9 +26,17 @@ spec: helm: repositories: - name: mirantis + {{- if .Values.extensions.chartRepository }} + url: {{ .Values.extensions.chartRepository }} + {{- else }} url: https://charts.mirantis.com + {{- end }} - name: azuredisk-csi-driver + {{- if .Values.extensions.chartRepository }} + url: {{ .Values.extensions.chartRepository }} + {{- else }} url: https://raw.githubusercontent.com/kubernetes-sigs/azuredisk-csi-driver/master/charts + {{- end }} charts: - name: cloud-provider-azure namespace: kube-system @@ -40,12 +48,23 @@ spec: cloudConfigSecretName: azure-cloud-provider nodeSelector: node-role.kubernetes.io/control-plane: null + {{- if .Values.extensions.imageRepository }} + imageRepository: {{ .Values.extensions.imageRepository }} + {{- end }} + {{- if .Values.extensions.imageRepository }} + cloudNodeManager: + imageRepository: {{ .Values.extensions.imageRepository }} + {{- end }} - name: azuredisk-csi-driver namespace: kube-system chartname: azuredisk-csi-driver/azuredisk-csi-driver version: 1.30.3 order: 2 values: | + {{- if .Values.extensions.imageRepository }} + image: + baseRepo: {{ .Values.extensions.imageRepository }} + {{- end }} controller: cloudConfigSecretName: azure-cloud-provider node: diff --git a/templates/cluster/azure-hosted-cp/values.yaml b/templates/cluster/azure-hosted-cp/values.yaml index 79aa4929a..b4e1b81e6 100644 --- a/templates/cluster/azure-hosted-cp/values.yaml +++ b/templates/cluster/azure-hosted-cp/values.yaml @@ -48,3 +48,9 @@ k0smotron: # K0s parameters k0s: version: v1.31.1+k0s.1 + +# extensions defines custom Helm and image repositories to use for pulling +# k0s extensions. +extensions: + chartRepository: "" + imageRepository: "" diff --git a/templates/cluster/azure-standalone-cp/templates/k0scontrolplane.yaml b/templates/cluster/azure-standalone-cp/templates/k0scontrolplane.yaml index 415108296..950891399 100644 --- a/templates/cluster/azure-standalone-cp/templates/k0scontrolplane.yaml +++ b/templates/cluster/azure-standalone-cp/templates/k0scontrolplane.yaml @@ -28,9 +28,17 @@ spec: helm: repositories: - name: mirantis + {{- if .Values.extensions.chartRepository }} + url: {{ .Values.extensions.chartRepository }} + {{- else }} url: https://charts.mirantis.com + {{- end }} - name: azuredisk-csi-driver + {{- if .Values.extensions.chartRepository }} + url: {{ .Values.extensions.chartRepository }} + {{- else }} url: https://raw.githubusercontent.com/kubernetes-sigs/azuredisk-csi-driver/master/charts + {{- end }} charts: - name: cloud-provider-azure namespace: kube-system @@ -42,12 +50,23 @@ spec: cloudConfigSecretName: azure-cloud-provider nodeSelector: node-role.kubernetes.io/control-plane: "true" + {{- if .Values.extensions.imageRepository }} + imageRepository: {{ .Values.extensions.imageRepository }} + {{- end }} + {{- if .Values.extensions.imageRepository }} + cloudNodeManager: + imageRepository: {{ .Values.extensions.imageRepository }} + {{- end }} - name: azuredisk-csi-driver namespace: kube-system chartname: azuredisk-csi-driver/azuredisk-csi-driver version: 1.30.3 order: 2 values: | + {{- if .Values.extensions.imageRepository }} + image: + baseRepo: {{ .Values.extensions.imageRepository }} + {{- end }} controller: cloudConfigSecretName: azure-cloud-provider node: diff --git a/templates/cluster/azure-standalone-cp/values.yaml b/templates/cluster/azure-standalone-cp/values.yaml index 801889805..bd7504aad 100644 --- a/templates/cluster/azure-standalone-cp/values.yaml +++ b/templates/cluster/azure-standalone-cp/values.yaml @@ -46,3 +46,9 @@ worker: # K0s parameters k0s: version: v1.31.1+k0s.1 + +# extensions defines custom Helm and image repositories to use for pulling +# k0s extensions. +extensions: + chartRepository: "" + imageRepository: "" diff --git a/templates/cluster/vsphere-hosted-cp/templates/k0smotroncontrolplane.yaml b/templates/cluster/vsphere-hosted-cp/templates/k0smotroncontrolplane.yaml index cd27b2ffc..01c2963e9 100644 --- a/templates/cluster/vsphere-hosted-cp/templates/k0smotroncontrolplane.yaml +++ b/templates/cluster/vsphere-hosted-cp/templates/k0smotroncontrolplane.yaml @@ -26,9 +26,17 @@ spec: helm: repositories: - name: vsphere-cpi + {{- if .Values.extensions.chartRepository }} + url: {{ .Values.extensions.chartRepository }} + {{- else }} url: https://kubernetes.github.io/cloud-provider-vsphere + {{- end }} - name: mirantis + {{- if .Values.extensions.chartRepository }} + url: {{ .Values.extensions.chartRepository }} + {{- else }} url: https://charts.mirantis.com + {{- end }} charts: - name: vsphere-cpi chartname: vsphere-cpi/vsphere-cpi @@ -40,6 +48,9 @@ spec: enabled: false daemonset: affinity: null + {{- if .Values.extensions.imageRepository }} + image: {{ .Values.extensions.imageRepository }}/cloud-provider-vsphere + {{- end }} tolerations: - effect: NoSchedule key: node.cloudprovider.kubernetes.io/uninitialized @@ -72,6 +83,26 @@ spec: enabled: true images: driver: + {{- if .Values.extensions.imageRepository }} + repo: {{ .Values.extensions.imageRepository }}/csi-vsphere/driver + {{- end }} tag: v3.1.2 syncer: + {{- if .Values.extensions.imageRepository }} + repo: {{ .Values.extensions.imageRepository }}/csi-vsphere/syncer + {{- end }} tag: v3.1.2 + {{- if .Values.extensions.imageRepository }} + nodeDriverRegistrar: + repo: {{ .Values.extensions.imageRepository }}/sig-storage/csi-node-driver-registrar + csiAttacher: + repo: {{ .Values.extensions.imageRepository }}/sig-storage/csi-attacher + csiResizer: + repo: {{ .Values.extensions.imageRepository }}/sig-storage/csi-resizer + csiProvisioner: + repo: {{ .Values.extensions.imageRepository }}/sig-storage/csi-provisioner + csiSnapshotter: + repo: {{ .Values.extensions.imageRepository }}/sig-storage/csi-snapshotter + livenessProbe: + repo: {{ .Values.extensions.imageRepository }}/csi-vsphere/livenessprobe + {{- end }} diff --git a/templates/cluster/vsphere-hosted-cp/values.yaml b/templates/cluster/vsphere-hosted-cp/values.yaml index 9af1941b7..187774dc8 100644 --- a/templates/cluster/vsphere-hosted-cp/values.yaml +++ b/templates/cluster/vsphere-hosted-cp/values.yaml @@ -42,3 +42,9 @@ k0smotron: # K0s parameters k0s: version: v1.31.1+k0s.1 + +# extensions defines custom Helm and image repositories to use for pulling +# k0s extensions. +extensions: + chartRepository: "" + imageRepository: "" diff --git a/templates/cluster/vsphere-standalone-cp/templates/k0scontrolplane.yaml b/templates/cluster/vsphere-standalone-cp/templates/k0scontrolplane.yaml index bf6d178e7..e20112915 100644 --- a/templates/cluster/vsphere-standalone-cp/templates/k0scontrolplane.yaml +++ b/templates/cluster/vsphere-standalone-cp/templates/k0scontrolplane.yaml @@ -47,6 +47,10 @@ spec: order: 1 namespace: kube-system values: | + {{- if .Values.extensions.imageRepository }} + image: + repository: {{ .Values.extensions.imageRepository }}/kube-vip + {{- end }} config: address: {{ .Values.controlPlaneEndpointIP }} env: @@ -74,6 +78,9 @@ spec: config: enabled: false daemonset: + {{- if .Values.extensions.imageRepository }} + image: {{ .Values.extensions.imageRepository }}/cloud-provider-vsphere + {{- end }} tolerations: - effect: NoSchedule key: node.cloudprovider.kubernetes.io/uninitialized @@ -104,9 +111,29 @@ spec: enabled: true images: driver: + {{- if .Values.extensions.imageRepository }} + repo: {{ .Values.extensions.imageRepository }}/csi-vsphere/driver + {{- end }} tag: v3.1.2 syncer: + {{- if .Values.extensions.imageRepository }} + repo: {{ .Values.extensions.imageRepository }}/csi-vsphere/syncer + {{- end }} tag: v3.1.2 + {{- if .Values.extensions.imageRepository }} + nodeDriverRegistrar: + repo: {{ .Values.extensions.imageRepository }}/sig-storage/csi-node-driver-registrar + csiAttacher: + repo: {{ .Values.extensions.imageRepository }}/sig-storage/csi-attacher + csiResizer: + repo: {{ .Values.extensions.imageRepository }}/sig-storage/csi-resizer + csiProvisioner: + repo: {{ .Values.extensions.imageRepository }}/sig-storage/csi-provisioner + csiSnapshotter: + repo: {{ .Values.extensions.imageRepository }}/sig-storage/csi-snapshotter + livenessProbe: + repo: {{ .Values.extensions.imageRepository }}/csi-vsphere/livenessprobe + {{- end }} machineTemplate: infrastructureRef: apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 diff --git a/templates/cluster/vsphere-standalone-cp/values.yaml b/templates/cluster/vsphere-standalone-cp/values.yaml index 67d95c472..eb64d7080 100644 --- a/templates/cluster/vsphere-standalone-cp/values.yaml +++ b/templates/cluster/vsphere-standalone-cp/values.yaml @@ -46,3 +46,9 @@ worker: # K0s parameters k0s: version: v1.31.1+k0s.1 + +# extensions defines custom Helm and image repositories to use for pulling +# k0s extensions. +extensions: + chartRepository: "" + imageRepository: ""