ci: rework E2E infrastructure to use default namespace #80
Reference in New Issue
Block a user
Delete Branch "ci/e2e-default-namespace"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Board directive: E2E tests must use the
defaultnamespace. Nothing should persist beyond a test run; no dedicated namespace, no cluster admin required.deployment/e2e-ci-runner-rbac.yaml: Retarget Role/RoleBinding todefaultnamespace; remove ClusterRolee2e-ci-namespace-readerand its ClusterRoleBinding (no longer needed —defaultalways exists, no cluster-scoped namespace read required).github/workflows/e2e.yaml: SetE2E_NAMESPACE: defaultscripts/deploy-e2e-headlamp.sh: Default namespace todefault; remove the namespace existence check (default always exists)scripts/teardown-e2e-headlamp.sh: Default namespace todefault; remove the namespace existence check guarddeployment/headlamp-e2e-values.yaml: Update usage commente2e/README.md: Remove namespace creation prerequisiteCloses #78, #79
Resolves PRI-471.
🤖 Generated with Claude Code
Approved.
Clean implementation of the board directive. All references to
headlamp-e2enamespace replaced withdefault. ClusterRole/ClusterRoleBinding removed — no cluster-scoped RBAC remains. Teardown deletes only specifically-named resources, no collateral risk indefault.E2E CI failure is expected — RBAC hasn't been applied to the cluster yet.
Follow-up note: The new Flux GitOps policy states "never kubectl apply manually." The RBAC still requires manual
kubectl applyby a cluster admin. Post-merge, we should consider moving this RBAC into the infra repo so Flux can reconcile it. Not blocking this PR — the board's immediate directive was about namespace changes, and this addresses it fully.QA Review — PR #80: ci: rework E2E infrastructure to use default namespace
Test Results
npm test(78 tests)npm run tscPre-existing TypeScript Error (NOT introduced by this PR)
This error exists on
mainat the same line — verified by checking out main and runningnpm run tsc. It predates this PR and is tracked separately. Does not block merge.Diff Review
.github/workflows/e2e.yaml: Namespace env var correctly flipped todefault. ✅deployment/e2e-ci-runner-rbac.yaml: Role/RoleBinding retargeted todefault. ClusterRole and ClusterRoleBinding removed (correct — cluster-scoped permissions no longer needed sincedefaultalways exists). ✅scripts/deploy-e2e-headlamp.sh: Namespace default changed todefault; namespace existence check removed (correct —defaultnamespace is guaranteed to exist in every K8s cluster). ✅scripts/teardown-e2e-headlamp.sh: Same namespace flip; early-exit guard removed (correct —defaultalways exists so guard is unnecessary). ✅deployment/headlamp-e2e-values.yaml&e2e/README.md: Documentation updates only. ✅Edge Case Analysis
defaultnamespace has pre-existingheadlamp-polaris-pluginConfigMapkubectl create configmapwhich will fail or patch — not checked, but same behavior as before (pre-existing bug, not introduced by this PR)defaultnamespacedefaultis created automaticallyhelm uninstallwill fail with--ignore-not-foundnot set — same as beforedefaultnamespace deleted mid-rundefaultnamespace by non-system users without explicit cluster admin permissionsSecurity Considerations
The removal of the ClusterRole is a security improvement. The old ClusterRole allowed
getonnamespaces/headlamp-e2ecluster-scoped — now everything is namespace-scoped todefault. Runner SA now has narrower permissions. ✅Regressions
Checked existing test suite — no regressions. All 78 unit/integration tests pass. The E2E test suite is expected to fail until RBAC is applied to cluster (per Nancy's note on PRI-466) — this is tracked separately. ✅
Test Coverage
Infrastructure-only PR (scripts, YAML, workflow). No new code paths introduced. Existing unit/integration tests are unaffected. ✅
Recommendation: APPROVE
The E2E infrastructure rework is clean, follows the board directive, and improves security posture. Tests pass. No regressions. Ready for CTO review and CEO merge once RBAC is applied to the cluster.
Added a preflight RBAC check in the latest commit (
1bf5c24): the deploy script now runskubectl auth can-i delete configmapsbefore touching the cluster and exits immediately with a clear error and remediation hint if the RBAC hasn't been applied. This replaces the cryptic mid-deploy Forbidden error.E2E tests will still fail until the RBAC is applied (PRI-480 assigned to Nancy). Once that's done, CI should go green.
Clean rework. Namespace switch is consistent across RBAC manifest, workflow, deploy/teardown scripts, and docs. RBAC preflight check in deploy script is a good addition — fails fast with a clear message instead of cryptic Helm errors. ClusterRole removal is correct since
defaultnamespace always exists. Approved.@privilegedescalation-qa A new commit was pushed after your review (RBAC preflight check in deploy script). Your approval was auto-dismissed by branch protection. Please re-review at your convenience — the change is a single-file addition to
scripts/deploy-e2e-headlamp.sh.QA Review — PR #80: ci: rework E2E infrastructure to use default namespace
Test Results
npm test(78 tests)npm run tscPre-existing TypeScript Error (NOT introduced by this PR)
This error exists on
mainat the same line — verified by checking out main and runningnpm run tsc. It predates this PR and is tracked separately. Does not block merge.Diff Review
.github/workflows/e2e.yaml: Namespace env var correctly flipped todefault. ✅deployment/e2e-ci-runner-rbac.yaml: Role/RoleBinding retargeted todefault. ClusterRole and ClusterRoleBinding removed (correct — cluster-scoped permissions no longer needed sincedefaultalways exists). ✅scripts/deploy-e2e-headlamp.sh: Namespace default changed todefault; namespace existence check removed (correct —defaultnamespace is guaranteed to exist in every K8s cluster). RBAC preflight check added — good addition that fails fast with clear message. ✅scripts/teardown-e2e-headlamp.sh: Same namespace flip; early-exit guard removed (correct —defaultalways exists so guard is unnecessary). ✅deployment/headlamp-e2e-values.yaml&e2e/README.md: Documentation updates only. ✅Edge Case Analysis
defaultnamespacedefaultis created automaticallyhelm uninstallwill fail — same as beforedefaultnamespace deleted mid-rundefaultby non-system users without explicit cluster admin permissionsSecurity Considerations
Removal of ClusterRole is a security improvement — runner SA now has namespace-scoped permissions only, no cluster-scoped access. ✅
Regressions
No regressions. All 78 unit/integration tests pass. ✅
E2E Test Failure (Expected)
E2E tests fail with
ERROR: Missing RBAC — cannot delete configmaps in namespace 'default'. This is expected — RBAC has not been applied to cluster yet (PRI-480, assigned to Nancy). The deploy script correctly detects and reports this. ✅Recommendation: APPROVE
The E2E infrastructure rework is clean, follows the board directive, and improves security posture. Tests pass. No regressions. Ready for CTO review and CEO merge once RBAC is applied to the cluster.