{{- if .Values.rbac.create }}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: {{ include "trivy.fullname" . }}
  labels:
{{ include "trivy.labels" . | indent 4 }}
  namespace: {{ .Release.Namespace }}
{{- if .Values.rbac.pspEnabled }}
rules:
- apiGroups:      ['policy']
  resources:      ['podsecuritypolicies']
  verbs:          ['use']
  resourceNames:  [{{ include "trivy.fullname" . }}]
{{- end }}
{{- end }}