Command Discovery Permissions

The Admin Service uses Custom Resource Definitions (CRDs) to discover executable commands. Permissions are required to use these resources across all namespaces in the cluster.

The Helm chart adds the following permissions to the Admin Service service account:

rules:
  - apiGroups:
    - ""
    resources:
    - events
    verbs:
    - create
    - patch
  - apiGroups:
    - matrixx.matrixx.com
    resources:
    - admincommanddiscoveryendpoints
    verbs:
    - create
    - delete
    - get
    - list
    - patch
    - update
    - watch
  - apiGroups:
    - matrixx.matrixx.com
    resources:
    - admincommanddiscoveryendpoints/finalizers
    verbs:
    - update
  - apiGroups:
    - matrixx.matrixx.com
    resources:
    - admincommanddiscoveryendpoints/status
    verbs:
    - get
    - patch
    - update
  - apiGroups:
    - matrixx.matrixx.com
    resources:
    - admincommands
    verbs:
    - create
    - delete
    - get
    - list
    - patch
    - update
    - watch
  - apiGroups:
    - matrixx.matrixx.com
    resources:
    - admincommands/finalizers
    verbs:
    - update
  - apiGroups:
    - matrixx.matrixx.com
    resources:
    - admincommands/status
    verbs:
    - get
    - patch
    - update

Discovery must be performed by one instance of the Admin Service at a time. The Admin Service elects a leader that takes responsibility for this task. Leader election is implemented using a Kubernetes lease, which the Admin Service requires permission to create and view. This is only required within the deployment namespace.

The Helm chart adds the following leader election permissions to the service account used by the Admin Service:

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