Skip to content

SHADOW B: pin extensions to pre-#242 (delete after) - #1040

Closed
Ladas wants to merge 11 commits into
rossoctl:mainfrom
Ladas:fix/ci-shadow-pre242
Closed

Ladas wants to merge 11 commits into
rossoctl:mainfrom
Ladas:fix/ci-shadow-pre242

Conversation

@Ladas

@Ladas Ladas commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

Shadow PR to isolate SCC failure. Pins extensions to 1a644f30 (before PR #242 "remove privileged init").

Hypothesis: If this passes, extensions PR #242 broke the sidecar injection.

Companion to #1024. Delete after testing.

Ladas added 11 commits March 18, 2026 08:21
Parse --build org/repo=ref flags from /run-e2e comments to build
dependency images from custom branches, PRs, or commits.

Examples:
  /run-e2e --build kagenti/kagenti-extensions=fix/my-branch
  /run-e2e --build kagenti/kagenti-extensions=pr/234
  /run-e2e --build kagenti/kagenti-extensions=a5607f9
  /run-e2e --build kagenti/kagenti-extensions=pr/234 --build kagenti/kagenti-operator=feat/new-crd

Security: only repos in the allow list are accepted
(kagenti/kagenti-extensions, kagenti/kagenti-operator).

Backwards compatible with --extensions-ref.

Signed-off-by: Ladislav Smola <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
…orward

## What broke

PR rossoctl#933 merged the custom `kagenti-authbridge` SCC for OpenShift agent
namespaces. This SCC is needed because the kagenti-webhook injects an
AuthBridge sidecar stack into agent pods (proxy-init, envoy, spiffe-helper,
client-registration) that requires specific UIDs and NET_ADMIN/NET_RAW
capabilities.

Shortly after, kagenti-extensions#242 and rossoctl#250 merged, which:
1. Replaced privileged mode with NET_ADMIN/NET_RAW capabilities in
   the webhook (good)
2. Started pushing :latest image tags on every merge to main (good)
3. But the :latest proxy-init image now requires POD_IP env var that
   the OLD webhook chart (v0.4.0-alpha.5) doesn't inject (broke CI)

This created a version mismatch: the packaged webhook chart (v0.4.0-alpha.5)
creates init containers WITHOUT the POD_IP env var, but pulls proxy-init:latest
which now requires it. Result: proxy-init CrashLoopBackOff on every CI run.

## Why these fixes must be combined

The fixes span SCC configuration, image builds, and deploy scripts because
the root cause is a version mismatch between the packaged chart dependency
and unreleased upstream fixes. Until kagenti-extensions releases a new chart
version (>= v0.4.0-alpha.9), CI must build the webhook from source.

## Fixes

**SCC (OpenShift):**
- Custom `kagenti-authbridge` SCC: allows NET_ADMIN/NET_RAW + RunAsAny UID
- Relaxed requiredDropCapabilities from ALL to MKNOD (sidecars don't
  specify drop:ALL, causing pod rejection)
- Explicit ClusterRole (OpenShift doesn't auto-create for custom SCCs)

**Dependency builds from source:**
- Generic `30-build-dep-image.sh`: builds any dep from branch, tag,
  pr/<number>, or commit SHA
- Registry `31-build-deps-from-refs.sh`: maps repos to build configs
  with allow list (kagenti-extensions, kagenti-operator)
- Hardcoded default: builds kagenti-extensions@main on both Kind and
  HyperShift until the chart dependency is bumped
- /run-e2e --build org/repo=ref for ad-hoc overrides (after merge)

**Port-forward (Kind):**
- Use kubectl wait for deployment readiness instead of kubectl exec
  (exec targets injected sidecar container, not the agent)

## After kagenti-extensions releases new chart

Remove the hardcoded KAGENTI_DEP_BUILDS defaults from:
- .github/scripts/hypershift/ci/70-deploy-kagenti.sh
- .github/scripts/local-setup/kind-full-test.sh

And bump Chart.yaml: kagenti-webhook-chart >= v0.4.0-alpha.9

Signed-off-by: Ladislav Smola <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
…elm upgrade

Two fixes from review feedback:

1. Kind CI: The workflow runs individual scripts, not kind-full-test.sh,
   so the dep build step was never executed. Add it to both e2e-kind-pr.yaml
   and e2e-kind.yaml between CRD wait and agent deploy.

2. HyperShift: helm upgrade --reuse-values can drop resources (SCCs,
   RoleBindings) when values are re-merged. Replace helm upgrade with
   kubectl set image to patch the deployment directly, avoiding any
   changes to helm release state.

Also move the hardcoded KAGENTI_DEP_BUILDS default into
31-build-deps-from-refs.sh so it works both when called from deploy
scripts and from workflow steps.

Signed-off-by: Ladislav Smola <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
The webhook binary references proxy-init:latest from GHCR. Rebuilding
only the webhook doesn't fix proxy-init CrashLoopBackOff because the
init container still pulls the incompatible :latest image from GHCR.

Build proxy-init from the same extensions ref, tag as both :local and
:latest, and load into Kind so it uses the local image.

Signed-off-by: Ladislav Smola <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
…orward

SCC fixes:
- Custom kagenti-authbridge SCC (NET_ADMIN/NET_RAW, RunAsAny, MKNOD drop)
- Explicit ClusterRole for custom SCC

Dependency builds from source:
- Generic 30-build-dep-image.sh (branch, tag, pr/<N>, commit SHA)
- Builds both webhook AND proxy-init from extensions@main
- DEP_SKIP_PATCH for init container images (no deployment to patch)
- Hardcoded default until webhook chart is bumped past v0.4.0-alpha.8
- /run-e2e --build org/repo=ref for ad-hoc overrides (after merge)
- Added dep build step to Kind CI workflows (e2e-kind-pr, e2e-kind)

Port-forward:
- kubectl wait for deployment readiness (not kubectl exec into sidecar)

Deploy script:
- kubectl set image instead of helm upgrade --reuse-values
- Logs all overrides to CI output and GitHub step summary

Signed-off-by: Ladislav Smola <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
The bash-based comment parser used ${{ github.event.comment.body }}
in shell context, which is vulnerable to command injection (same issue
fixed by rossoctl#1012 for --extensions-ref).

Rewrite the entire parser using actions/github-script (JavaScript)
where comment body is accessed via context.payload.comment.body safely.
Add strict regex validation for repo names and ref patterns.

Signed-off-by: Ladislav Smola <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
build.yaml: Move github.ref_name into env var to prevent shell injection
via crafted git tags (e.g., v$(malicious-command)).

cleanup-stale-hypershift-clusters.yaml: Move github.event.inputs.*
into env vars to prevent injection via workflow_dispatch inputs.

Both follow the pattern from rossoctl#1012: never interpolate user-controlled
GitHub context values directly into shell run: blocks.

Signed-off-by: Ladislav Smola <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
The webhook ConfigMap pins proxy-init to v0.4.0-alpha.8 (from
charts/kagenti/values.yaml), not :latest. Our local build was only
tagged as :local and :latest, so Kind pulled v0.4.0-alpha.8 from
GHCR (the broken version).

Now scan values.yaml for all version tags referencing the image and
tag the local build with each one. This ensures the locally-built
image is used regardless of which tag the webhook ConfigMap requests.

Signed-off-by: Ladislav Smola <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
On OpenShift, built images go to the internal registry but the webhook
ConfigMap still references GHCR images (v0.4.0-alpha.8). Patch the
ConfigMap after building to point to internal registry images, then
restart the webhook to pick up the new config.

Signed-off-by: Ladislav Smola <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
Shipwright Build v1beta1 uses strict decoding and rejects unknown
fields. serviceAccount is a BuildRun field, not a Build field.
The BuildRun already sets serviceAccount: pipeline correctly.

Fixes: strict decoding error on HyperShift E2E

Signed-off-by: Ladislav Smola <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
Tests if extensions PR rossoctl#242 (remove privileged init container)
introduced the SCC rejection. Pins to commit before that merge.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
@Ladas

Ladas commented Mar 18, 2026

Copy link
Copy Markdown
Contributor Author

/run-e2e

@github-actions github-actions Bot added the safe-to-test Maintainer reviewed - safe to run E2E tests label Mar 18, 2026
@github-actions

Copy link
Copy Markdown

E2E HyperShift Tests Started

Triggered by: @Ladas
Commit: 1553eba0f37c6843f3aa3a5ead73c431e6baf40a
Workflow Run: View logs

Tests are running on OpenShift 4.20.11. This typically takes 30-45 minutes.


To re-run tests after new commits, comment /run-e2e again.

@github-actions

Copy link
Copy Markdown

E2E HyperShift Tests Failed

Commit: 1553eba0f37c6843f3aa3a5ead73c431e6baf40a
Result: Tests failed - please check the logs
Workflow Run: View logs


To re-run tests after fixing issues, comment /run-e2e again.

@Ladas

Ladas commented Mar 18, 2026

Copy link
Copy Markdown
Contributor Author

Shadow test complete — pinned ref not fetchable. Debugging live.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe-to-test Maintainer reviewed - safe to run E2E tests

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant