use tpl less times and fix assignments

This commit is contained in:
Stavros kois
2023-01-25 17:25:49 +02:00
parent d3084b0113
commit d41ef97e2e
4 changed files with 11 additions and 9 deletions
@@ -4,6 +4,8 @@
{{- $rbacValues := .rbac -}}
{{- $root := .root -}}
{{- $rbacValues = fromYaml (tpl ($rbacValues | toYaml) $root) -}}
{{- $saName := include "ix.v1.common.names.serviceAccountName" $root -}}
{{- $rbacName := include "ix.v1.common.names.rbac" (dict "root" $root "rbacValues" $rbacValues) -}}
@@ -62,16 +64,16 @@ rules:
{{- if eq . "" }}
- ""
{{- else }}
- {{ tpl . $root | quote }}
- {{ . | quote }}
{{- end }}
{{- end }}
resources:
{{- range .resources }}
- {{ tpl . $root | quote }}
- {{ . | quote }}
{{- end }}
verbs:
{{- range .verbs }}
- {{ tpl . $root | quote }}
- {{ . | quote }}
{{- end }}
{{- end }}
{{- end }}
@@ -104,9 +106,9 @@ subjects:
namespace: {{ $root.Release.Namespace }}
{{- with $rbacValues.subjects -}}
{{- range . }}
- kind: {{ tpl (required "<kind> cannot be empty in RBAC subjects." .kind) $root | quote }}
name: {{ tpl (required "<name> cannot be empty in RBAC subjects." .name) $root | quote }}
apiGroup: {{ tpl (required "<apiGroup> cannot be empty in RBAC subjects." .apiGroup) $root | quote }}
- kind: {{ required "<kind> cannot be empty in RBAC subjects." .kind | quote }}
name: {{ required "<name> cannot be empty in RBAC subjects." .name | quote }}
apiGroup: {{ required "<apiGroup> cannot be empty in RBAC subjects." .apiGroup | quote }}
{{- end }}
{{- end -}}
{{- end -}}
+1 -1
View File
@@ -7,7 +7,7 @@
{{- $containerName := .containerName -}}
{{- if $envs -}}
{{- $envs := fromYaml (tpl ($envs | toYaml) $root) -}}
{{- $envs = fromYaml (tpl ($envs | toYaml) $root) -}}
{{- end -}}
{{- $dupeCheck := dict -}}
@@ -7,7 +7,7 @@
{{- $root := .root -}}
{{- if $envList -}}
{{- $envList := fromYaml (tpl ($envList | toYaml) $root) -}}
{{- $envList = fromYaml (tpl ($envList | toYaml) $root) -}}
{{- end -}}
{{- $dupeCheck := dict -}}
@@ -4,7 +4,7 @@
{{- $values := .values -}}
{{- $inherit := "inherit" -}}
{{- $values := fromYaml (tpl ($values | toYaml) $root) -}}
{{- $values = fromYaml (tpl ($values | toYaml) $root) -}}
{{/* Prepare values */}}
{{- $saName := "" -}}