role.yaml 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. {{- if .Values.rbac.create }}
  2. kind: Role
  3. apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
  4. metadata:
  5. name: {{ include "common.names.fullname" . }}
  6. namespace: {{ .Release.Namespace | quote }}
  7. labels: {{- include "common.labels.standard" . | nindent 4 }}
  8. {{- if .Values.commonLabels }}
  9. {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
  10. {{- end }}
  11. {{- if .Values.commonAnnotations }}
  12. annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
  13. {{- end }}
  14. # yamllint disable rule:indentation
  15. rules:
  16. {{- $pspAvailable := (semverCompare "<1.25-0" (include "common.capabilities.kubeVersion" .)) -}}
  17. {{- if and $pspAvailable .Values.psp.create }}
  18. - apiGroups:
  19. - 'policy'
  20. resources:
  21. - 'podsecuritypolicies'
  22. verbs:
  23. - 'use'
  24. resourceNames:
  25. - {{ include "common.names.fullname" . }}
  26. {{- end }}
  27. {{- if .Values.rbac.rules }}
  28. {{- include "common.tplvalues.render" ( dict "value" .Values.rbac.rules "context" $ ) | nindent 2 }}
  29. {{- end }}
  30. # yamllint enable rule:indentation
  31. {{- end }}