apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: certificate-operator-leader-election-role
  namespace: {{ .Release.Namespace | quote }}
  {{- $annotations := include "common.annotations" (dict "context" .) }}
  {{- with $annotations }}
  annotations: {{- . -}}
  {{- end }}
  labels:
{{- include "common.labels.standard" ( dict "context" . ) | nindent 4 }}
rules:
- apiGroups:
  - ""
  resources:
  - configmaps
  verbs:
  - get
  - list
  - watch
  - create
  - update
  - patch
  - delete
- apiGroups:
  - coordination.k8s.io
  resources:
  - leases
  verbs:
  - get
  - list
  - watch
  - create
  - update
  - patch
  - delete
- apiGroups:
  - ""
  resources:
  - events
  verbs:
  - create
  - patch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: certificate-operator-leader-election-rolebinding
  namespace: {{ .Release.Namespace | quote }}
  {{- $annotations := include "common.annotations" (dict "context" .) }}
  {{- with $annotations }}
  annotations: {{- . }}
  {{- end }}
  labels:
    app.kubernetes.io/component: rbac
    app.kubernetes.io/created-by: certificate-operator
    app.kubernetes.io/part-of: keptn
    {{- include "common.labels.standard" (dict "context" .) | nindent 4 }}
    {{- include "common.annotations" ( dict "context" . ) }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: 'certificate-operator-leader-election-role'
subjects:
  - kind: ServiceAccount
    name: 'certificate-operator'
    namespace: '{{ .Release.Namespace }}'
