apiVersion: v1
kind: ServiceAccount
metadata:
  name: citadel-agent
  namespace: observability
  labels:
    app.kubernetes.io/name: citadel-agent
    app.kubernetes.io/part-of: citadel
---
# ClusterRole to read pod metadata for log enrichment
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: citadel-agent
  labels:
    app.kubernetes.io/name: citadel-agent
    app.kubernetes.io/part-of: citadel
rules:
  - apiGroups: [""]
    resources: ["pods", "namespaces"]
    verbs: ["get", "list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: citadel-agent
  labels:
    app.kubernetes.io/name: citadel-agent
    app.kubernetes.io/part-of: citadel
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: citadel-agent
subjects:
  - kind: ServiceAccount
    name: citadel-agent
    namespace: observability
