{{ if .Values.rbac.create }}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: sealed-secrets-key-admin
  labels:
    app.kubernetes.io/name: {{ template "sealed-secrets.name" . }}
    helm.sh/chart: {{ template "sealed-secrets.chart" . }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/version: {{ .Chart.AppVersion }}
rules:
  - apiGroups:
      - ""
    resourceNames:
      - {{ .Values.secretName }}
    resources:
      - secrets
    verbs:
      - get
  - apiGroups:
      - ""
    resources:
      - secrets
    verbs:
      - create
{{ end }}
