Repository navigation
RC1-4: OCP 4.20 progression of the AuthBridge egress-control hops - #104
Conversation
…aps) Add deploy/knative/overlays/ocp-authbridge/, a standalone kustomize overlay that makes the shared RC1 AuthBridge manifests (ibac-stub, AB1, echo-target, AB2, sandbox-pool-ab2, the tightened harness egress policy) deployable on OpenShift under the restricted/nonroot SCC, without editing those shared Kind-gated manifests. - kustomization.yaml: references the 6 RC1 AB manifests, remaps the three dev.local images to GHCR, and wires 4 patches. Standalone (does not layer on ../ocp) to avoid duplicate Sandbox CR IDs with sandbox-pool.yaml. - patch-ab1.yaml / patch-echo-target.yaml: strategic-merge SCC patches (no runAsUser pin — both images already run as non-root). - patch-ibac-stub.yaml: strategic-merge SCC patch pinning runAsUser 65532, since it rides the GHCR harness image (no USER declared, runs as root), same rationale as deploy/knative/leaf-cron.yaml:40-41. - patch-sandbox-ab2.yaml: JSON6902, ADD-ONLY (mirrors overlays/ocp/patch-sandbox.yaml but never touches image/command, since the -ab2 pool's sidecar + proxy env must be preserved). - packages/knative-server/test/ocp-authbridge-overlay.test.ts: manifest-shape test (pure YAML/JSON6902 parsing, no kustomize binary) covering the resources/images/patches shape. Verified: vitest 28/28 new + 123/123 full knative-server suite green; kubectl kustomize --load-restrictor LoadRestrictionsNone renders cleanly. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
Mirrors the setup-kind.sh SH_AUTHBRIDGE=1 gating (blocks A/B/C) for the OCP reproducible full-setup path, adapted for OpenShift idioms (no docker build / kind load; images pulled pre-baked from GHCR). - Section 3: when SH_AUTHBRIDGE=1, seed ab1-llm-cred with the real ANTHROPIC_API_KEY and repoint llm-credentials to the AB1 placeholders + in-cluster base-url. Unchanged else branch for the flag-off path. - New Section 6c (gated): seed ab2-egress-cred, render+apply the ocp-authbridge overlay (factored render_overlay into render_overlay_dir <dir> so both overlays share the same image/ namespace sed post-processing), roll out authbridge-ab1/ibac-stub/ echo-target, force-roll the sandbox pool onto the AB2-sidecar variant, and stamp a build-ts annotation on ksvc/serverless-harness so it picks up the repointed llm-credentials. - usage()/help text + top-of-file comment mention SH_AUTHBRIDGE=1 (off by default). Every new block is gated behind SH_AUTHBRIDGE, dry-run aware, and logs to $LOG_DIR. Verified with bash -n and shellcheck -x (only pre-existing SC2015 info-level findings, same idiom used throughout the file). Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
Adds deploy/knative/rc1-ocp-gate.sh: a mode-based wrapper (up/smoke/restore/gate) that applies the RC1 AuthBridge overlay (overlays/ocp-authbridge) against an already-deployed serverless-harness stack in namespace default, runs leaf-smoke.sh against the OpenShift Route, and always restores the namespace to its pre-gate state (direct-mode llm-credentials, base sandbox pool, base egress policy) afterward. Does not stand up the cluster/base stack (setup-ocp.sh's job). Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
…t-exit)
Fixes a Critical restore-safety bug: mode_gate wrapped only mode_smoke's
return value ("if ! mode_smoke; then ..."), but mode_smoke (and the
preflight it called) used `exit 1` directly. In bash, exit inside a
directly-called function terminates the whole process and is never caught
by an enclosing 'if !' — so a preflight/KSVC_URL failure inside the smoke
step skipped mode_restore entirely, leaving llm-credentials repointed to
AB1-PLACEHOLDER on a live cluster with no recovery.
- preflight() and mode_smoke()'s empty-KSVC_URL guard now `return 1`
instead of `exit 1`; every call site guards with `preflight || return 1`
so the failure still propagates correctly under set -e (mode_up/
mode_restore/mode_smoke standalone) or via captured $? (gate).
- mode_gate now arms `trap 'mode_restore || true' EXIT` right after mode_up
succeeds (skipped when RC1_GATE_KEEP=1), so restore runs on ANY exit path
— internal exit, set -e abort, or the normal exit $smoke_exit — instead of
relying on a sequential call that could be skipped.
- Removes the explicit sequential mode_restore call from mode_gate (fixes
the Important issue: a failure inside mode_restore no longer aborts before
the SMOKE_EXIT:<n> line prints, since restore now runs via the EXIT trap
after that line executes and after the final exit is issued).
- Minor: saved real-api-key file is now created under `umask 077` to avoid
the brief default-umask window before the chmod 600.
Verified with bash -n, shellcheck (clean), --help (no cluster contact), and
a throwaway trap-logic proof confirming the EXIT trap still runs
mode_restore and preserves the intended exit code even when mode_smoke
hard-exits.
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
…ive-server dir + Dockerfile workspace COPY) Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
…ls nonroot-v2 verify) The echo-target image declares USER node (non-numeric). On OCP the kubelet refuses runAsNonRoot:true without a numeric runAsUser (CreateContainerConfigError: 'image has non-numeric user (node), cannot verify user is non-root'). Pin runAsUser: 1000 (node's UID). Surfaced by the live OCP 4.20 gate; Kind never enforced SCC so it was masked. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
On OVN-Kubernetes, egress NetworkPolicy is enforced against the POST-DNAT packet. The dns-default Service (172.30.0.10:53) DNATs to the CoreDNS pods on their real container port 5353, so a bare `port: 53` egress rule never matches the translated DNS traffic: every lookup from a harness-labeled pod hits default-deny and times out. This blocked the harness from resolving the LLM host, redis, and authbridge-ab1 on any enforcing CNI, and was invisible on Kind (kindnet does not enforce egress). Affects the flag-off base policy too, not just the SH_AUTHBRIDGE path. Scope the DNS rule to the openshift-dns namespace on UDP+TCP 5353 in both the base policy and the tightened AuthBridge variant, and update the manifest-shape vitest to assert the DNAT-aware shape. Live-verified on OCP 4.20 (OVN-K): an A/B probe matrix confirmed 5353 resolves in ~0.007s where 53 times out at 40s (even when scoped to openshift-dns); the RC1-4 live gate now passes 6/6 (was 5/6 — H1-allow), 16/16 smoke claims. Fixes rossoctl#102 Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
|
Added What it was: OVN-Kubernetes enforces egress Fix: DNS egress rule → Verified live on OCP 4.20 / OVN-K:
Full RCA on #102. Assisted-By: Claude (Anthropic AI) [email protected] |
…ded annotations RC1-0/1/2/4 are merged and live-verified on both Kind and OCP 4.20 (PRs #94–#104; the OCP live gate passes 6/6). The only remaining RC1 milestone, RC1-3 (BYO sandbox, a marked stretch), is gated on the SandboxTransport live gate ST5 (#88). Per the RC1 spec §7, the Z3/Z5 mechanism-superseded header edits were deliberately deferred "until RC1 is accepted." This flips RC1 Proposed → Accepted and applies those annotations: - RC1 spec: Status → Accepted (with implementation state); §7 closing note updated to reflect the annotations are now applied. - Z3 (inference injector): Status notes its mechanism is superseded by RC1 Profile A (plain-Go injector → AuthBridge shared gateway); retained for deployment-profile detail + deferred per-caller-identity/mTLS. - Z5 (generalized credentialed egress): Status notes RC1 Profile B implements a static single-tenant slice of its mechanism; retained as the home of the deferred per-user / RFC 8693 token-exchange core. - specs/README.md: RC1 row → accepted; Z3/Z5 rows annotated to match. No mechanism prose is deleted; Z3/Z5 remain the home of their deferred per-user work. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
pdettori
left a comment
There was a problem hiding this comment.
LGTM (self-review — GitHub blocks self-approval, posting as a comment). Clean, well-documented RC1-4 progression; flag-gated (SH_AUTHBRIDGE, off by default) with the flag-off path preserved verbatim. All 6 commits signed off; CI green.
Verified the load-bearing invariants:
- Secret parity between
setup-ocp.sh(§3 / §6c) andrc1-ocp-gate.sh(mode_up) — sameapi.anthropic.comkey onab1-llm-cred, sameAB1-PLACEHOLDERvalues, samebase-url: http://authbridge-ab1:8080, sameecho-targetkey onab2-egress-cred. - EXIT-trap preserves the smoke exit code (
exit "$smoke_exit"fires the trap;mode_restore || truedoesn't call exit, so the original code propagates). - Restore actually re-opens egress: base
harness-egress-policy.yamland tightenedharness-egress-ab1.yamlsharemetadata.name: serverless-harness-egress, sorestore's base-overlay re-apply overwrites the tightened policy. - DNS fix (5585e5c) is correct: OVN-K enforces egress post-DNAT and CoreDNS's real container port is 5353, so the
openshift-dns/5353 scoping is the right shape; live-verified 6/6.
Only suggestion-level notes below — none blocking.
Note (not inline): the PR description still frames the DNS issue as out-of-scope/deferred to #102 ("Once DNS egress is fixed, this branch needs no change to reach 6/6"), but commit 5585e5c now fixes it in-PR at 6/6. Consider updating the body so it doesn't read as 5/6-with-a-known-gap.
Assisted-By: Claude Code
| log_warn "RC1_GATE_KEEP=1 — skipping automatic restore; gate left applied in $NS for debugging" | ||
| else | ||
| log_info "Arming restore-on-exit trap (restore runs no matter how the smoke step exits)" | ||
| trap 'mode_restore || true' EXIT |
There was a problem hiding this comment.
suggestion: the restore-on-exit trap is armed only after mode_up returns. If mode_up fails after the llm-credentials repoint to AB1-PLACEHOLDER (e.g. the overlay apply at the top of mode_up fails), the namespace is left gated with no automatic restore. It's recoverable — the real key is saved to STATE_DIR before the repoint, so a manual restore works — but worth either a one-line note in the trap comment or arming the trap at the top of mode_up (the idempotent restore + its preflight guards make an early trigger safe).
| - to: | ||
| - namespaceSelector: | ||
| matchLabels: | ||
| kubernetes.io/metadata.name: openshift-dns |
There was a problem hiding this comment.
suggestion: this is the base (flag-off) policy, and it now hardcodes the openshift-dns namespace + port 5353, so it's no longer DNS-topology-agnostic. An enforcing non-OCP CNI (e.g. kube-dns in kube-system on port 53) would lose DNS resolution. It's a no-op on Kind (kindnet doesn't enforce) and correct on OCP/OVN-K — which matches the repo's actual Kind+OCP target matrix — but the base default silently assuming OpenShift DNS topology is a latent portability assumption worth a comment here.
RC1-4 — OCP 4.20 progression of the AuthBridge egress-control hops
Progresses the RC1 AuthBridge egress-control PoC (flag-gated behind
SH_AUTHBRIDGE, off bydefault) from Kind onto OpenShift 4.20 / OVN-Kubernetes, where the tightened egress
NetworkPolicyis genuinely enforced (unlike Kind's non-enforcing kindnet). Stacks on the mergedRC1-0/1/2 work (#94/#96/#97/#99), the official-image migration (#100), and the echo-target GHCR
publish (#101).
What's in this PR
deploy/knative/overlays/ocp-authbridge/— a new standalone OCP kustomize variant thatcarries the RC1 AuthBridge manifests with GHCR image remaps and OCP SCC/nonroot patches
(serviceAccountName + per-image
securityContext). Standalone (not layered onoverlays/ocp/) sothe flag-off default stays inert and the shared AB manifests remain Kind-identical. Includes a
manifest-shape vitest (parses YAML/JSON6902 directly — no kustomize in CI).
setup-ocp.sh—SH_AUTHBRIDGE=1-gated two-hop wiring (secrets, overlay render+apply, poolforce-roll, ksvc roll), mirroring the Kind path. Flag-off path byte-for-byte unchanged.
deploy/knative/rc1-ocp-gate.sh— a targeted live-gate wrapper (up/smoke/restore/gate)that runs the gate against an already-deployed stack and restores pre-gate state (EXIT-trap
restore; the real key is read from the live secret, never logged).
ibac-stub: run from theknative-serverpackage dir sotsxresolves in the published image,plus add
packages/ibac-stubto theDockerfileworkspace COPY (root cause).echo-target: pinrunAsUser: 1000— its non-numeric imageUSER nodefails the kubelet'srunAsNonRootverification without a numeric UID.Live gate result (real OCP 4.20 / OVN-K)
5/6 AuthBridge claims green, including every security-critical invariant:
H1-secret-free✓,H2-secret-free✓,H1-deny(403 pre-inject) ✓,H2-deny(pre-egress) ✓,H2-inject(AB2 injects the real egress cred; sandbox only ever holds a placeholder) ✓. The realcredentials live only in
ab1-llm-cred/ab2-egress-cred; harness and sandbox carry placeholders.H1-allow(a full agent turn) does not complete on OCP — root-caused to a pre-existing,out-of-scope bug: the base harness egress
NetworkPolicy's DNS rule (ports:53, noto) does notpermit DNS on this cluster's OVN-K, so the harness can't resolve
authbridge-ab1. Proven with A/Bprobes (the base policy blocks DNS too; the standard
openshift-dnsselector fix is insufficient).Tracked in #102. Once DNS egress is fixed, this branch needs no change to reach 6/6. The
AB2-pool readiness-poll latency wart is tracked in #103.
Testing
@sh/knative-serversuite green (123 tests incl. the new 28-testocp-authbridge-overlay.test.ts).SH_AUTHBRIDGEunset) leavessetup-ocp.shand the base overlay byte-for-byte unchanged.Assisted-By: Claude Code