operator-cluster-role-binding.yaml 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. {{- if and .Values.deploy.operator .Values.serviceAccount.create }}
  2. {{- $allowedNamespaces := regexSplit " " (include "allowedNamespaces" .) -1 }}
  3. {{- range $index, $namespace := $allowedNamespaces }}
  4. {{- if and (eq $index 0) (not $.Values.disableClusterRole) }}
  5. ---
  6. apiVersion: rbac.authorization.k8s.io/v1
  7. kind: ClusterRoleBinding
  8. metadata:
  9. name: {{ $.Release.Name }}
  10. {{- with $.Values.clusterOwnerRefereces }}
  11. ownerReferences:
  12. {{- toYaml . | nindent 4 }}
  13. {{- end }}
  14. subjects:
  15. - kind: ServiceAccount
  16. name: {{ $.Release.Name }}
  17. namespace: {{ $.Release.Namespace }}
  18. roleRef:
  19. kind: ClusterRole
  20. name: {{ $.Release.Name }}
  21. apiGroup: rbac.authorization.k8s.io
  22. {{- end }}
  23. {{- if not (eq $namespace "_all_namespaces_placeholder") }}
  24. ---
  25. apiVersion: rbac.authorization.k8s.io/v1
  26. kind: RoleBinding
  27. metadata:
  28. namespace: {{ $namespace }}
  29. name: {{ $.Release.Name }}
  30. subjects:
  31. - kind: ServiceAccount
  32. name: {{ $.Release.Name }}
  33. namespace: {{ $.Release.Namespace }}
  34. roleRef:
  35. kind: Role
  36. name: {{ $.Release.Name }}
  37. apiGroup: rbac.authorization.k8s.io
  38. {{- end }}
  39. {{- end }}
  40. {{- end }}