diff --git a/hack/charts/cluster-api-operator/templates/addon.yaml b/hack/charts/cluster-api-operator/templates/addon.yaml index c571b60aa..c32e2c994 100644 --- a/hack/charts/cluster-api-operator/templates/addon.yaml +++ b/hack/charts/cluster-api-operator/templates/addon.yaml @@ -1,26 +1,9 @@ # Addon provider {{- if .Values.addon }} -{{- $addons := split ";" .Values.addon }} -{{- $addonNamespace := "" }} -{{- $addonName := "" }} -{{- $addonVersion := "" }} -{{- range $addon := $addons }} -{{- $addonArgs := split ":" $addon }} -{{- $addonArgsLen := len $addonArgs }} -{{- if eq $addonArgsLen 3 }} - {{- $addonNamespace = $addonArgs._0 }} - {{- $addonName = $addonArgs._1 }} - {{- $addonVersion = $addonArgs._2 }} -{{- else if eq $addonArgsLen 2 }} - {{- $addonNamespace = print $addonArgs._0 "-addon-system" }} - {{- $addonName = $addonArgs._0 }} - {{- $addonVersion = $addonArgs._1 }} -{{- else if eq $addonArgsLen 1 }} - {{- $addonNamespace = print $addonArgs._0 "-addon-system" }} - {{- $addonName = $addonArgs._0 }} -{{- else }} - {{- fail "addon provider argument should have the following format helm:v1.0.0 or mynamespace:helm:v1.0.0" }} -{{- end }} +{{- range $addon := .Values.addon }} + {{- $addonNamespace := default ( printf "%s-%s" $addon.name "addon-system" ) $addon.namespace }} + {{- $addonName := $addon.name }} + {{- $addonVersion := $addon.version }} --- apiVersion: v1 kind: Namespace @@ -52,5 +35,25 @@ spec: {{- if $.Values.secretNamespace }} secretNamespace: {{ $.Values.secretNamespace }} {{- end }} +{{- if $addon.manifestPatches }} + manifestPatches: {{ toYaml $addon.manifestPatches | nindent 4 }} +{{- end }} +{{- if $addon.additionalManifests }} + additionalManifests: + name: {{ $addon.additionalManifests.name }} + {{- if $addon.additionalManifests.namespace }} + namespace: {{ $addon.additionalManifests.namespace }} + {{- end }} {{/* if $addon.additionalManifests.namespace */}} {{- end }} +{{- if $addon.additionalManifests }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ $addon.additionalManifests.name }} + namespace: {{ default $addonNamespace $addon.additionalManifests.namespace }} +data: + manifests: {{- toYaml $addon.additionalManifests.manifests | nindent 4 }} {{- end }} +{{- end }} {{/* range $addon := .Values.addon */}} +{{- end }} {{/* if .Values.addon */}} diff --git a/hack/charts/cluster-api-operator/templates/bootstrap.yaml b/hack/charts/cluster-api-operator/templates/bootstrap.yaml index 69a930f2a..f00efd389 100644 --- a/hack/charts/cluster-api-operator/templates/bootstrap.yaml +++ b/hack/charts/cluster-api-operator/templates/bootstrap.yaml @@ -1,26 +1,9 @@ # Bootstrap provider {{- if .Values.bootstrap }} -{{- $bootstraps := split ";" .Values.bootstrap }} -{{- $bootstrapNamespace := "" }} -{{- $bootstrapName := "" }} -{{- $bootstrapVersion := "" }} -{{- range $bootstrap := $bootstraps }} -{{- $bootstrapArgs := split ":" $bootstrap }} -{{- $bootstrapArgsLen := len $bootstrapArgs }} -{{- if eq $bootstrapArgsLen 3 }} - {{- $bootstrapNamespace = $bootstrapArgs._0 }} - {{- $bootstrapName = $bootstrapArgs._1 }} - {{- $bootstrapVersion = $bootstrapArgs._2 }} -{{- else if eq $bootstrapArgsLen 2 }} - {{- $bootstrapNamespace = print $bootstrapArgs._0 "-bootstrap-system" }} - {{- $bootstrapName = $bootstrapArgs._0 }} - {{- $bootstrapVersion = $bootstrapArgs._1 }} -{{- else if eq $bootstrapArgsLen 1 }} - {{- $bootstrapNamespace = print $bootstrapArgs._0 "-bootstrap-system" }} - {{- $bootstrapName = $bootstrapArgs._0 }} -{{- else }} - {{- fail "bootstrap provider argument should have the following format kubeadm:v1.0.0 or mynamespace:kubeadm:v1.0.0" }} -{{- end }} +{{- range $bootstrap := .Values.bootstrap }} + {{- $bootstrapNamespace := default ( printf "%s-%s" $bootstrap.name "bootstrap-system" ) $bootstrap.namespace }} + {{- $bootstrapName := $bootstrap.name }} + {{- $bootstrapVersion := $bootstrap.version }} --- apiVersion: v1 kind: Namespace @@ -51,5 +34,25 @@ spec: namespace: {{ $.Values.configSecret.namespace }} {{- end }} {{- end }} +{{- if $bootstrap.manifestPatches }} + manifestPatches: {{ toYaml $bootstrap.manifestPatches | nindent 4 }} +{{- end }} +{{- if $bootstrap.additionalManifests }} + additionalManifests: + name: {{ $bootstrap.additionalManifests.name }} + {{- if $bootstrap.additionalManifests.namespace }} + namespace: {{ $bootstrap.additionalManifests.namespace }} + {{- end }} {{/* if $bootstrap.additionalManifests.namespace */}} {{- end }} +{{- if $bootstrap.additionalManifests }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ $bootstrap.additionalManifests.name }} + namespace: {{ default $bootstrapNamespace $bootstrap.additionalManifests.namespace }} +data: + manifests: {{- toYaml $bootstrap.additionalManifests.manifests | nindent 4 }} {{- end }} +{{- end }} {{/* range $bootstrap := .Values.bootstrap */}} +{{- end }} {{/* if .Values.bootstrap */}} diff --git a/hack/charts/cluster-api-operator/templates/control-plane.yaml b/hack/charts/cluster-api-operator/templates/control-plane.yaml index d48e0c269..d35a46df2 100644 --- a/hack/charts/cluster-api-operator/templates/control-plane.yaml +++ b/hack/charts/cluster-api-operator/templates/control-plane.yaml @@ -1,26 +1,9 @@ # 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 }} +{{- range $controlPlane := .Values.controlPlane }} + {{- $controlPlaneNamespace := default ( printf "%s-%s" $controlPlane.name "control-plane-system" ) $controlPlane.namespace }} + {{- $controlPlaneName := $controlPlane.name }} + {{- $controlPlaneVersion := $controlPlane.version }} --- apiVersion: v1 kind: Namespace @@ -51,5 +34,25 @@ spec: namespace: {{ $.Values.configSecret.namespace }} {{- end }} {{- end }} +{{- if $controlPlane.manifestPatches }} + manifestPatches: {{ toYaml $controlPlane.manifestPatches | nindent 4 }} {{- end }} +{{- if $controlPlane.additionalManifests }} + additionalManifests: + name: {{ $controlPlane.additionalManifests.name }} + {{- if $controlPlane.additionalManifests.namespace }} + namespace: {{ $controlPlane.additionalManifests.namespace }} + {{- end }} {{/* if $controlPlane.additionalManifests.namespace */}} {{- end }} +{{- if $controlPlane.additionalManifests }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ $controlPlane.additionalManifests.name }} + namespace: {{ default $controlPlaneNamespace $controlPlane.additionalManifests.namespace }} +data: + manifests: {{- toYaml $controlPlane.additionalManifests.manifests | nindent 4 }} +{{- end }} +{{- end }} {{/* range $controlPlane := .Values.controlPlane */}} +{{- end }} {{/* if .Values.controlPlane */}} diff --git a/hack/charts/cluster-api-operator/templates/core.yaml b/hack/charts/cluster-api-operator/templates/core.yaml index 2d0d8b76c..b1e330795 100644 --- a/hack/charts/cluster-api-operator/templates/core.yaml +++ b/hack/charts/cluster-api-operator/templates/core.yaml @@ -1,25 +1,8 @@ # Core provider {{- if .Values.core }} -{{- $coreArgs := split ":" .Values.core }} -{{- $coreArgsLen := len $coreArgs }} -{{- $coreVersion := "" }} -{{- $coreNamespace := "" }} -{{- $coreName := "" }} -{{- $coreVersion := "" }} -{{- if eq $coreArgsLen 3 }} - {{- $coreNamespace = $coreArgs._0 }} - {{- $coreName = $coreArgs._1 }} - {{- $coreVersion = $coreArgs._2 }} -{{- else if eq $coreArgsLen 2 }} - {{- $coreNamespace = "capi-system" }} - {{- $coreName = $coreArgs._0 }} - {{- $coreVersion = $coreArgs._1 }} -{{- else if eq $coreArgsLen 1 }} - {{- $coreNamespace = "capi-system" }} - {{- $coreName = $coreArgs._0 }} -{{- else }} - {{- fail "core provider argument should have the following format cluster-api:v1.0.0 or mynamespace:cluster-api:v1.0.0" }} -{{- end }} + {{- $coreNamespace := default ( printf "%s-%s" .Values.core.name "capi-system" ) .Values.core.namespace }} + {{- $coreName := .Values.core.name }} + {{- $coreVersion := .Values.core.version }} --- apiVersion: v1 kind: Namespace @@ -60,4 +43,24 @@ spec: namespace: {{ $.Values.configSecret.namespace }} {{- end }} {{- end }} +{{- if .Values.core.manifestPatches }} + manifestPatches: {{ toYaml .Values.core.manifestPatches | nindent 4 }} {{- end }} +{{- if .Values.core.additionalManifests }} + additionalManifests: + name: {{ .Values.core.additionalManifests.name }} + {{- if .Values.core.additionalManifests.namespace }} + namespace: {{ .Values.core.additionalManifests.namespace }} + {{- end }} {{/* if .Values.core.additionalManifests.namespace */}} +{{- end }} +{{- if .Values.core.additionalManifests }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Values.core.additionalManifests.name }} + namespace: {{ default .Values.coreNamespace .Values.core.additionalManifests.namespace }} +data: + manifests: {{- toYaml .Values.core.additionalManifests.manifests | nindent 4 }} +{{- end }} +{{- end }} {{/* if .Values.core */}} diff --git a/hack/charts/cluster-api-operator/templates/infra.yaml b/hack/charts/cluster-api-operator/templates/infra.yaml index 269bffd13..da8b2d2f3 100644 --- a/hack/charts/cluster-api-operator/templates/infra.yaml +++ b/hack/charts/cluster-api-operator/templates/infra.yaml @@ -1,26 +1,9 @@ # Infrastructure providers {{- if .Values.infrastructure }} -{{- $infrastructures := split ";" .Values.infrastructure }} -{{- $infrastructureNamespace := "" }} -{{- $infrastructureName := "" }} -{{- $infrastructureVersion := "" }} -{{- range $infrastructure := $infrastructures }} -{{- $infrastructureArgs := split ":" $infrastructure }} -{{- $infrastructureArgsLen := len $infrastructureArgs }} -{{- if eq $infrastructureArgsLen 3 }} - {{- $infrastructureNamespace = $infrastructureArgs._0 }} - {{- $infrastructureName = $infrastructureArgs._1 }} - {{- $infrastructureVersion = $infrastructureArgs._2 }} -{{- else if eq $infrastructureArgsLen 2 }} - {{- $infrastructureNamespace = print $infrastructureArgs._0 "-infrastructure-system" }} - {{- $infrastructureName = $infrastructureArgs._0 }} - {{- $infrastructureVersion = $infrastructureArgs._1 }} -{{- else if eq $infrastructureArgsLen 1 }} - {{- $infrastructureNamespace = print $infrastructureArgs._0 "-infrastructure-system" }} - {{- $infrastructureName = $infrastructureArgs._0 }} -{{- else }} - {{- fail "infrastructure provider argument should have the following format aws:v1.0.0 or mynamespace:aws:v1.0.0" }} -{{- end }} +{{- range $infra := .Values.infrastructure }} + {{- $infrastructureNamespace := default ( printf "%s-%s" $infra.name "infrastructure-system" ) $infra.namespace }} + {{- $infrastructureName := $infra.name }} + {{- $infrastructureVersion := $infra.version }} --- apiVersion: v1 kind: Namespace @@ -69,5 +52,25 @@ spec: {{- if $.Values.additionalDeployments }} additionalDeployments: {{ toYaml $.Values.additionalDeployments | nindent 4 }} {{- end }} +{{- if $infra.manifestPatches }} + manifestPatches: {{- toYaml $infra.manifestPatches | nindent 4 }} +{{- end }} {{/* if $infra.manifestPatches */}} +{{- if $infra.additionalManifests }} + additionalManifests: + name: {{ $infra.additionalManifests.name }} + {{- if $infra.additionalManifests.namespace }} + namespace: {{ $infra.additionalManifests.namespace }} + {{- end }} {{/* if $infra.additionalManifests.namespace */}} +{{- end }} {{/* if $infra.additionalManifests */}} +{{- if $infra.additionalManifests }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ $infra.additionalManifests.name }} + namespace: {{ default $infrastructureNamespace $infra.additionalManifests.namespace }} +data: + manifests: {{- toYaml $infra.additionalManifests.manifests | nindent 4 }} {{- end }} -{{- end }} +{{- end }} {{/* range $infra := .Values.infrastructure */}} +{{- end }} {{/* if .Values.infrastructure */}} diff --git a/hack/charts/cluster-api-operator/values.yaml b/hack/charts/cluster-api-operator/values.yaml index 1d2fb0cc5..9b9589ea1 100644 --- a/hack/charts/cluster-api-operator/values.yaml +++ b/hack/charts/cluster-api-operator/values.yaml @@ -1,11 +1,26 @@ --- # --- # Cluster API provider options -core: "" -bootstrap: "" -controlPlane: "" -infrastructure: "" -addon: "" +core: + name: "" + # namespace: "" # Optional + # version: "" # Optional +bootstrap: + - name: "" +# namespace: "" # Optional +# version: "" # Optional +controlPlane: + - name: "" +# namespace: "" # Optional +# version: "" # Optional +infrastructure: + - name: "" +# namespace: "" # Optional +# version: "" # Optional +addon: + - name: "" +# namespace: "" # Optional +# version: "" # Optional manager.featureGates: {} # --- # Common configuration secret options