From b11536fcfcba0219aa4c169ed63d2829e86dfc57 Mon Sep 17 00:00:00 2001 From: wishforge Date: Sun, 8 Nov 2026 20:30:29 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=92=20Add=20read-only=20cluster=20obse?= =?UTF-8?q?rver=20identity=20for=20Copilot=20and=20health=20checks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- infra/k8s/cluster-observer.yaml | 70 +++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 infra/k8s/cluster-observer.yaml diff --git a/infra/k8s/cluster-observer.yaml b/infra/k8s/cluster-observer.yaml new file mode 100644 index 0000000..4b4f93a --- /dev/null +++ b/infra/k8s/cluster-observer.yaml @@ -0,0 +1,70 @@ +# Read-only cluster observer for WishForge's Copilot and health checks. +# +# Purpose: let the platform read cluster state (resource accounting, service inventory, live +# alerts) without any ability to change it. The identity can list and watch workloads, events, +# persistent storage, quotas and metrics in every namespace, and read Pod logs for triage. +# +# Deliberately excluded: Secrets and ConfigMaps (they hold credentials and connection strings), +# pods/exec and pods/portforward (they are command execution paths), and every write verb. The +# only verbs granted are get, list and watch. +# +# Apply with an administrator kubeconfig: +# kubectl apply -f infra/k8s/cluster-observer.yaml +# The long-lived token lives in Secret wishforge-observer-token; deleting that Secret revokes it. +apiVersion: v1 +kind: ServiceAccount +metadata: + name: wishforge-observer + namespace: droboticflow-fanyu + labels: { app.kubernetes.io/part-of: wishforge, app.kubernetes.io/component: cluster-observer } +automountServiceAccountToken: false +--- +# Long-lived token for the read-only kubeconfig that WishForge keeps outside the repository. +apiVersion: v1 +kind: Secret +type: kubernetes.io/service-account-token +metadata: + name: wishforge-observer-token + namespace: droboticflow-fanyu + labels: { app.kubernetes.io/part-of: wishforge, app.kubernetes.io/component: cluster-observer } + annotations: { kubernetes.io/service-account.name: wishforge-observer } +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: wishforge-observer + labels: { app.kubernetes.io/part-of: wishforge, app.kubernetes.io/component: cluster-observer } +rules: + - apiGroups: [''] + resources: [nodes, namespaces, persistentvolumes] + verbs: [get, list, watch] + - apiGroups: [''] + resources: + [pods, pods/log, events, services, persistentvolumeclaims, resourcequotas, limitranges] + verbs: [get, list, watch] + - apiGroups: [apps] + resources: [deployments, statefulsets, replicasets, daemonsets] + verbs: [get, list, watch] + - apiGroups: [batch] + resources: [jobs, cronjobs] + verbs: [get, list, watch] + - apiGroups: [storage.k8s.io] + resources: [storageclasses] + verbs: [get, list, watch] + - apiGroups: [metrics.k8s.io] + resources: [nodes, pods] + verbs: [get, list, watch] +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: wishforge-observer + labels: { app.kubernetes.io/part-of: wishforge, app.kubernetes.io/component: cluster-observer } +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: wishforge-observer +subjects: + - kind: ServiceAccount + name: wishforge-observer + namespace: droboticflow-fanyu