# services/comms/mas-db-ensure-rbac.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  name: mas-db-ensure
  namespace: comms
imagePullSecrets:
  - name: harbor-regcred
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: mas-db-ensure
rules:
  - apiGroups: [""]
    resources: ["secrets"]
    resourceNames: ["mas-db"]
    verbs: ["get", "patch", "update"]
  - apiGroups: [""]
    resources: ["secrets"]
    verbs: ["create"]
  - apiGroups: [""]
    resources: ["pods"]
    verbs: ["get", "list"]
  - apiGroups: [""]
    resources: ["pods/exec"]
    verbs: ["create"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: mas-db-ensure
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: mas-db-ensure
subjects:
  - kind: ServiceAccount
    name: mas-db-ensure
    namespace: comms
