🔒 Add read-only cluster observer identity for Copilot and health checks
This commit is contained in:
parent
a12dcc3628
commit
b11536fcfc
70
infra/k8s/cluster-observer.yaml
Normal file
70
infra/k8s/cluster-observer.yaml
Normal file
@ -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
|
||||
Loading…
x
Reference in New Issue
Block a user