---
# Static service account that Vault's kubernetes secret engine mints scoped
# tokens for (agent-dns role). RBAC is confined to the bind namespaces via the
# per-namespace RoleBindings below, not a ClusterRoleBinding.
apiVersion: v1
kind: ServiceAccount
metadata:
  name: agent-dns
  namespace: bind-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: agent-dns
rules:
  - apiGroups: ["bind.unkin.net"]
    resources: ["*"]
    verbs: ["*"]
  - apiGroups: [""]
    resources: ["pods", "services", "configmaps", "events"]
    verbs: ["get", "list", "watch"]
  - apiGroups: [""]
    resources: ["pods/log"]
    verbs: ["get"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: agent-dns
  namespace: bind-system
subjects:
  - kind: ServiceAccount
    name: agent-dns
    namespace: bind-system
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: agent-dns
