forked from suse-edge/Factory
85 lines
2.8 KiB
YAML
85 lines
2.8 KiB
YAML
|
{{- define "recursivePrinter" }}
|
||
|
{{- range $key, $value := . }}
|
||
|
{{- if kindIs "map" $value }}
|
||
|
{{ $key }}:
|
||
|
{{- include "recursivePrinter" $value | indent 2 }}
|
||
|
{{- else }}
|
||
|
{{ $key }}: {{ $value }}
|
||
|
{{- end }}
|
||
|
{{- end }}
|
||
|
{{- end }}
|
||
|
# 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 }}
|
||
|
---
|
||
|
apiVersion: v1
|
||
|
kind: Namespace
|
||
|
metadata:
|
||
|
annotations:
|
||
|
"helm.sh/hook": "post-install"
|
||
|
"helm.sh/hook-weight": "1"
|
||
|
"argocd.argoproj.io/sync-wave": "1"
|
||
|
name: {{ $infrastructureNamespace }}
|
||
|
---
|
||
|
apiVersion: operator.cluster.x-k8s.io/v1alpha2
|
||
|
kind: InfrastructureProvider
|
||
|
metadata:
|
||
|
name: {{ $infrastructureName }}
|
||
|
namespace: {{ $infrastructureNamespace }}
|
||
|
annotations:
|
||
|
"helm.sh/hook": "post-install"
|
||
|
"helm.sh/hook-weight": "2"
|
||
|
"argocd.argoproj.io/sync-wave": "2"
|
||
|
{{- if or $infrastructureVersion $.Values.configSecret.name $.Values.manager $.Values.additionalDeployments }}
|
||
|
spec:
|
||
|
{{- end }}
|
||
|
{{- if $infrastructureVersion }}
|
||
|
version: {{ $infrastructureVersion }}
|
||
|
{{- end }}
|
||
|
{{- if $.Values.manager }}
|
||
|
manager:
|
||
|
{{- if and (kindIs "map" $.Values.manager.featureGates) (hasKey $.Values.manager.featureGates $infrastructureName) }}
|
||
|
{{- range $key, $value := $.Values.manager.featureGates }}
|
||
|
{{- if eq $key $infrastructureName }}
|
||
|
featureGates:
|
||
|
{{- range $k, $v := $value }}
|
||
|
{{ $k }}: {{ $v }}
|
||
|
{{- end }}
|
||
|
{{- end }}
|
||
|
{{- end }}
|
||
|
{{- end }}
|
||
|
{{- end }}
|
||
|
{{- if $.Values.configSecret.name }}
|
||
|
configSecret:
|
||
|
name: {{ $.Values.configSecret.name }}
|
||
|
{{- if $.Values.configSecret.namespace }}
|
||
|
namespace: {{ $.Values.configSecret.namespace }}
|
||
|
{{- end }}
|
||
|
{{- end }}
|
||
|
{{- if $.Values.additionalDeployments }}
|
||
|
additionalDeployments:
|
||
|
{{- include "recursivePrinter" $.Values.additionalDeployments | indent 2 }}
|
||
|
{{- end }}
|
||
|
{{- end }}
|
||
|
{{- end }}
|