Repository navigation
feat(authbridge): Cut over Helm chart + backend to per-plugin config - #1507
Conversation
1218f05 to
7e4f4f9
Compare
|
/run-e2e |
E2E HyperShift Tests FailedCommit: To re-run tests after fixing issues, comment |
New Commits DetectedThe New HEAD: For maintainers: Please review the new changes and comment Security checklistBefore running E2E tests, verify the PR does NOT contain:
This is an automated security measure to prevent TOCTOU attacks |
288e750 to
9728414
Compare
|
/run-e2e |
E2E HyperShift Tests PassedCommit: The If you push new commits, the label will be removed and you'll need to comment |
…n synthesizePipeline ## Why When a namespace's `authbridge-runtime-config` ConfigMap has no `pipeline:` of its own, the webhook synthesizes one from the namespace's `authbridge-config` env-var contract (NamespaceConfig). The synthesis passed `keycloak_url` + `keycloak_realm` only to the outbound token-exchange plugin. jwt-validation got just `issuer`. kagenti-extensions#383 extends the jwt-validation plugin to accept these two fields and derive jwks_url from the INTERNAL Keycloak URL — the sidecar actually reaches the JWKS endpoint from inside the cluster, and `issuer` is the PUBLIC hostname (required for `iss`-claim matching but typically unreachable from inside the pod). Without the keycloak_* hints, jwt-validation falls back to issuer-derivation and every inbound request fails with "connection refused" fetching the JWKS → 401. ## Scope Pure addition to `synthesizePipeline`: the same two fields that already feed token-exchange now also feed jwt-validation. Both plugins end up with the same "where is Keycloak internally" hint, mirroring the pre-PR-#378 binary behavior where jwks_url was derived from outbound.token_url via a cross-plugin pass. Test: extend `TestEnsurePerAgentConfigMap_EmptyBaseYAML_Fallback FromNsConfig` to assert jwt-validation now receives keycloak_url and keycloak_realm. ## Compatibility Requires kagenti-extensions ≥ the tag that includes #383 — older authbridge binaries reject the new fields at DisallowUnknownFields decode. The chart in rossoctl/rossoctl#1507 bumps both pins together. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
9728414 to
c7d45e3
Compare
New Commits DetectedThe New HEAD: For maintainers: Please review the new changes and comment Security checklistBefore running E2E tests, verify the PR does NOT contain:
This is an automated security measure to prevent TOCTOU attacks |
Completes the three-PR cutover started in kagenti-extensions#378 and kagenti-operator#335. This PR moves the kagenti Helm chart and the backend ConfigMap generator onto the per-plugin schema the authbridge binary now requires, and bumps the pinned authbridge + kagenti-operator image tags to the paired release. The chart previously emitted authbridge-runtime-config with top-level inbound: / outbound: / identity: / bypass: blocks. Authbridge v0.5.0-alpha.12 rejects that shape (pipeline is empty, open-proxy guard fires). Now emits pipeline.inbound.plugins[] + pipeline.outbound.plugins[] with one entry each (jwt-validation, token-exchange). Plugin-level defaults (audience_file, bypass_paths, identity file paths) are applied by the authbridge binary from its own convention layer and are not emitted by the chart — see authbridge/authlib/plugins/CONVENTIONS.md. Files: - charts/kagenti/templates/authbridge-template-configmaps.yaml — the release-namespace template that the operator propagates to agent namespaces that didn't come from the Helm chart. - charts/kagenti/templates/agent-namespaces.yaml — the per-agent-namespace copy written directly at install time. - kagenti/backend/app/routers/agents.py — the backend's _build_authbridge_runtime_yaml, used when the API creates an agent namespace through the UI. - kagenti/backend/tests/test_authbridge_runtime_config.py — rewritten assertions walk pipeline.<direction>.plugins[<name>].config via a small _plugin_config helper. Also asserts the absence of fields that the plugin now defaults on its own (bypass_paths, audience_file, identity file paths) to keep the contract with authbridge honest. charts/kagenti/values.yaml: - kagenti-operator-chart.controllerManager.container.image.tag: 0.2.0-alpha.34 → 0.2.0-alpha.35 - kagenti-operator-chart.defaults.images.*: v0.5.0-alpha.10 → v0.5.0-alpha.12 (envoyProxy, authbridgeLight, proxyInit, spiffeHelper, clientRegistration) v0.5.0-alpha.12 is the first authbridge-extensions release with the new schema requirement. v0.2.0-alpha.35 is the first kagenti-operator release whose webhook emits the new shape. Both must bump together — this PR is the atomic flip. kagenti-webhook-chart (v0.4.0-alpha.9) is unaffected; it belongs to the legacy deployment path that uses envoy-with-processor and doesn't touch authbridge's YAML schema. - [x] helm template charts/kagenti/ renders both ConfigMap templates without errors; output is valid YAML and parses to the new schema. - [x] Direct test of _build_authbridge_runtime_yaml's output shape (spire_enabled true + false): correct plugin names, config values, absence of defaulted fields. - [ ] pytest run — needs the repo's venv; CI runs it. - [ ] Local kind-cluster smoke test alongside the paired images. Pre-merge gate. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
The AssertionError message in _plugin_config fits on one line per ruff's line-length config. No behavior change — formatting only. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
…s PR rossoctl#378) v0.5.0-alpha.12 was mistakenly tagged on the pre-PR-rossoctl#378 commit (PR rossoctl#377's merge only), so the image's config loader still parses pipeline.plugins as []string and errors with 'cannot unmarshal !!map into string' on the per-plugin YAML the chart now emits. v0.5.0-alpha.13 points at PR rossoctl#378's merge commit (935251b) and contains the PluginEntry schema the chart relies on. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
For Deployment/StatefulSet/Job workloads, the UI creates a Service that port-translates (port=8080 → targetPort=8000), so the container can safely listen on 8000 while AGENT_ENDPOINT advertises 8080. But the Sandbox controller creates a *headless* Service with no port translation, so clients hitting the AGENT_ENDPOINT URL land on the pod at 8080 and get "connection refused" because the container is on 8000. The Kagenti backend then surfaces this to the UI as "agent card not available" (503 from envoy). In _build_sandbox_manifest, set both the PORT env and the containerPort to servicePorts[0].port (the external port, which also drives AGENT_ENDPOINT) so the agent listens where clients expect it. Other workload builders are untouched — they continue to split port/targetPort because their Service translates. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
c7d45e3 to
cda427c
Compare
|
/run-e2e |
E2E HyperShift Tests FailedCommit: To re-run tests after fixing issues, comment |
…l JWKS ## Problem The per-plugin cutover (authbridge PR rossoctl#378) isolated each plugin's config decode, dropping the cross-plugin derivation that previously let `inbound.jwks_url` pick up the INTERNAL Keycloak URL from `outbound.token_url`. The jwt-validation plugin's only remaining fallback was to derive `jwks_url` from its own `issuer` — but `issuer` must be the PUBLIC Keycloak URL to match the `iss` claim on tokens, and in Kind/OpenShift split-horizon deployments that hostname resolves to 127.0.0.1 inside the sidecar pod. Every inbound JWT validation failed "connection refused" fetching JWKS. Observed (CI run 25525390807 weather-tool-advanced envoy-proxy): msg="JWT validation failed" error="fetching JWKS: Get \"http://keycloak.localtest.me:8080/realms/kagenti /protocol/openid-connect/certs\": dial tcp [::1]:8080: connect: connection refused" ## Fix kagenti-extensions#383 added `keycloak_url` + `keycloak_realm` fields to jwt-validation, symmetric with token-exchange. When set, the plugin derives `jwks_url` from the internal URL. kagenti-operator#336 updated `synthesizePipeline` to emit them. This commit passes the same two hints from the chart's `authbridge-runtime-config` template and the backend's `_build_authbridge_runtime_yaml` helper. Pin bumps to match: kagenti-operator: 0.2.0-alpha.35 -> 0.2.0-alpha.36 authbridge sidecars: v0.5.0-alpha.13 -> v0.5.0-alpha.14 Both must bump together: operator alpha.36's synthesize emits the new fields, extensions alpha.14's jwt-validation accepts them. A stale pin on either side would fail DisallowUnknownFields at plugin decode or fall through to issuer-derivation again. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
cda427c to
6ae090a
Compare
New Commits DetectedThe New HEAD: For maintainers: Please review the new changes and comment Security checklistBefore running E2E tests, verify the PR does NOT contain:
This is an automated security measure to prevent TOCTOU attacks |
|
/run-e2e |
E2E HyperShift Tests FailedCommit: To re-run tests after fixing issues, comment |
|
/run-e2e |
E2E HyperShift Tests FailedCommit: To re-run tests after fixing issues, comment |
cwiklik
left a comment
There was a problem hiding this comment.
Well-structured three-repo cutover. Helm templates, backend ConfigMap generator, and tests all agree on the new pipeline.inbound.plugins[] / pipeline.outbound.plugins[] schema shape. keycloak_url/keycloak_realm are consistently passed to both jwt-validation and token-exchange across all code paths.
Areas reviewed: Helm/K8s, Python, YAML (values), Tests, Security, Feature-gate parity
Commits: 5 commits, all signed-off
CI: 19/20 passing — E2E HyperShift failed (infrastructure flake: keycloak-admin-secret not provisioned to expected namespace; unrelated to schema changes). Deploy & Test (Kind) passed.
| cmd: /manager | ||
| image: | ||
| tag: 0.2.0-rc.1 | ||
| tag: 0.2.0-alpha.36 |
There was a problem hiding this comment.
suggestion: The PR description's "Before" column says v0.5.0-alpha.10 but the actual base (main) has v0.5.0-rc.1. This is a semantic rollback from RC → alpha. The change is correct (RC.1 images don't support the new per-plugin schema), but consider updating the PR body to reflect the actual base versions so reviewers understand this intentionally regresses the v0.6.0-rc.1 pins.
| ) -> dict: | ||
| """Build a Sandbox manifest (agents.x-k8s.io/v1alpha1) for direct creation.""" | ||
| env_vars = _build_env_vars(request) | ||
| # Sandbox controller creates a headless Service with no port translation, |
There was a problem hiding this comment.
suggestion: The sandbox headless-service port fix is unrelated to the authbridge schema cutover. Mixing an independent bug fix with a schema migration makes bisection harder if either change causes a regression. The fix is correct and well-explained in the commit message — just flagging for awareness.
…erator-managed client registration ## Problem kagenti-operator 0.2.0-alpha.36 (required by PR rossoctl#1507 for the per- plugin authbridge cutover) moved the ClientRegistrationReconciler to read keycloak-admin-secret from the OPERATOR namespace rather than from each agent namespace. Commit f5df832 in the operator repo was merged explicitly gated on this companion chart change — the commit message says: "This PR should be merged AFTER kagenti#1422 is merged and deployed to ensure the secret exists in kagenti-system before the operator tries to read it." kagenti#1422 is open, not merged. Without the admin secret in the operator namespace, the reconciler logs "waiting for keycloak-admin- secret" forever, never registers the Keycloak client for agent workloads, and envoy-proxy polls /shared/client-id.txt indefinitely. Every inbound request returns 503 with "identity not yet configured (credentials pending)". This is invisible on Kind because the advanced E2E weather workloads opt into the legacy sidecar path via kagenti.io/client-registration- inject=true — that path writes the credential files directly and bypasses the operator entirely. On HyperShift / OpenShift the baseline weather-service has no such label, so operator-managed registration is the only path, and it was stuck. ## Evidence (from CI run 25553345293) weather-service pod: 3/3 Running (agent + envoy-proxy + spiffe-helper, NO client-registration sidecar — correct, since label not set) envoy-proxy stderr: msg="credential file still not available" path=/shared/client-id.txt waited=11m0s msg="pipeline: plugin rejected request" plugin=jwt-validation status=503 reason="identity not yet configured (credentials pending)" operator log (repeats every reconcile): msg="waiting for keycloak-admin-secret" namespace=kagenti-system (← looks here, finds nothing) pod-mutator: "deliveryPaths":"skip","keycloakClientCredentialsSecretName":"", "injectClientRegistrationSidecar":false ## Fix Add a new template that creates keycloak-admin-secret in Release.Namespace (= kagenti-system in production installs). Sister to the existing per-agent-namespace secret in agent-namespaces.yaml. Both are needed today: the legacy sidecar path reads from the agent namespace; the operator-managed path reads from the operator namespace. Respects the existing keycloak.adminExistingSecret opt-out — when the operator provides a pre-created secret, we skip creating either. ## Why minimal vs. waiting for rossoctl#1422 rossoctl#1422 does a broader reshape (removes client-registration sidecar references, restructures agent-namespaces.yaml). That PR is open and unreviewed. This commit is the minimal change PR rossoctl#1507 needs to unblock operator-managed client registration; it cleanly stacks with rossoctl#1422 when that lands (both target the same file set but additive). Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
New Commits DetectedThe New HEAD: For maintainers: Please review the new changes and comment Security checklistBefore running E2E tests, verify the PR does NOT contain:
This is an automated security measure to prevent TOCTOU attacks |
Summary
Completes the three-PR authbridge per-plugin-config cutover started in
kagenti/kagenti-extensions#378
and continued in
kagenti/kagenti-operator#335.
This PR flips the kagenti Helm chart and backend ConfigMap generator
onto the per-plugin schema and pins the paired authbridge
(
v0.5.0-alpha.12) + kagenti-operator (v0.2.0-alpha.35) imagetags.
Schema rewrite
The chart previously emitted
authbridge-runtime-configwith thetop-level
inbound:/outbound:/identity:/bypass:blocks.Authbridge
v0.5.0-alpha.12rejects that shape (empty-pipeline guard— kagenti-extensions#378's open-proxy mitigation). This PR emits
pipeline.inbound.plugins[]+pipeline.outbound.plugins[]with oneentry each (
jwt-validation,token-exchange).Plugin-level defaults (
audience_file,bypass_paths, identity filepaths) are applied by the authbridge binary from its own convention
layer and are not emitted by the chart. See
authbridge/authlib/plugins/CONVENTIONS.md.
Files
charts/kagenti/templates/authbridge-template-configmaps.yaml—the release-namespace template the operator propagates to agent
namespaces that didn't come from the Helm chart.
charts/kagenti/templates/agent-namespaces.yaml— theper-agent-namespace copy written directly at install time.
kagenti/backend/app/routers/agents.py—_build_authbridge_runtime_yaml, used when the API creates anagent namespace through the UI.
kagenti/backend/tests/test_authbridge_runtime_config.py—assertions walk
pipeline.<direction>.plugins[<name>].configviaa small
_plugin_confighelper. Also asserts the absence offields that the plugin now defaults on its own (
bypass_paths,audience_file, identity file paths) so the chart→authbridgecontract stays honest over time.
Image pins (atomic cutover)
charts/kagenti/values.yaml:kagenti-operator-chart.controllerManager.container.image.tag0.2.0-alpha.340.2.0-alpha.35kagenti-operator-chart.defaults.images.envoyProxyauthbridge-envoy:v0.5.0-alpha.10authbridge-envoy:v0.5.0-alpha.12kagenti-operator-chart.defaults.images.authbridgeLightv0.5.0-alpha.10v0.5.0-alpha.12kagenti-operator-chart.defaults.images.proxyInitv0.5.0-alpha.10v0.5.0-alpha.12kagenti-operator-chart.defaults.images.spiffeHelperv0.5.0-alpha.10v0.5.0-alpha.12kagenti-operator-chart.defaults.images.clientRegistrationv0.5.0-alpha.10v0.5.0-alpha.12v0.5.0-alpha.12is the first authbridge-extensions releaserequiring the new schema.
v0.2.0-alpha.35is the firstkagenti-operator release whose webhook emits it. Both must bump
together — this PR is the atomic flip.
kagenti-webhook-chart(v0.4.0-alpha.9) is left alone; that chartbelongs to the legacy
envoy-with-processordeployment path anddoesn't touch authbridge's YAML schema.
Test plan
helm template charts/kagenti/renders both ConfigMaptemplates without errors; output parses as valid YAML and matches
the new schema.
_build_authbridge_runtime_yaml's outputshape for
spire_enabled=TrueandFalse.pytest kagenti/backend/tests/test_authbridge_runtime_config.py)— pending CI (local env missing the backend's deps; existing
backend tests have the same issue without a venv).
Pre-merge gate.
Rollout story
Once this merges:
cutover) points at the paired images.
helm upgrade; the operator's per-agentConfigMap replicates the new shape on the next pod admission
after an agent rollout.
authbridge-runtime-configConfigMaps intheir agent namespaces (bypassing the Helm chart) need to
migrate those manually — the chart's release-namespace template
stays as the reference shape.
Assisted-By: Claude (Anthropic AI) [email protected]