mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-04 00:47:04 +02:00
Co-authored-by: lab-assistant[bot] <180935599+lab-assistant[bot]@users.noreply.github.com>
41 lines
1.9 KiB
Smarty
41 lines
1.9 KiB
Smarty
{{/*
|
|
Renders RBAC objects required by the chart.
|
|
*/}}
|
|
{{- define "bjw-s.common.render.rbac" -}}
|
|
{{- $rootContext := . -}}
|
|
{{- include "bjw-s.common.render.rbac.roles" (dict "rootContext" $rootContext) -}}
|
|
{{- include "bjw-s.common.render.rbac.roleBindings" (dict "rootContext" $rootContext) -}}
|
|
{{ end }}
|
|
|
|
{{/*
|
|
Renders RBAC Role objects required by the chart.
|
|
*/}}
|
|
{{- define "bjw-s.common.render.rbac.roles" -}}
|
|
{{- $rootContext := .rootContext -}}
|
|
{{- $enabledRoles := (include "bjw-s.common.lib.rbac.role.enabledRoles" (dict "rootContext" $rootContext) | fromYaml ) -}}
|
|
{{- range $identifier := keys $enabledRoles -}}
|
|
{{- /* Generate object from the raw role values */ -}}
|
|
{{- $roleObject := (include "bjw-s.common.lib.rbac.role.getByIdentifier" (dict "rootContext" $rootContext "id" $identifier) | fromYaml) -}}
|
|
|
|
{{- /* Perform validations on the role before rendering */ -}}
|
|
{{- include "bjw-s.common.lib.rbac.role.validate" (dict "rootContext" $rootContext "object" $roleObject) -}}
|
|
|
|
{{/* Include the role class */}}
|
|
{{- include "bjw-s.common.class.rbac.Role" (dict "rootContext" $rootContext "object" $roleObject) | nindent 0 -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Renders RBAC RoleBinding objects required by the chart.
|
|
*/}}
|
|
{{- define "bjw-s.common.render.rbac.roleBindings" -}}
|
|
{{- $rootContext := .rootContext -}}
|
|
{{- $enabledRoleBindings := (include "bjw-s.common.lib.rbac.roleBinding.enabledRoleBindings" (dict "rootContext" $rootContext) | fromYaml ) -}}
|
|
{{- range $identifier := keys $enabledRoleBindings -}}
|
|
{{- /* Generate object from the raw role values */ -}}
|
|
{{- $roleBindingObject := (include "bjw-s.common.lib.rbac.roleBinding.getByIdentifier" (dict "rootContext" $rootContext "id" $identifier) | fromYaml) -}}
|
|
|
|
{{/* Include the RoleBinding class */}}
|
|
{{- include "bjw-s.common.class.rbac.roleBinding" (dict "rootContext" $rootContext "object" $roleBindingObject) | nindent 0 -}}
|
|
{{- end -}}
|
|
{{- end -}}
|