---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: kea-operator
  namespace: dhcp-system
---
# Sourced from the kea-operator repo config/rbac/role.yaml (v0.1.0). Leader
# election is disabled so no coordination.k8s.io/leases grant is needed.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: kea-operator
rules:
  - apiGroups: [""]
    resources: ["configmaps", "secrets", "serviceaccounts", "services"]
    verbs: ["create", "delete", "get", "list", "patch", "update", "watch"]
  - apiGroups: [""]
    resources: ["pods"]
    verbs: ["get", "list", "watch"]
  - apiGroups: ["apps"]
    resources: ["deployments", "statefulsets"]
    verbs: ["create", "delete", "get", "list", "patch", "update", "watch"]
  - apiGroups: ["kea.unkin.net"]
    resources: ["keaapis", "keaclientclasses", "keaclusters", "keasubnets"]
    verbs: ["create", "delete", "get", "list", "patch", "update", "watch"]
  - apiGroups: ["kea.unkin.net"]
    resources:
      ["keaapis/status", "keaclientclasses/status", "keaclusters/status", "keasubnets/status"]
    verbs: ["get", "patch", "update"]
  - apiGroups: ["rbac.authorization.k8s.io"]
    resources: ["rolebindings", "roles"]
    verbs: ["create", "delete", "get", "list", "patch", "update", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: kea-operator
subjects:
  - kind: ServiceAccount
    name: kea-operator
    namespace: dhcp-system
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: kea-operator
