From 2ec552d6fdb52bac9470fd763c748cb963a9fba0 Mon Sep 17 00:00:00 2001 From: unkin-agent Date: Sun, 27 Sep 2026 11:23:36 +1000 Subject: [PATCH] Add agent-observability kubernetes creds role and policy (#156) No agent Vault role covers the VictoriaMetrics/VictoriaLogs stack, so a scoped Kubernetes token cannot be issued for it and writes there fall back to an admin context. - add the agent-observability kubernetes secret backend role, allowed in vm-system, observability and logging - add its generated role rules: read plus patch/update on VictoriaMetrics CRs and workloads, pod delete for rolling restarts, read-only on services, configmaps, endpoints, events and Gateway API routes - add a policy granting update on kubernetes/au/syd1/creds/agent-observability to the cluster_operator LDAP group and the agents approle Reviewed-on: https://git.unkin.net/unkin/terraform-vault/pulls/156 Co-authored-by: unkin-agent Co-committed-by: unkin-agent --- .../au/syd1/agent-observability.yaml | 6 ++ .../au/syd1/creds/agent-observability.yaml | 12 ++++ .../au/syd1/roles/agent-observability.yaml | 62 +++++++++++++++++++ 3 files changed, 80 insertions(+) create mode 100644 config/kubernetes_secret_backend_role/kubernetes/au/syd1/agent-observability.yaml create mode 100644 policies/kubernetes/au/syd1/creds/agent-observability.yaml create mode 100644 resources/secret_backend/kubernetes/au/syd1/roles/agent-observability.yaml diff --git a/config/kubernetes_secret_backend_role/kubernetes/au/syd1/agent-observability.yaml b/config/kubernetes_secret_backend_role/kubernetes/au/syd1/agent-observability.yaml new file mode 100644 index 0000000..2451cca --- /dev/null +++ b/config/kubernetes_secret_backend_role/kubernetes/au/syd1/agent-observability.yaml @@ -0,0 +1,6 @@ +allowed_kubernetes_namespaces: + - "vm-system" + - "observability" + - "logging" +kubernetes_role_type: "Role" +extra_labels: {} diff --git a/policies/kubernetes/au/syd1/creds/agent-observability.yaml b/policies/kubernetes/au/syd1/creds/agent-observability.yaml new file mode 100644 index 0000000..b5ff35a --- /dev/null +++ b/policies/kubernetes/au/syd1/creds/agent-observability.yaml @@ -0,0 +1,12 @@ +# Allow access to agent-observability Kubernetes credentials +--- +rules: + - path: "kubernetes/au/syd1/creds/agent-observability" + capabilities: + - update + +auth: + ldap: + - kubernetes_au_syd1_cluster_operator + approle: + - agents diff --git a/resources/secret_backend/kubernetes/au/syd1/roles/agent-observability.yaml b/resources/secret_backend/kubernetes/au/syd1/roles/agent-observability.yaml new file mode 100644 index 0000000..0ae5174 --- /dev/null +++ b/resources/secret_backend/kubernetes/au/syd1/roles/agent-observability.yaml @@ -0,0 +1,62 @@ +--- +rules: + # Verbs are listed explicitly rather than "*": delete on a VLCluster reclaims + # its cephrbd-fast-delete PVCs, destroying the log store. + - apiGroups: + - "operator.victoriametrics.com" + resources: + - "*" + verbs: + - "get" + - "list" + - "watch" + - "create" + - "patch" + - "update" + - apiGroups: + - "apps" + resources: + - "deployments" + - "statefulsets" + - "daemonsets" + verbs: + - "get" + - "list" + - "watch" + - "patch" + - "update" + - apiGroups: + - "" + resources: + - "pods" + verbs: + - "get" + - "list" + - "watch" + - "delete" + - apiGroups: + - "" + resources: + - "pods/log" + verbs: + - "get" + - apiGroups: + - "" + resources: + - "services" + - "configmaps" + - "endpoints" + - "events" + verbs: + - "get" + - "list" + - "watch" + - apiGroups: + - "gateway.networking.k8s.io" + resources: + - "gateways" + - "httproutes" + verbs: + - "get" + - "list" + - "watch"