From e99f3f0c88fd2df47d7580b36f746b5bc812b5f7 Mon Sep 17 00:00:00 2001 From: Alexandr Demicev Date: Tue, 12 Sep 2023 13:29:50 +0200 Subject: [PATCH] Install bootstrap and control plane providers using helm chart values Signed-off-by: Alexandr Demicev --- .../templates/core-provider.yaml | 30 ++++++++-------- .../templates/kubeadm-bootstrap.yaml | 36 +++++++++++++++++++ .../templates/kubeadm-control-plane.yaml | 36 +++++++++++++++++++ charts/rancher-turtles/values.yaml | 22 +++++++++--- 4 files changed, 104 insertions(+), 20 deletions(-) create mode 100644 charts/rancher-turtles/templates/kubeadm-bootstrap.yaml create mode 100644 charts/rancher-turtles/templates/kubeadm-control-plane.yaml diff --git a/charts/rancher-turtles/templates/core-provider.yaml b/charts/rancher-turtles/templates/core-provider.yaml index 3d50f811..3377bb7a 100644 --- a/charts/rancher-turtles/templates/core-provider.yaml +++ b/charts/rancher-turtles/templates/core-provider.yaml @@ -1,4 +1,4 @@ -{{- if .Values.capi.enabled }} +{{- if .Values.cluster-api.enabled }} --- apiVersion: v1 kind: Namespace @@ -6,34 +6,34 @@ metadata: annotations: "helm.sh/hook": "post-install, post-upgrade" "helm.sh/hook-weight": "1" - name: {{ .Values.capi.namespace }} + name: {{ .Values.cluster-api.core.namespace }} --- apiVersion: operator.cluster.x-k8s.io/v1alpha1 kind: CoreProvider metadata: name: cluster-api - namespace: {{ .Values.capi.namespace }} + namespace: {{ .Values.cluster-api.core.namespace }} annotations: "helm.sh/hook": "post-install, post-upgrade" "helm.sh/hook-weight": "2" spec: - version: v1.4.6 + version: {{ $.Values.cluster-api.version }} additionalManifests: name: capi-additional-rbac-roles - namespace: {{ .Values.capi.namespace }} -{{- if $.Values.capi.configSecret.name }} - secretName: {{ $.Values.capi.configSecret.name }} -{{- if $.Values.capi.configSecret.namespace }} - secretNamespace: {{ $.Values.capi.configSecret.namespace }} + namespace: {{ .Values.cluster-api.core.namespace }} +{{- if $.Values.cluster-api.configSecret.name }} + secretName: {{ $.Values.cluster-api.configSecret.name }} +{{- if $.Values.cluster-api.configSecret.namespace }} + secretNamespace: {{ $.Values.cluster-api.configSecret.namespace }} {{- end }} {{- end }} -{{- if or $.Values.capi.fetchConfig.url $.Values.capi.configSecret.selector }} +{{- if or $.Values.cluster-api.core.fetchConfig.url $.Values.cluster-api.core.fetchConfig.selector }} fetchConfig: - {{- if $.Values.capi.configSecret.url }} - url: {{ $.Values.capi.configSecret.url }} + {{- if $.Values.cluster-api.core.fetchConfig.url }} + url: {{ $.Values.cluster-api.core.fetchConfig.url }} {{- end }} - {{- if $.Values.capi.configSecret.selector }} - selector: {{ $.Values.capi.configSecret.selector }} + {{- if $.Values.cluster-api.core.fetchConfig.selector }} + selector: {{ $.Values.cluster-api.core.fetchConfig.selector }} {{- end }} {{- end }} --- @@ -41,7 +41,7 @@ apiVersion: v1 kind: ConfigMap metadata: name: capi-additional-rbac-roles - namespace: {{ .Values.capi.namespace }} + namespace: {{ .Values.cluster-api.core.namespace }} annotations: "helm.sh/hook": "post-install, post-upgrade" "helm.sh/hook-weight": "2" diff --git a/charts/rancher-turtles/templates/kubeadm-bootstrap.yaml b/charts/rancher-turtles/templates/kubeadm-bootstrap.yaml new file mode 100644 index 00000000..e42433b9 --- /dev/null +++ b/charts/rancher-turtles/templates/kubeadm-bootstrap.yaml @@ -0,0 +1,36 @@ +{{- if .Values.cluster-api.enabled }} +--- +apiVersion: v1 +kind: Namespace +metadata: + annotations: + "helm.sh/hook": "post-install, post-upgrade" + "helm.sh/hook-weight": "1" + name: {{ .Values.cluster-api.kubeadm-bootstrap.namespace }} +--- +apiVersion: operator.cluster.x-k8s.io/v1alpha1 +kind: BootstrapProvider +metadata: + name: kubeadm + namespace: {{ .Values.cluster-api.kubeadm-bootstrap.namespace }} + annotations: + "helm.sh/hook": "post-install, post-upgrade" + "helm.sh/hook-weight": "2" +spec: + version: {{ $.Values.cluster-api.version }} +{{- if $.Values.cluster-api.configSecret.name }} + secretName: {{ $.Values.cluster-api.configSecret.name }} +{{- if $.Values.cluster-api.configSecret.namespace }} + secretNamespace: {{ $.Values.cluster-api.configSecret.namespace }} +{{- end }} +{{- end }} +{{- if or $.Values.cluster-api.kubeadm-bootstrap.fetchConfig.url $.Values.cluster-api.kubeadm-bootstrap.fetchConfig.selector }} + fetchConfig: + {{- if $.Values.cluster-api.kubeadm-bootstrap.fetchConfig.url }} + url: {{ $.Values.cluster-api.kubeadm-bootstrap.fetchConfig.url }} + {{- end }} + {{- if $.Values.cluster-api.kubeadm-bootstrap.fetchConfig.selector }} + selector: {{ $.Values.cluster-api.kubeadm-bootstrap.fetchConfig.selector }} + {{- end }} +{{- end }} +{{- end }} diff --git a/charts/rancher-turtles/templates/kubeadm-control-plane.yaml b/charts/rancher-turtles/templates/kubeadm-control-plane.yaml new file mode 100644 index 00000000..8ee2ac8e --- /dev/null +++ b/charts/rancher-turtles/templates/kubeadm-control-plane.yaml @@ -0,0 +1,36 @@ +{{- if .Values.cluster-api.enabled }} +--- +apiVersion: v1 +kind: Namespace +metadata: + annotations: + "helm.sh/hook": "post-install, post-upgrade" + "helm.sh/hook-weight": "1" + name: {{ .Values.cluster-api.kubeadm-control-plane.namespace }} +--- +apiVersion: operator.cluster.x-k8s.io/v1alpha1 +kind: BootstrapProvider +metadata: + name: kubeadm + namespace: {{ .Values.cluster-api.kubeadm-control-plane.namespace }} + annotations: + "helm.sh/hook": "post-install, post-upgrade" + "helm.sh/hook-weight": "2" +spec: + version: {{ $.Values.cluster-api.version }} +{{- if $.Values.cluster-api.configSecret.name }} + secretName: {{ $.Values.cluster-api.configSecret.name }} +{{- if $.Values.cluster-api.configSecret.namespace }} + secretNamespace: {{ $.Values.cluster-api.configSecret.namespace }} +{{- end }} +{{- end }} +{{- if or $.Values.cluster-api.kubeadm-control-plane.fetchConfig.url $.Values.cluster-api.kubeadm-control-plane.fetchConfig.selector }} + fetchConfig: + {{- if $.Values.cluster-api.kubeadm-control-plane.fetchConfig.url }} + url: {{ $.Values.cluster-api.kubeadm-control-plane.fetchConfig.url }} + {{- end }} + {{- if $.Values.cluster-api.kubeadm-control-plane.fetchConfig.selector }} + selector: {{ $.Values.cluster-api.kubeadm-control-plane.fetchConfig.selector }} + {{- end }} +{{- end }} +{{- end }} diff --git a/charts/rancher-turtles/values.yaml b/charts/rancher-turtles/values.yaml index de10b805..a145d08f 100644 --- a/charts/rancher-turtles/values.yaml +++ b/charts/rancher-turtles/values.yaml @@ -3,14 +3,26 @@ rancherTurtles: tag: v0.0.0 imagePullPolicy: Never namespace: rancher-turtles-system -capi: +cluster-api: enabled: true - namespace: capi-system + version: v1.4.6 configSecret: name: "" namespace: "" - fetchConfig: - url: "" - selector: "" + core: + namespace: capi-system + fetchConfig: + url: "" + selector: "" + kubeadm-bootstrap: + namespace: capi-kubeadm-bootstrap-system + fetchConfig: + url: "" + selector: "" + kubeadm-control-plane: + namespace: capi-kubeadm-control-plane-system + fetchConfig: + url: "" + selector: "" cluster-api-operator: enabled: true