jenkins f4d8b2c01d feat(hermes-triage-demo): least-privilege ConfigMap patch for in-process repair
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-05 22:25:52 -03:00

118 lines
3.1 KiB
YAML

# services/hermes-triage-demo/rbac.yaml
# Two scoped grants:
# 1. Jenkins agent pods (SA jenkins/jenkins) create and observe the demo
# test-runner Job and manage the fixture ConfigMap (ensure + seed).
# 2. The Ariadne-created repair Job runs as SA hermes-demo-repair, which can
# patch only the fixture ConfigMap back to healthy.
# The Ariadne repair path needs no Job-create grant here: its
# ariadne-job-spawner ClusterRole already covers Job create/watch.
apiVersion: v1
kind: ServiceAccount
metadata:
name: hermes-demo-repair
namespace: hermes-triage-demo
labels:
app.kubernetes.io/part-of: hermes-triage-demo
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: demo-test-runner
namespace: hermes-triage-demo
labels:
app.kubernetes.io/part-of: hermes-triage-demo
rules:
- apiGroups: ["batch"]
resources: ["jobs"]
verbs: ["create", "get", "list", "watch"]
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["pods/log"]
verbs: ["get"]
- apiGroups: [""]
resources: ["configmaps"]
verbs: ["create"]
- apiGroups: [""]
resources: ["configmaps"]
resourceNames: ["hermes-triage-demo-fixture"]
verbs: ["get", "patch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: demo-test-runner-jenkins
namespace: hermes-triage-demo
labels:
app.kubernetes.io/part-of: hermes-triage-demo
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: demo-test-runner
subjects:
- kind: ServiceAccount
name: jenkins
namespace: jenkins
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: demo-repair
namespace: hermes-triage-demo
labels:
app.kubernetes.io/part-of: hermes-triage-demo
rules:
- apiGroups: [""]
resources: ["configmaps"]
resourceNames: ["hermes-triage-demo-fixture"]
verbs: ["get", "patch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: demo-repair
namespace: hermes-triage-demo
labels:
app.kubernetes.io/part-of: hermes-triage-demo
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: demo-repair
subjects:
- kind: ServiceAccount
name: hermes-demo-repair
namespace: hermes-triage-demo
---
# The fixture repair runs in-process inside Ariadne rather than as a spawned
# Kubernetes Job, so Ariadne's own service account needs to patch exactly one
# ConfigMap in this namespace — nothing else.
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: ariadne-fixture-repair
namespace: hermes-triage-demo
labels:
app.kubernetes.io/part-of: hermes-triage-demo
rules:
- apiGroups: [""]
resources: ["configmaps"]
resourceNames: ["hermes-triage-demo-fixture"]
verbs: ["get", "patch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: ariadne-fixture-repair
namespace: hermes-triage-demo
labels:
app.kubernetes.io/part-of: hermes-triage-demo
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: ariadne-fixture-repair
subjects:
- kind: ServiceAccount
name: ariadne
namespace: maintenance