2024-10-31 16:54:18 +01:00
|
|
|
# Control plane provider
|
|
|
|
{{- if .Values.controlPlane }}
|
|
|
|
{{- $controlPlanes := split ";" .Values.controlPlane }}
|
|
|
|
{{- $controlPlaneNamespace := "" }}
|
|
|
|
{{- $controlPlaneName := "" }}
|
|
|
|
{{- $controlPlaneVersion := "" }}
|
|
|
|
{{- range $controlPlane := $controlPlanes }}
|
|
|
|
{{- $controlPlaneArgs := split ":" $controlPlane }}
|
|
|
|
{{- $controlPlaneArgsLen := len $controlPlaneArgs }}
|
|
|
|
{{- if eq $controlPlaneArgsLen 3 }}
|
|
|
|
{{- $controlPlaneNamespace = $controlPlaneArgs._0 }}
|
|
|
|
{{- $controlPlaneName = $controlPlaneArgs._1 }}
|
|
|
|
{{- $controlPlaneVersion = $controlPlaneArgs._2 }}
|
|
|
|
{{- else if eq $controlPlaneArgsLen 2 }}
|
|
|
|
{{- $controlPlaneNamespace = print $controlPlaneArgs._0 "-control-plane-system" }}
|
|
|
|
{{- $controlPlaneName = $controlPlaneArgs._0 }}
|
|
|
|
{{- $controlPlaneVersion = $controlPlaneArgs._1 }}
|
|
|
|
{{- else if eq $controlPlaneArgsLen 1 }}
|
|
|
|
{{- $controlPlaneNamespace = print $controlPlaneArgs._0 "-control-plane-system" }}
|
|
|
|
{{- $controlPlaneName = $controlPlaneArgs._0 }}
|
|
|
|
{{- else }}
|
|
|
|
{{- fail "controlplane provider argument should have the following format kubeadm:v1.0.0 or mynamespace:kubeadm:v1.0.0" }}
|
|
|
|
{{- end }}
|
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
|
|
kind: Namespace
|
|
|
|
metadata:
|
|
|
|
annotations:
|
2024-11-14 19:12:54 +01:00
|
|
|
"helm.sh/hook": "post-install,post-upgrade"
|
2024-10-31 16:54:18 +01:00
|
|
|
"helm.sh/hook-weight": "1"
|
|
|
|
name: {{ $controlPlaneNamespace }}
|
|
|
|
---
|
|
|
|
apiVersion: operator.cluster.x-k8s.io/v1alpha2
|
|
|
|
kind: ControlPlaneProvider
|
|
|
|
metadata:
|
|
|
|
name: {{ $controlPlaneName }}
|
|
|
|
namespace: {{ $controlPlaneNamespace }}
|
|
|
|
annotations:
|
2024-11-14 19:12:54 +01:00
|
|
|
"helm.sh/hook": "post-install,post-upgrade"
|
2024-10-31 16:54:18 +01:00
|
|
|
"helm.sh/hook-weight": "2"
|
|
|
|
{{- if or $controlPlaneVersion $.Values.configSecret.name }}
|
|
|
|
spec:
|
|
|
|
{{- end}}
|
|
|
|
{{- if $controlPlaneVersion }}
|
|
|
|
version: {{ $controlPlaneVersion }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if $.Values.configSecret.name }}
|
|
|
|
configSecret:
|
|
|
|
name: {{ $.Values.configSecret.name }}
|
|
|
|
{{- if $.Values.configSecret.namespace }}
|
|
|
|
namespace: {{ $.Values.configSecret.namespace }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|