File tree Expand file tree Collapse file tree 5 files changed +33
-12
lines changed
network-bootstrapper/templates Expand file tree Collapse file tree 5 files changed +33
-12
lines changed Original file line number Diff line number Diff line change @@ -77,3 +77,15 @@ Accepts either a YAML string or a list of init container maps and indents output
7777{ {- end -} }
7878{ {- end -} }
7979{ {- end -} }
80+
81+ { {/*
82+ Resolve pod and container security contexts by layering chart values over global defaults.
83+ */} }
84+ { {- define " network-bootstrapper.securityContexts" -} }
85+ { {- $root := . -} }
86+ { {- $globalValues := ($root .Values.global | default (dict)) -} }
87+ { {- $globalSecurityContexts := dig " securityContexts" $globalValues (dict) -} }
88+ { {- $pod := mergeOverwrite (deepCopy (dig " pod" $globalSecurityContexts (dict))) (default (dict) $root .Values.podSecurityContext) -} }
89+ { {- $container := mergeOverwrite (deepCopy (dig " container" $globalSecurityContexts (dict))) (default (dict) $root .Values.securityContext) -} }
90+ { {- dict " pod" $pod " container" $container | toYaml -} }
91+ { {- end -} }
Original file line number Diff line number Diff line change 2727 {{- toYaml . | nindent 8 }}
2828 {{- end }}
2929 serviceAccountName : {{ include "network-bootstrapper.serviceAccountName" . }}
30- {{- $globalValues := (.Values.global | default (dict)) }}
31- {{- $globalSecurityContexts := dig "securityContexts" $globalValues (dict) }}
32- {{- $podSecurityContext := merge (deepCopy (default (dict) .Values.podSecurityContext)) (dig "pod" $globalSecurityContexts (dict)) }}
33- {{- $containerSecurityContext := merge (deepCopy (default (dict) .Values.securityContext)) (dig "container" $globalSecurityContexts (dict)) }}
30+ {{- $securityContexts := include "network-bootstrapper.securityContexts" . | fromYaml }}
31+ {{- $podSecurityContext := index $securityContexts "pod" }}
32+ {{- $containerSecurityContext := index $securityContexts "container" }}
3433 {{- if $podSecurityContext }}
3534 securityContext :
3635 {{- toYaml $podSecurityContext | nindent 8 }}
Original file line number Diff line number Diff line change @@ -126,3 +126,15 @@ Accepts either a YAML string or a list of init container maps and indents output
126126{ {- end -} }
127127{ {- end -} }
128128{ {- end -} }
129+
130+ { {/*
131+ Resolve pod and container security contexts using global defaults plus chart overrides.
132+ */} }
133+ { {- define " nodes.securityContexts" -} }
134+ { {- $root := . -} }
135+ { {- $globalValues := ($root .Values.global | default (dict)) -} }
136+ { {- $globalSecurityContexts := dig " securityContexts" $globalValues (dict) -} }
137+ { {- $pod := mergeOverwrite (deepCopy (dig " pod" $globalSecurityContexts (dict))) (default (dict) $root .Values.podSecurityContext) -} }
138+ { {- $container := mergeOverwrite (deepCopy (dig " container" $globalSecurityContexts (dict))) (default (dict) $root .Values.securityContext) -} }
139+ { {- dict " pod" $pod " container" $container | toYaml -} }
140+ { {- end -} }
Original file line number Diff line number Diff line change 3636 {{- $initContainers := .Values.initContainers | default (dict) }}
3737 {{- $sharedInitContainers := get $initContainers "shared" }}
3838 {{- $rpcInitContainers := get $initContainers "rpc" }}
39- {{- $globalValues := (.Values.global | default (dict)) }}
40- {{- $globalSecurityContexts := dig "securityContexts" $globalValues (dict) }}
41- {{- $podSecurityContext := merge (deepCopy (default (dict) .Values.podSecurityContext)) (dig "pod" $globalSecurityContexts (dict)) }}
42- {{- $containerSecurityContext := merge (deepCopy (default (dict) .Values.securityContext)) (dig "container" $globalSecurityContexts (dict)) }}
39+ {{- $securityContexts := include "nodes.securityContexts" . | fromYaml }}
40+ {{- $podSecurityContext := index $securityContexts "pod" }}
41+ {{- $containerSecurityContext := index $securityContexts "container" }}
4342 podManagementPolicy : Parallel
4443 replicas : {{ .Values.rpcReplicaCount }}
4544 serviceName : {{ include "nodes.fullname" . }}-rpc
Original file line number Diff line number Diff line change 3737 {{- $initContainers := .Values.initContainers | default (dict) }}
3838 {{- $sharedInitContainers := get $initContainers "shared" }}
3939 {{- $validatorInitContainers := get $initContainers "validator" }}
40- {{- $globalValues := (.Values.global | default (dict)) }}
41- {{- $globalSecurityContexts := dig "securityContexts" $globalValues (dict) }}
42- {{- $podSecurityContext := merge (deepCopy (default (dict) .Values.podSecurityContext)) (dig "pod" $globalSecurityContexts (dict)) }}
43- {{- $containerSecurityContext := merge (deepCopy (default (dict) .Values.securityContext)) (dig "container" $globalSecurityContexts (dict)) }}
40+ {{- $securityContexts := include "nodes.securityContexts" . | fromYaml }}
41+ {{- $podSecurityContext := index $securityContexts "pod" }}
42+ {{- $containerSecurityContext := index $securityContexts "container" }}
4443 podManagementPolicy : Parallel
4544 replicas : {{ $validatorReplicaBudget }}
4645 serviceName : {{ include "nodes.fullname" . }}
You can’t perform that action at this time.
0 commit comments