role.yaml 1.1 KB

12345678910111213141516171819202122232425262728
  1. {{- if .Values.rbac.create }}
  2. apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
  3. kind: Role
  4. metadata:
  5. name: {{ template "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. rules:
  15. {{- $pspAvailable := (semverCompare "<1.25-0" (include "common.capabilities.kubeVersion" .)) -}}
  16. {{- if and $pspAvailable .Values.podSecurityPolicy.enabled }}
  17. - apiGroups:
  18. - '{{ template "podSecurityPolicy.apiGroup" . }}'
  19. resources:
  20. - 'podsecuritypolicies'
  21. verbs:
  22. - 'use'
  23. resourceNames: [{{ printf "%s-master" (include "common.names.fullname" .) }}]
  24. {{- end }}
  25. {{- if .Values.rbac.rules }}
  26. {{- include "common.tplvalues.render" ( dict "value" .Values.rbac.rules "context" $ ) | nindent 2 }}
  27. {{- end }}
  28. {{- end }}