9249f151a8
kubectl get namespace is cluster-scoped and requires a ClusterRole. The runner SA only had a namespaced Role, causing E2E to fail with Forbidden even when the namespace existed. Adds a minimal ClusterRole restricted to get on headlamp-e2e only. Co-Authored-By: Paperclip <noreply@paperclip.ing>
74 lines
2.3 KiB
YAML
74 lines
2.3 KiB
YAML
---
|
|
# RBAC for the GitHub Actions CI runner to manage the E2E Headlamp instance.
|
|
# CI-only test fixture — NOT for production use.
|
|
#
|
|
# Grants the ARC runner service account permissions in the headlamp-e2e
|
|
# namespace to deploy and tear down a dedicated Headlamp instance via Helm.
|
|
#
|
|
# No kube-system access needed — E2E tests use a separate namespace.
|
|
# Plugin is loaded via ConfigMap volume mount — no custom Docker images.
|
|
#
|
|
# Prerequisites:
|
|
# kubectl create namespace headlamp-e2e
|
|
# kubectl apply -f deployment/e2e-ci-runner-rbac.yaml
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: Role
|
|
metadata:
|
|
name: e2e-ci-runner
|
|
namespace: headlamp-e2e
|
|
rules:
|
|
# Helm needs to manage these resources for the Headlamp chart
|
|
- apiGroups: ["apps"]
|
|
resources: ["deployments"]
|
|
verbs: ["get", "list", "create", "update", "patch", "delete", "watch"]
|
|
- apiGroups: [""]
|
|
resources: ["services", "serviceaccounts", "configmaps", "secrets"]
|
|
verbs: ["get", "list", "create", "update", "patch", "delete"]
|
|
- apiGroups: [""]
|
|
resources: ["pods"]
|
|
verbs: ["get", "list", "watch"]
|
|
# Token creation for E2E test auth
|
|
- apiGroups: [""]
|
|
resources: ["serviceaccounts/token"]
|
|
verbs: ["create"]
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: RoleBinding
|
|
metadata:
|
|
name: e2e-ci-runner-binding
|
|
namespace: headlamp-e2e
|
|
subjects:
|
|
- kind: ServiceAccount
|
|
name: runners-privilegedescalation-gha-rs-no-permission
|
|
namespace: arc-runners
|
|
roleRef:
|
|
kind: Role
|
|
name: e2e-ci-runner
|
|
apiGroup: rbac.authorization.k8s.io
|
|
---
|
|
# ClusterRole to allow the runner SA to verify the headlamp-e2e namespace
|
|
# exists before attempting namespaced operations. kubectl get namespace is a
|
|
# cluster-scoped operation not coverable by a namespaced Role.
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: ClusterRole
|
|
metadata:
|
|
name: e2e-ci-namespace-reader
|
|
rules:
|
|
- apiGroups: [""]
|
|
resources: ["namespaces"]
|
|
verbs: ["get"]
|
|
resourceNames: ["headlamp-e2e"]
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: ClusterRoleBinding
|
|
metadata:
|
|
name: e2e-ci-namespace-reader-binding
|
|
subjects:
|
|
- kind: ServiceAccount
|
|
name: runners-privilegedescalation-gha-rs-no-permission
|
|
namespace: arc-runners
|
|
roleRef:
|
|
kind: ClusterRole
|
|
name: e2e-ci-namespace-reader
|
|
apiGroup: rbac.authorization.k8s.io
|