mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-07 09:57:41 +02:00
feat(common): Release v4.1.2 (#430)
Signed-off-by: Dan Manners <daniel.a.manners@gmail.com> Co-authored-by: Daniel Manners <daniel.a.manners@gmail.com>
This commit is contained in:
parent
de383dc580
commit
42354af45b
69 changed files with 1431 additions and 668 deletions
|
@ -0,0 +1,32 @@
|
|||
{{/*
|
||||
Validate RoleBinding values
|
||||
*/}}
|
||||
{{- define "bjw-s.common.lib.rbac.rolebinding.validate" -}}
|
||||
{{- $rootContext := .rootContext -}}
|
||||
{{- $roleBindingValues := .object -}}
|
||||
{{- $rules := $roleBindingValues.rules -}}
|
||||
|
||||
{{/* Verify permutations for RoleBinding subjects */}}
|
||||
{{- if and (not (empty $roleBindingValues.subjects)) (not (empty $roleBindingValues.roleRef)) -}}
|
||||
{{- $subjectTypes := list "User" "Group" "ServiceAccount" -}}
|
||||
{{- $subjectTypeCount := 0 -}}
|
||||
{{- range $roleBindingValues.subjects -}}
|
||||
{{- if hasKey . "kind" -}}
|
||||
{{- if dict $subjectTypes has .kind -}}
|
||||
{{- $subjectTypeCount = add $subjectTypeCount 1 -}}
|
||||
{{- else -}}
|
||||
{{- fail (printf "Invalid subject kind '%s' in RoleBinding '%s'. Valid kinds are: %s" .kind $roleBindingValues.identifier (join ", " $subjectTypes)) -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- fail (printf "Subject kind is required in RoleBinding '%s'" $roleBindingValues.identifier) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if eq $subjectTypeCount 0 -}}
|
||||
{{- fail (printf "At least one subject with a valid kind is required in RoleBinding '%s'" $roleBindingValues.identifier) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- else -}}
|
||||
{{- fail (printf "subjects and roleRef are required for RoleBinding with key \"%v\"" $roleBindingValues.identifier) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
Loading…
Add table
Add a link
Reference in a new issue