From c8242599f9b29db51bad1839b3281d75b68b2e14 Mon Sep 17 00:00:00 2001 From: Chris Farhood Date: Mon, 4 May 2026 19:28:36 +0000 Subject: [PATCH 01/10] Add RBAC manifest for E2E CI runner Adds deployment/e2e-ci-runner-rbac.yaml which grants the Arc Runners service account the minimum permissions needed to deploy/teardown an E2E Headlamp instance in privilegedescalation-dev. Fixes PRI-550. Co-Authored-By: Paperclip --- deployment/e2e-ci-runner-rbac.yaml | 40 ++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 deployment/e2e-ci-runner-rbac.yaml diff --git a/deployment/e2e-ci-runner-rbac.yaml b/deployment/e2e-ci-runner-rbac.yaml new file mode 100644 index 0000000..89fd595 --- /dev/null +++ b/deployment/e2e-ci-runner-rbac.yaml @@ -0,0 +1,40 @@ +--- +# e2e-ci-runner-rbac.yaml +# +# Grants the GitHub Actions runner's service account (Arc Runners) the minimum +# permissions needed to deploy/teardown an E2E Headlamp instance in the +# privilegedescalation-dev namespace. +# +# Applied automatically by the E2E workflow before deploy-e2e-headlamp.sh runs. +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: e2e-ci-runner + namespace: privilegedescalation-dev +rules: + - apiGroups: [""] + resources: ["configmaps", "serviceaccounts", "events"] + verbs: ["get", "list", "create", "delete"] + - apiGroups: ["apps"] + resources: ["deployments"] + verbs: ["get", "create", "delete"] + - apiGroups: [""] + resources: ["services"] + verbs: ["get", "create", "delete"] + - apiGroups: [""] + resources: ["pods"] + verbs: ["get", "list"] +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: e2e-ci-runner + namespace: privilegedescalation-dev +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 \ No newline at end of file -- 2.52.0 From 7bc5b1324bf1085e3824ef25185fffd86e844303 Mon Sep 17 00:00:00 2001 From: Chris Farhood Date: Mon, 4 May 2026 19:39:12 +0000 Subject: [PATCH 02/10] fix: add RBAC apply step to E2E workflow (PRI-550) Adds 'kubectl apply -f deployment/e2e-ci-runner-rbac.yaml' step to the E2E workflow before the deploy script runs. Co-Authored-By: Paperclip --- .github/workflows/e2e.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 49ab07f..fad444c 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -51,6 +51,9 @@ jobs: - name: Build plugin run: npx @kinvolk/headlamp-plugin build + - name: Apply RBAC for E2E runner + run: kubectl apply -f deployment/e2e-ci-runner-rbac.yaml + - name: Deploy E2E Headlamp instance run: scripts/deploy-e2e-headlamp.sh -- 2.52.0 From c1ad0063ccafe0a85f65cc5adcee77f2ca2fc6e2 Mon Sep 17 00:00:00 2001 From: Chris Farhood Date: Mon, 4 May 2026 19:40:05 +0000 Subject: [PATCH 03/10] fix: add roles/rolebindings permissions to RBAC manifest (PRI-550) kubectl apply requires get/list/watch on roles/rolebindings to check existing state before patching. Without these, apply fails with Forbidden on the GET call itself. Co-Authored-By: Paperclip --- deployment/e2e-ci-runner-rbac.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/deployment/e2e-ci-runner-rbac.yaml b/deployment/e2e-ci-runner-rbac.yaml index 89fd595..3b252eb 100644 --- a/deployment/e2e-ci-runner-rbac.yaml +++ b/deployment/e2e-ci-runner-rbac.yaml @@ -12,6 +12,9 @@ metadata: name: e2e-ci-runner namespace: privilegedescalation-dev rules: + - apiGroups: ["rbac.authorization.k8s.io"] + resources: ["roles", "rolebindings"] + verbs: ["get", "list", "watch", "create", "delete"] - apiGroups: [""] resources: ["configmaps", "serviceaccounts", "events"] verbs: ["get", "list", "create", "delete"] -- 2.52.0 From ff5ef7f57b2e4187b13bc12e87040f338582e183 Mon Sep 17 00:00:00 2001 From: Chris Farhood Date: Tue, 5 May 2026 00:26:32 +0000 Subject: [PATCH 04/10] chore: re-trigger E2E with updated infra RBAC (infra fix applied) -- 2.52.0 From c43e006c643c2d371af70d03daeecb3a9e467d45 Mon Sep 17 00:00:00 2001 From: Chris Farhood Date: Tue, 5 May 2026 00:35:38 +0000 Subject: [PATCH 05/10] fix: remove create/delete on roles/rolebindings per QA review Removes privilege-escalation permissions from RBAC manifest per PRI-554 QA review. The rbac.authorization.k8s.io rule now grants only get/list/watch on rolebindings (needed for deploy script to verify existing bindings exist). Co-Authored-By: Paperclip --- deployment/e2e-ci-runner-rbac.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/deployment/e2e-ci-runner-rbac.yaml b/deployment/e2e-ci-runner-rbac.yaml index 3b252eb..80f4638 100644 --- a/deployment/e2e-ci-runner-rbac.yaml +++ b/deployment/e2e-ci-runner-rbac.yaml @@ -13,8 +13,8 @@ metadata: namespace: privilegedescalation-dev rules: - apiGroups: ["rbac.authorization.k8s.io"] - resources: ["roles", "rolebindings"] - verbs: ["get", "list", "watch", "create", "delete"] + resources: ["rolebindings"] + verbs: ["get", "list", "watch"] - apiGroups: [""] resources: ["configmaps", "serviceaccounts", "events"] verbs: ["get", "list", "create", "delete"] @@ -40,4 +40,4 @@ subjects: roleRef: kind: Role name: e2e-ci-runner - apiGroup: rbac.authorization.k8s.io \ No newline at end of file + apiGroup: rbac.authorization.k8s.io -- 2.52.0 From 105f6cfd6b5c0a54da16b55222c7bf33739fec6b Mon Sep 17 00:00:00 2001 From: Chris Farhood Date: Tue, 5 May 2026 00:50:35 +0000 Subject: [PATCH 06/10] Fix RBAC manifest per QA review (PRI-554) - Remove rbac.authorization.k8s.io rule (create/delete on rolebindings was privilege escalation; no RBAC self-management needed) - Remove self-applying kubectl apply step from e2e workflow (runner cannot grant its own permissions; RBAC must be pre-applied via Flux from infra repo) Reviewed-by: Hugh Hackman --- .github/workflows/e2e.yaml | 3 --- deployment/e2e-ci-runner-rbac.yaml | 3 --- 2 files changed, 6 deletions(-) diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index fad444c..49ab07f 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -51,9 +51,6 @@ jobs: - name: Build plugin run: npx @kinvolk/headlamp-plugin build - - name: Apply RBAC for E2E runner - run: kubectl apply -f deployment/e2e-ci-runner-rbac.yaml - - name: Deploy E2E Headlamp instance run: scripts/deploy-e2e-headlamp.sh diff --git a/deployment/e2e-ci-runner-rbac.yaml b/deployment/e2e-ci-runner-rbac.yaml index 80f4638..13e874b 100644 --- a/deployment/e2e-ci-runner-rbac.yaml +++ b/deployment/e2e-ci-runner-rbac.yaml @@ -12,9 +12,6 @@ metadata: name: e2e-ci-runner namespace: privilegedescalation-dev rules: - - apiGroups: ["rbac.authorization.k8s.io"] - resources: ["rolebindings"] - verbs: ["get", "list", "watch"] - apiGroups: [""] resources: ["configmaps", "serviceaccounts", "events"] verbs: ["get", "list", "create", "delete"] -- 2.52.0 From 9fbc1d569ff849eb7163f47df0182eaeaf9fbb15 Mon Sep 17 00:00:00 2001 From: Chris Farhood Date: Tue, 5 May 2026 01:09:30 +0000 Subject: [PATCH 07/10] docs: mark RBAC manifest as Flux-managed reference copy --- deployment/e2e-ci-runner-rbac.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/deployment/e2e-ci-runner-rbac.yaml b/deployment/e2e-ci-runner-rbac.yaml index 13e874b..fc47417 100644 --- a/deployment/e2e-ci-runner-rbac.yaml +++ b/deployment/e2e-ci-runner-rbac.yaml @@ -5,7 +5,9 @@ # permissions needed to deploy/teardown an E2E Headlamp instance in the # privilegedescalation-dev namespace. # -# Applied automatically by the E2E workflow before deploy-e2e-headlamp.sh runs. +# RBAC is managed via Flux from privilegedescalation/infra — do not apply manually. +# This manifest is a reference copy in the plugin repo. + apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: -- 2.52.0 From 7bccf91ac7676132b7a86c5d0bdc8d0e3e8b6dd3 Mon Sep 17 00:00:00 2001 From: Chris Farhood Date: Tue, 5 May 2026 01:47:25 +0000 Subject: [PATCH 08/10] Replace privilegedescalation-dev with headlamp-dev namespace Co-Authored-By: Paperclip --- deployment/e2e-ci-runner-rbac.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/deployment/e2e-ci-runner-rbac.yaml b/deployment/e2e-ci-runner-rbac.yaml index fc47417..feb8aae 100644 --- a/deployment/e2e-ci-runner-rbac.yaml +++ b/deployment/e2e-ci-runner-rbac.yaml @@ -3,7 +3,7 @@ # # Grants the GitHub Actions runner's service account (Arc Runners) the minimum # permissions needed to deploy/teardown an E2E Headlamp instance in the -# privilegedescalation-dev namespace. +# headlamp-dev namespace. # # RBAC is managed via Flux from privilegedescalation/infra — do not apply manually. # This manifest is a reference copy in the plugin repo. @@ -12,7 +12,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: e2e-ci-runner - namespace: privilegedescalation-dev + namespace: headlamp-dev rules: - apiGroups: [""] resources: ["configmaps", "serviceaccounts", "events"] @@ -31,7 +31,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: e2e-ci-runner - namespace: privilegedescalation-dev + namespace: headlamp-dev subjects: - kind: ServiceAccount name: runners-privilegedescalation-gha-rs-no-permission -- 2.52.0 From 83ae5797298c15b98c154a3beeb2945d657b5e5f Mon Sep 17 00:00:00 2001 From: Chris Farhood Date: Tue, 5 May 2026 03:10:42 +0000 Subject: [PATCH 09/10] fix: use headlamp-plugins-e2e namespace for E2E tests, revert workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit headlamp-dev is Flux-managed (kustomization/headlamp-dev reconciles), causing E2E deployment conflicts and test failures. Use a dedicated headlamp-plugins-e2e namespace instead. Reverted .github/workflows/e2e.yaml — Hugh owns CI/CD; will file a child issue to update the workflow namespace. --- .github/workflows/e2e.yaml | 4 ++-- deployment/e2e-ci-runner-rbac.yaml | 6 +++--- scripts/deploy-e2e-headlamp.sh | 6 +++--- scripts/teardown-e2e-headlamp.sh | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 49ab07f..37f33a9 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -11,7 +11,7 @@ permissions: contents: read # Only one E2E run at a time: the shared E2E_RELEASE (headlamp-e2e) in -# headlamp-dev cannot be shared across concurrent runs. +# privilegedescalation-dev cannot be shared across concurrent runs. # cancel-in-progress: false (queue, don't cancel) — cancelling in-flight # runs may skip the if: always() teardown, leaving dangling cluster resources. concurrency: @@ -19,7 +19,7 @@ concurrency: cancel-in-progress: false env: - E2E_NAMESPACE: headlamp-dev + E2E_NAMESPACE: privilegedescalation-dev E2E_RELEASE: headlamp-e2e # Pin to a known-good Headlamp version. Using :latest is risky because # the tag can change between CI runs, causing flaky failures when a newer diff --git a/deployment/e2e-ci-runner-rbac.yaml b/deployment/e2e-ci-runner-rbac.yaml index feb8aae..4095d3a 100644 --- a/deployment/e2e-ci-runner-rbac.yaml +++ b/deployment/e2e-ci-runner-rbac.yaml @@ -3,7 +3,7 @@ # # Grants the GitHub Actions runner's service account (Arc Runners) the minimum # permissions needed to deploy/teardown an E2E Headlamp instance in the -# headlamp-dev namespace. +# headlamp-plugins-e2e namespace. # # RBAC is managed via Flux from privilegedescalation/infra — do not apply manually. # This manifest is a reference copy in the plugin repo. @@ -12,7 +12,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: e2e-ci-runner - namespace: headlamp-dev + namespace: headlamp-plugins-e2e rules: - apiGroups: [""] resources: ["configmaps", "serviceaccounts", "events"] @@ -31,7 +31,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: e2e-ci-runner - namespace: headlamp-dev + namespace: headlamp-plugins-e2e subjects: - kind: ServiceAccount name: runners-privilegedescalation-gha-rs-no-permission diff --git a/scripts/deploy-e2e-headlamp.sh b/scripts/deploy-e2e-headlamp.sh index 783c758..bbfe5c9 100755 --- a/scripts/deploy-e2e-headlamp.sh +++ b/scripts/deploy-e2e-headlamp.sh @@ -5,7 +5,7 @@ # a ConfigMap volume mount. No custom Docker images — the plugin is built # in CI and injected as a ConfigMap. # -# E2E resources are deployed to the `headlamp-dev` namespace. Nothing +# E2E resources are deployed to the `headlamp-plugins-e2e` namespace. Nothing # persists beyond the test run — teardown cleans up all created resources. # # Prerequisites: @@ -14,7 +14,7 @@ # - RBAC applied: kubectl apply -f deployment/e2e-ci-runner-rbac.yaml # # Environment: -# E2E_NAMESPACE — namespace for E2E Headlamp (default: headlamp-dev) +# E2E_NAMESPACE — namespace for E2E Headlamp (default: headlamp-plugins-e2e) # E2E_RELEASE — release/resource name prefix (default: headlamp-e2e) # HEADLAMP_VERSION — Headlamp image tag (default: latest) set -euo pipefail @@ -22,7 +22,7 @@ set -euo pipefail REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)" DIST_DIR="$REPO_ROOT/dist" -E2E_NAMESPACE="${E2E_NAMESPACE:-headlamp-dev}" +E2E_NAMESPACE="${E2E_NAMESPACE:-headlamp-plugins-e2e}" E2E_RELEASE="${E2E_RELEASE:-headlamp-e2e}" HEADLAMP_VERSION="${HEADLAMP_VERSION:-latest}" diff --git a/scripts/teardown-e2e-headlamp.sh b/scripts/teardown-e2e-headlamp.sh index d9bdf43..081b3ad 100755 --- a/scripts/teardown-e2e-headlamp.sh +++ b/scripts/teardown-e2e-headlamp.sh @@ -4,13 +4,13 @@ # Tears down the dedicated E2E Headlamp instance deployed by deploy-e2e-headlamp.sh. # # Environment: -# E2E_NAMESPACE — namespace to clean up (default: headlamp-dev) +# E2E_NAMESPACE — namespace to clean up (default: headlamp-plugins-e2e) # E2E_RELEASE — release/resource name prefix (default: headlamp-e2e) set -euo pipefail REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)" -E2E_NAMESPACE="${E2E_NAMESPACE:-headlamp-dev}" +E2E_NAMESPACE="${E2E_NAMESPACE:-headlamp-plugins-e2e}" E2E_RELEASE="${E2E_RELEASE:-headlamp-e2e}" echo "=== E2E Headlamp Teardown ===" -- 2.52.0 From f1a87fc079406d2d6b7cb4e39c292a8a031561c9 Mon Sep 17 00:00:00 2001 From: Chris Farhood Date: Tue, 5 May 2026 16:53:42 +0000 Subject: [PATCH 10/10] Reference shared infra RBAC in deployment scripts PRI-750: update plugin repos to reference shared infra RBAC (PRI-695 follow-up) - deployment/e2e-ci-runner-rbac.yaml: replaced duplicate manifest with reference comment pointing to privilegedescalation/infra/base/rbac/e2e-ci-runner-headlamp-rbac.yaml - scripts/deploy-e2e-headlamp.sh: updated RBAC preflight comment and error message to reference infra path - scripts/teardown-e2e-headlamp.sh: added RBAC reference comment Infra RBAC is the source of truth managed by Flux GitOps. CI workflow unchanged (Hugh owns .github/workflows/). --- deployment/e2e-ci-runner-rbac.yaml | 46 ++++++------------------------ scripts/deploy-e2e-headlamp.sh | 6 ++-- scripts/teardown-e2e-headlamp.sh | 3 ++ 3 files changed, 15 insertions(+), 40 deletions(-) diff --git a/deployment/e2e-ci-runner-rbac.yaml b/deployment/e2e-ci-runner-rbac.yaml index 4095d3a..4f5aa3c 100644 --- a/deployment/e2e-ci-runner-rbac.yaml +++ b/deployment/e2e-ci-runner-rbac.yaml @@ -1,42 +1,12 @@ --- -# e2e-ci-runner-rbac.yaml +# RBAC for the GitHub Actions CI runner to manage E2E Headlamp instances. +# CI-only test fixture — NOT for production use. # -# Grants the GitHub Actions runner's service account (Arc Runners) the minimum -# permissions needed to deploy/teardown an E2E Headlamp instance in the -# headlamp-plugins-e2e namespace. +# This file is a REFERENCE ONLY. The canonical manifest lives in: +# privilegedescalation/infra/base/rbac/e2e-ci-runner-headlamp-rbac.yaml # +# The infra repo is managed by Flux GitOps and is the source of truth. +# Do not apply this file directly — it is kept here for developer reference only. +# +# E2E resources run in `privilegedescalation-dev` — nothing persists beyond a test run. # RBAC is managed via Flux from privilegedescalation/infra — do not apply manually. -# This manifest is a reference copy in the plugin repo. - -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: e2e-ci-runner - namespace: headlamp-plugins-e2e -rules: - - apiGroups: [""] - resources: ["configmaps", "serviceaccounts", "events"] - verbs: ["get", "list", "create", "delete"] - - apiGroups: ["apps"] - resources: ["deployments"] - verbs: ["get", "create", "delete"] - - apiGroups: [""] - resources: ["services"] - verbs: ["get", "create", "delete"] - - apiGroups: [""] - resources: ["pods"] - verbs: ["get", "list"] ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: e2e-ci-runner - namespace: headlamp-plugins-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 diff --git a/scripts/deploy-e2e-headlamp.sh b/scripts/deploy-e2e-headlamp.sh index bbfe5c9..e3bbbb8 100755 --- a/scripts/deploy-e2e-headlamp.sh +++ b/scripts/deploy-e2e-headlamp.sh @@ -11,7 +11,9 @@ # Prerequisites: # - Plugin built (dist/ exists with plugin-main.js + package.json) # - kubectl configured with cluster access -# - RBAC applied: kubectl apply -f deployment/e2e-ci-runner-rbac.yaml +# RBAC is managed via Flux from privilegedescalation/infra/base/rbac/e2e-ci-runner-headlamp-rbac.yaml. +# The infra repo is the source of truth — do not apply this file directly. +# Apply RBAC first: kubectl apply -f privilegedescalation/infra/base/rbac/e2e-ci-runner-headlamp-rbac.yaml # # Environment: # E2E_NAMESPACE — namespace for E2E Headlamp (default: headlamp-plugins-e2e) @@ -35,7 +37,7 @@ fi echo "Checking RBAC permissions in namespace '${E2E_NAMESPACE}'..." if ! kubectl auth can-i delete configmaps -n "$E2E_NAMESPACE" --quiet 2>/dev/null; then echo "ERROR: Missing RBAC — cannot delete configmaps in namespace '${E2E_NAMESPACE}'." >&2 - echo " Apply RBAC first: kubectl apply -f deployment/e2e-ci-runner-rbac.yaml" >&2 + echo " Apply RBAC first: kubectl apply -f privilegedescalation/infra/base/rbac/e2e-ci-runner-headlamp-rbac.yaml" >&2 exit 1 fi diff --git a/scripts/teardown-e2e-headlamp.sh b/scripts/teardown-e2e-headlamp.sh index 081b3ad..1af461e 100755 --- a/scripts/teardown-e2e-headlamp.sh +++ b/scripts/teardown-e2e-headlamp.sh @@ -3,6 +3,9 @@ # # Tears down the dedicated E2E Headlamp instance deployed by deploy-e2e-headlamp.sh. # +# RBAC is managed via Flux from privilegedescalation/infra/base/rbac/e2e-ci-runner-headlamp-rbac.yaml. +# The infra repo is the source of truth — do not apply this file directly. +# # Environment: # E2E_NAMESPACE — namespace to clean up (default: headlamp-plugins-e2e) # E2E_RELEASE — release/resource name prefix (default: headlamp-e2e) -- 2.52.0