_rbac.tpl 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. {{/* RBAC Spawner */}}
  2. {{/* Call this template:
  3. {{ include "ix.v1.common.spawner.rbac" $ -}}
  4. */}}
  5. {{- define "ix.v1.common.spawner.rbac" -}}
  6. {{/* Primary validation for enabled rbacs. */}}
  7. {{- include "ix.v1.common.lib.rbac.primaryValidation" $ -}}
  8. {{- range $name, $rbac := .Values.rbac -}}
  9. {{- if $rbac.enabled -}}
  10. {{/* Create a copy of the configmap */}}
  11. {{- $objectData := (mustDeepCopy $rbac) -}}
  12. {{- $objectName := include "ix.v1.common.lib.chart.names.fullname" $ -}}
  13. {{- if not $objectData.primary -}}
  14. {{- $objectName = (printf "%s-%s" (include "ix.v1.common.lib.chart.names.fullname" $) $name) -}}
  15. {{- end -}}
  16. {{/* Perform validations */}}
  17. {{- include "ix.v1.common.lib.chart.names.validation" (dict "name" $objectName) -}}
  18. {{- include "ix.v1.common.lib.metadata.validation" (dict "objectData" $objectData "caller" "RBAC") -}}
  19. {{/* Set the name of the rbac */}}
  20. {{- $_ := set $objectData "name" $objectName -}}
  21. {{- $_ := set $objectData "shortName" $name -}}
  22. {{/* If clusteWide key does not exist, assume false */}}
  23. {{- if not (hasKey $objectData "clusterWide") -}}
  24. {{- $_ := set $objectData "clusterWide" false -}}
  25. {{- end -}}
  26. {{/* Call class to create the object */}}
  27. {{- include "ix.v1.common.class.rbac" (dict "rootCtx" $ "objectData" $objectData) -}}
  28. {{- end -}}
  29. {{- end -}}
  30. {{- end -}}