apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: appconfig-leader-election-role
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: appconfig-leader-election-rolebinding
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: appconfig-leader-election-role
subjects:
- kind: ServiceAccount
  name: {{ include "az-appconfig-k8s-provider.serviceAccountName" . }}
  namespace: {{ .Release.Namespace }}