diff --git a/chart/templates/_helpers.tpl b/chart/templates/_helpers.tpl index 3ccf2c539441650bdd26ca66287662003e6d4121..a972c4d62aec28a689642b276d129906937dfd33 100644 --- a/chart/templates/_helpers.tpl +++ b/chart/templates/_helpers.tpl @@ -1,3 +1,45 @@ +{{- define "values-bigbang" -}} +{{- /* + * bigbang.values-bigbang: Produce a stripped version of the bigbang variables + * in the root namespace suitable for inclusion in wrapper or package variables definitions + */ -}} +{{ toYaml (pick $ "domain" "openshift") }} +{{- /* For every top level map, if it has the enable key, pass it through. */ -}} +{{- range $bbpkg, $bbvals := $ -}} + {{- if kindIs "map" $bbvals -}} + {{- if hasKey $bbvals "enabled" }} +{{ $bbpkg }}: + {{- /* For network policies, we need all of its values. */ -}} + {{- if eq $bbpkg "networkPolicies" -}} + {{- toYaml $bbvals | nindent 2}} + {{- else }} + enabled: {{ $bbvals.enabled }} + {{- end -}} + {{- /* For addons, pass through the enable key. */ -}} + {{- else if eq $bbpkg "addons" }} +{{ $bbpkg }}: + {{- range $addpkg, $addvals := $bbvals -}} + {{- if hasKey $addvals "enabled" }} + {{ $addpkg }}: + enabled: {{ $addvals.enabled }} + {{- /* For authservice, the selector values are needed. */ -}} + {{- if and (eq $addpkg "authservice") (or (dig "values" "selector" "key" false $addvals) (dig "values" "selector" "value" false $addvals)) }} + values: + selector: + {{- if (dig "values" "selector" "key" false $addvals) }} + key: {{ $addvals.values.selector.key }} + {{- end -}} + {{- if (dig "values" "selector" "value" false $addvals) }} + value: {{ $addvals.values.selector.key }} + {{- end -}} + {{- end -}} + {{- end -}} + {{- end -}} + {{- end -}} + {{- end -}} +{{- end -}} +{{- end }} + {{- define "imagePullSecret" }} {{- if .Values.registryCredentials -}} {{- $credType := typeOf .Values.registryCredentials -}} @@ -394,3 +436,5 @@ data: {{- end -}} {{- end -}} {{- end -}} + + diff --git a/chart/templates/package/values.yaml b/chart/templates/package/values.yaml index b2ef1a9a382fd78c9b13ac20f08a2e78ecfa5c0f..9937ad5e90fd6c83a72b2b03f4abdc11015099e4 100644 --- a/chart/templates/package/values.yaml +++ b/chart/templates/package/values.yaml @@ -17,6 +17,8 @@ type: Opaque stringData: {{ if and (dig "enabled" true $vals) (not $vals.kustomize) -}} values.yaml: | + bigbang: + {{- include "values-bigbang" $.Values | nindent 6 }} {{- tpl (toYaml $vals.values) $ | nindent 4 }} {{ else }} {{- tpl (toYaml $vals.values) $ | nindent 2 }} diff --git a/chart/templates/wrapper/values.yaml b/chart/templates/wrapper/values.yaml index 8606a78f601f9305a85c7128e0429159c1f21043..7c05114408ef044798ca653be3d94af234afe408 100644 --- a/chart/templates/wrapper/values.yaml +++ b/chart/templates/wrapper/values.yaml @@ -19,41 +19,7 @@ stringData: {{- tpl (toYaml (omit $merged.package "git" "helmRepo" "flux" "postRenderers" "dependsOn")) $ | nindent 6 }} {{- end }} bigbang: - {{- toYaml (pick $merged.bigbang "domain" "openshift") | nindent 6 -}} - {{- /* For every top level map, if it has the enable key, pass it through. */ -}} - {{- range $bbpkg, $bbvals := $merged.bigbang -}} - {{- if kindIs "map" $bbvals -}} - {{- if hasKey $bbvals "enabled" -}} - {{- $bbpkg | nindent 6 -}}: - {{- /* For network policies, we need all of its values. */ -}} - {{- if eq $bbpkg "networkPolicies" -}} - {{- toYaml $bbvals | nindent 8 -}} - {{- else }} - enabled: {{ $bbvals.enabled }} - {{- end -}} - {{- /* For addons, pass through the enable key. */ -}} - {{- else if eq $bbpkg "addons" -}} - {{- $bbpkg | nindent 6 -}}: - {{- range $addpkg, $addvals := $bbvals -}} - {{- if hasKey $addvals "enabled" -}} - {{- $addpkg | nindent 8 }}: - enabled: {{ $addvals.enabled }} - {{- /* For authservice, the selector values are needed. */ -}} - {{- if and (eq $addpkg "authservice") (or (dig "values" "selector" "key" false $addvals) (dig "values" "selector" "value" false $addvals)) }} - values: - selector: - {{- if (dig "values" "selector" "key" false $addvals) -}} - key: {{ $addvals.values.selector.key }} - {{- end -}} - {{- if (dig "values" "selector" "value" false $addvals) -}} - value: {{ $addvals.values.selector.key }} - {{- end -}} - {{- end -}} - {{- end -}} - {{- end -}} - {{- end -}} - {{- end -}} - {{- end }} + {{- include "values-bigbang" $merged.bigbang | nindent 6 }} --- {{ end -}} {{- end -}} \ No newline at end of file