Skip to content

Docs(authbridge): add sidecar injection reference page - #2154

Merged
mrsabath merged 7 commits into
mainfrom
docs/authbridge-sidecar-injection
Jul 17, 2026
Merged

mrsabath merged 7 commits into
mainfrom
docs/authbridge-sidecar-injection

Conversation

@Alan-Cha

@Alan-Cha Alan-Cha commented Jul 7, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds docs/authbridge/sidecar-injection.md — a new user-facing reference page covering the AuthBridge injection model
  • Cross-references added in docs/authbridge/README.md and docs/authbridge/deployment-guide.md

Closes #1775

What's in the new page

  • Verify command — kubectl get pods -o jsonpath to list container names in running pods
  • Container table — maps each mode (proxy-sidecar, lite, envoy-sidecar, waypoint) to expected containers, with a callout that spiffe-helper is a bundled process (not a separate container)
  • Label vocabulary — pre-filter labels, per-sidecar opt-out labels, and the deprecated kagenti.io/authbridge-mode annotation, each with YAML examples
  • How to switch modes — full precedence chain (AgentRuntime CR → namespace ConfigMap → deprecated annotation → cluster default) with YAML for each layer
  • Feature gates table — globalEnabled, envoyProxy, injectTools, perWorkloadConfigResolution with defaults and link to source
  • Decision flow diagram — complete injection logic as an ASCII tree

Test plan

  • Verify docs/authbridge/sidecar-injection.md renders correctly on GitHub
  • Verify links in README.md and deployment-guide.md resolve correctly

Assisted-By: Claude Code

@Alan-Cha Alan-Cha added the ready-for-ai-review Request automated AI code review from clawgenti label Jul 7, 2026

@clawgenti clawgenti left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds the operator SPIFFE auth bootstrap Job and a well-written sidecar-injection.md reference page. Four issues found in the new Helm Job template that need attention before merge.

  • must-fix curlimages/curl:latest does not ship jq; the bootstrap script calls jq -sRr @uri to URL-encode the client ID (lines 157, 200) and will command not found at runtime. Use an image that includes both curl and jq (e.g. dwdraju/alpine-curl-jq or a custom image), or replace the jq call with a POSIX-safe URL encoder like python3 -c 'import urllib.parse,sys; print(urllib.parse.quote(sys.argv[1]))' "$OPERATOR_CLIENT_ID".
  • must-fix serviceAccountName: default — the Job reads keycloak-initial-admin secret in the keycloak namespace and makes admin API calls; the default SA almost certainly lacks get secret RBAC. Add a dedicated ServiceAccount + Role/RoleBinding granting get on secrets/keycloak-initial-admin in the keycloak namespace, or document that the operator is expected to pre-create this.
  • suggestion IDP existence check (step 2) only branches on 404; a 403 (token expired or insufficient scope) or 5xx will fall through to the "already exists" path and silently continue with a bad token. Add an explicit error branch: if [ "$IDP_HTTP_CODE" != "200" ] && [ "$IDP_HTTP_CODE" != "404" ]; then echo "ERROR..."; exit 1; fi.
  • suggestion spireTrustDomain: localtest.me is added as a new top-level key in values.yaml, but kagenti-operator-chart.signatureVerification.spireTrustDomain already fulfils the same role. The new key is referenced only inside the bootstrap Job template's OPERATOR_CLIENT_ID default. Consider referencing the existing nested key (.Values.kagentiOperator already reads .Values.spireTrustDomain) or consolidating to avoid two canonical locations for the same value.

Reviewed by clawgenti using github:pr-review

serviceAccountName: default
containers:
- name: bootstrap
image: {{ .Values.kagentiOperator.spiffeAuth.bootstrapImage | default "curlimages/curl:latest" }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

must-fix curlimages/curl:latest does not include jq. The bootstrap script uses jq -sRr @uri at lines 157 and 200 to URL-encode $OPERATOR_CLIENT_ID for the client search API call. This will fail with sh: jq: not found at runtime. Use an image that bundles both curl and jq, or replace the jq invocation with a POSIX-safe alternative (e.g. python3 -c 'import urllib.parse,sys; print(urllib.parse.quote(sys.argv[1]))' "$OPERATOR_CLIENT_ID" — python3 is available in most base images).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bootstrap Job does not use curlimages/curl. The image is operator-spiffe-bootstrap (Python) and the bootstrap logic lives in setup_operator_client.py, which uses the requests library — no jq involved.

app.kubernetes.io/component: operator-bootstrap
spec:
restartPolicy: OnFailure
serviceAccountName: default

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

must-fix serviceAccountName: default gives the Job the default SA in the keycloak namespace. The bootstrap script reads the keycloak-initial-admin Secret and makes Keycloak admin API calls — neither is permitted by the out-of-the-box default SA. Add a dedicated ServiceAccount + Role (granting get on secrets in the keycloak namespace) + RoleBinding, or at minimum document the required pre-existing RBAC.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Job already uses serviceAccountName: kagenti-operator-client-bootstrap with a dedicated ServiceAccount, Role (granting get on keycloak-initial-admin), and RoleBinding — all in the same template file, before the Job spec.

"$KEYCLOAK_URL/admin/realms/$KEYCLOAK_REALM/identity-provider/instances/$SPIFFE_IDP_ALIAS")
IDP_HTTP_CODE=$(echo "$IDP_RESPONSE" | tail -n1)

if [ "$IDP_HTTP_CODE" = "404" ]; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion Only 404 is treated as "not found"; a 401, 403, or 5xx response silently falls through to the else branch and prints "already exists", then continues with a token or config that is actually broken. Consider adding: elif [ "$IDP_HTTP_CODE" != "200" ]; then echo "ERROR: unexpected HTTP $IDP_HTTP_CODE checking IdP"; exit 1; fi.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Python script handles this at line 167: elif response.status_code != 404: logger.error(...) followed by raise. 401/403/5xx all propagate as exceptions and fail the Job.

Comment thread charts/kagenti/values.yaml Outdated
oidcDiscoveryURL: "http://spire-spiffe-oidc-discovery-provider.zero-trust-workload-identity-manager.svc:8080"

# Trust domain (used for SPIFFE IDs)
spireTrustDomain: localtest.me

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion spireTrustDomain: localtest.me is a new top-level key, but kagenti-operator-chart.signatureVerification.spireTrustDomain already exists for the same trust domain. Users setting one won't know to set the other. Consider pointing the Job template's OPERATOR_CLIENT_ID default at .Values.kagentiOperator.spiffeAuth.operatorClientID (already a settable value) or reusing kagenti-operator-chart.signatureVerification.spireTrustDomain via a Helm template helper to avoid two sources of truth.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid long-term cleanup — noted. Not blocking this PR. A follow-up should consolidate SPIFFE_TRUST_DOMAIN to derive from kagenti-operator-chart.signatureVerification.spireTrustDomain.

@Alan-Cha

Alan-Cha commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

Thanks for the thorough review! Quick clarification: this PR is intended to be docs-only (the new sidecar-injection.md page + cross-references). The Helm bootstrap Job changes you're seeing are from the source branch (feat/operator-spiffe-auth-v2) that hadn't been cleaned up yet — they belong in PR #2153, not here.

The branch needs a force-push to trim it to the single doc commit. Once that's done the four Helm issues won't apply here. I'll track them against #2153 where the bootstrap Job actually lives.

@Alan-Cha
Alan-Cha force-pushed the docs/authbridge-sidecar-injection branch from f5ccc35 to c139dab Compare July 15, 2026 18:22
@Alan-Cha

Copy link
Copy Markdown
Member Author

Rebased onto main. Responding to review comments:

must-fix 1 (curlimages/curl + jq): The bootstrap Job does not use curlimages/curl. The image is operator-spiffe-bootstrap (Python), and the bootstrap logic is in setup_operator_client.py which uses the requests library — no jq involved. The HTTP error handling is already present at line 167: elif response.status_code != 404: logger.error(...) with raise. Both the 401/403/5xx case and the 404-is-not-found case are handled.

must-fix 2 (serviceAccountName: default): The Job already uses serviceAccountName: kagenti-operator-client-bootstrap backed by a dedicated ServiceAccount, Role (granting get on keycloak-initial-admin), and RoleBinding — all in the same template file. This was addressed before the review.

suggestion (HTTP error handling): Already handled in the Python script as noted above.

suggestion (duplicate spireTrustDomain): Valid long-term cleanup. Filed as a separate concern — the SPIFFE_TRUST_DOMAIN env var on the bootstrap Job should be derived from kagenti-operator-chart.signatureVerification.spireTrustDomain rather than a separate top-level value. Not blocking this PR.

Added a link to authentication.md in deployment-guide.md for CLIENT_AUTH_TYPE=federated-jwt.

@Alan-Cha Alan-Cha changed the title 📖 docs(authbridge): add sidecar injection reference page 📖 Docs(authbridge): add sidecar injection reference page Jul 15, 2026

@clawgenti clawgenti left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs-only PR adding a well-structured sidecar-injection.md reference page with cross-references from the README and deployment guide. One suggestion in the deployment guide edit.

  • suggestion deployment-guide.md lines 45–54: the replacement text drops the canonical guidance that was in the removed note. The old callout told readers "All workloads should use an AgentRuntime CR" and named AgentRuntime.Spec.AuthBridgeMode as the canonical method. The new text only shows the deprecated annotation example, so readers who never see sidecar-injection.md lose the recommendation to migrate to the CR. Consider keeping one sentence pointing to the canonical path, e.g. "For workloads with an AgentRuntime CR, use AgentRuntime.Spec.AuthBridgeMode instead — the annotation is retained only for workloads without a CR."

Reviewed by clawgenti using github:pr-review

Comment thread docs/authbridge/deployment-guide.md Outdated
> The deprecated `kagenti.io/authbridge-mode` annotation is still honored
> but `AgentRuntime.Spec.AuthBridgeMode` is the canonical method.
The deprecated annotation is retained for tools and other workloads that
don't have their own AgentRuntime CR yet:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: The replacement text drops the canonical-method guidance from the removed note. The deleted callout told readers that AgentRuntime.Spec.AuthBridgeMode is the canonical path; this replacement only shows the deprecated annotation. Readers who land here without reading sidecar-injection.md will see no pointer to the preferred approach. Consider one bridging sentence, e.g.: "For workloads that have an AgentRuntime CR, set AgentRuntime.Spec.AuthBridgeMode instead — the annotation is retained only for workloads that do not yet have a CR."

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 601d8c5 — the 'Selecting a mode' section in deployment-guide.md now shows the correct 3-layer chain with the namespace ConfigMap as canonical, and includes a note clarifying that AgentRuntime.Spec.AuthBridgeMode is not read by the mutating webhook.

@clawgenti clawgenti left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs-only PR adding sidecar-injection.md with solid coverage of container expectations, label vocabulary, mode-switching, and feature gates.

Findings:

  • sidecar-injection.md line 57 (kagenti.io/spiffe-helper-inject description): Says "preventing the bundled spiffe-helper process from starting" — but lines 27–35 of the same file explicitly state "There is no spiffe-helper container or process" and describe SPIRE as in-process via the go-spiffe SDK. The label description contradicts the callout on the same page. Suggest aligning: e.g. "Suppress SPIRE integration — sets SPIRE_ENABLED=false on the sidecar, preventing the go-spiffe workload API source from being opened."

  • deployment-guide.md (existing header, unchanged in this PR): The opening section still says spiffe-helper is bundled inside every combined image and runs only when the operator sets SPIRE_ENABLED=true — inconsistent with the correction made in the final commit. Consider a follow-up to align deployment-guide.md's description with the new canonical wording in sidecar-injection.md.

  • PR title nit: 📖 Docs(authbridge): ... trips verify-pr-title; the verifier expects a bare prefix like Docs: or Docs(authbridge): without a leading emoji.


Reviewed by clawgenti using github:pr-review

Comment thread docs/authbridge/sidecar-injection.md Outdated
| Label | Default | Set to `false` to… |
|---|---|---|
| `kagenti.io/envoy-proxy-inject` | inject (when feature gate is on) | Disable the `envoy-proxy` sidecar (envoy-sidecar mode only) |
| `kagenti.io/spiffe-helper-inject` | inject (enabled) | Suppress SPIRE — sets `SPIRE_ENABLED=false` on the combined sidecar, preventing the bundled spiffe-helper process from starting |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistency with lines 27–35: This description says "preventing the bundled spiffe-helper process from starting," but the callout earlier in this file explicitly states "There is no spiffe-helper container or process" — AuthBridge uses the go-spiffe SDK directly. Suggest: "Suppress SPIRE integration — sets SPIRE_ENABLED=false on the sidecar, preventing the go-spiffe workload API source from being opened."

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in the prior commit — 'preventing the bundled spiffe-helper process from starting' → 'preventing the go-spiffe workload API source from being opened'.

Comment thread docs/authbridge/deployment-guide.md Outdated
> platform. The operator applies `kagenti.io/type` labels automatically.
> The deprecated `kagenti.io/authbridge-mode` annotation is still honored
> but `AgentRuntime.Spec.AuthBridgeMode` is the canonical method.
The deprecated annotation is retained for tools and other workloads that

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit / follow-up: The removed > **Note:** block contained canonical guidance ("All workloads should use an AgentRuntime CR") that is now only in sidecar-injection.md. That's fine for coverage, but note that the existing opening section of deployment-guide.md (unchanged in this PR) still describes spiffe-helper as a bundled binary that runs in-pod — inconsistent with the correction in the final commit. Worth a follow-up patch to deployment-guide.md's header to align with the new wording.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 601d8c5 — deployment-guide.md header now reads: 'SPIRE integration is built into every combined image using the go-spiffe SDK… there is no separate spiffe-helper binary or process.'

@mrsabath mrsabath left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Genuinely useful, well-structured reference page — the container-by-mode table, label vocabulary, and the ASCII decision tree fill a real gap (#1775), and the large majority of the technical claims check out against kagenti-operator source (all feature-gate names & defaults, every label string incl. the exact kagenti.io/spiffe-helper-inject, the opt-out semantics of kagenti.io/inject=disabled, the four mode values, SPIRE_ENABLED, the proxy-init container name, the ConfigMap/mode key/default in the resolution chain, and the feature_gates.go link — the doubled kagenti-operator/kagenti-operator path segment is actually correct, the repo has a nested subdir). Link Check CI passed too.

Three factual errors need fixing before merge, because this page is meant to be authoritative and an operator will act on it (inline comments below):

  1. Mode-precedence chain lists a 4th "canonical" AgentRuntime.Spec.AuthBridgeMode layer that the injection webhook never consults — it's a 3-layer chain.
  2. Feature-gates ConfigMap is misnamed (kagenti-webhook-config → kagenti-feature-gates).
  3. proxy-init is described as privileged when it's explicitly not.

Separately: the required verify-pr-title check is failing. The leading 📖 emoji pushes the Docs prefix off position 0, which the org ruleset rejects (allowed_prefixes must appear at the very start). Rename the PR title to Docs(authbridge): add sidecar injection reference page (drop the emoji) and it'll pass — the emoji is fine in the commit subject, just not the PR title.

Areas reviewed: Docs (accuracy vs kagenti-operator source, links), commit & PR conventions, CI
Commits: 4, all signed-off (DCO passed)
CI: verify-pr-title failing (emoji prefix); all other checks green

Thanks for writing this up, @Alan-Cha — it's a page the project needed. The fixes are all small string/precedence corrections.

Comment thread docs/authbridge/sidecar-injection.md Resolved
Comment thread docs/authbridge/sidecar-injection.md Resolved
Comment thread docs/authbridge/sidecar-injection.md Resolved
@Alan-Cha

Copy link
Copy Markdown
Member Author

Addressed all comments in 18dbfb3. Summary:

must-fix (proxy-init privileged): Corrected — proxy-init runs as root (UID 0) with NET_ADMIN/NET_RAW only; Privileged: false per BuildProxyInitContainer. Verified in container_builder.go:435-449.

must-fix (mode precedence — AgentRuntime not in injection chain): Corrected. The mutating webhook resolves mode from 3 layers only: namespace ConfigMap → deprecated annotation → cluster default. AgentRuntime.Spec.AuthBridgeMode is enum-validated by the CRD webhook but explicitly excluded from the config that drives injection (agentruntime_config.go:79). The doc now reflects the actual 3-layer chain and adds a note explaining the field is validated but not wired into injection. The misleading "Per-workload override (AgentRuntime CR)" section has been removed.

must-fix (feature gates ConfigMap name): Corrected — kagenti-feature-gates, not kagenti-webhook-config. Verified at agentruntime_config.go:38.

inconsistency (spiffe-helper process): Corrected — "preventing the bundled spiffe-helper process from starting" → "preventing the go-spiffe workload API source from being opened".

nit (deployment-guide.md header): Corrected — replaced "spiffe-helper is bundled inside every combined image" with accurate go-spiffe SDK description.

suggestion (deployment-guide.md deprecated annotation): The replacement sentence now points to the namespace ConfigMap as the canonical replacement, not AgentRuntime CR (since AuthBridgeMode doesn't affect injection).

older must-fix comments (curlimages/curl, serviceAccountName: default, HTTP error handling): These remain addressed as noted in the prior comment — the bootstrap image is a Python script (operator-spiffe-bootstrap), not curlimages/curl; the dedicated SA/Role/RoleBinding are already in the template; and the Python script already handles non-200/404 responses at line 167.

Alan-Cha added 5 commits July 15, 2026 23:38
Documents the label vocabulary, per-mode container expectations,
feature gates, and mode-switching precedence chain. Resolves #1775.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
…ed-jwt

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
…DK, not spiffe-helper process

AuthBridge uses workloadapi.JWTSource from the go-spiffe SDK directly.
The /opt SVID files are written by a goroutine inside AuthBridge itself,
not by a separate spiffe-helper binary or process.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
…t-guide

sidecar-injection.md:
- proxy-init is not privileged — runs as root (UID 0) with NET_ADMIN/NET_RAW only
- kagenti.io/spiffe-helper-inject description: go-spiffe workload API source,
  not a spiffe-helper process
- Mode resolution chain: remove AgentRuntime.Spec.AuthBridgeMode — the mutating
  webhook does not read this field; actual chain is 3 layers (namespace CM →
  annotation → default). Add note clarifying the field is validated but not wired.
- Feature gates ConfigMap: kagenti-feature-gates, not kagenti-webhook-config
- Decision flow diagram and label table: remove spiffe-helper process references

deployment-guide.md:
- Header: replace spiffe-helper bundled binary description with go-spiffe SDK
- Deprecated annotation section: point to namespace ConfigMap as the replacement,
  not AgentRuntime CR (which does not affect injection mode)

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
@Alan-Cha
Alan-Cha force-pushed the docs/authbridge-sidecar-injection branch from 18dbfb3 to abcc444 Compare July 16, 2026 03:38

@clawgenti clawgenti left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation-only PR adding a well-structured sidecar injection reference page with clear label vocabulary, container tables, and decision flow. Two internal contradictions in the new/updated content need to be addressed before merge.


Reviewed by clawgenti using github:pr-review

namespace `authbridge-runtime-config` ConfigMap instead — it is the canonical
way to set mode and applies to all workloads in the namespace:

```yaml

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: The prose says to use the namespace authbridge-runtime-config ConfigMap as the canonical replacement for the deprecated annotation, but the YAML example immediately below (lines 51–57) demonstrates the annotation (kagenti.io/authbridge-mode) — the thing being deprecated. The example should instead show the ConfigMap (kind: ConfigMap, name: authbridge-runtime-config, data.mode: envoy-sidecar) to match the guidance in the prose.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 71603f4 — the YAML example now shows the ConfigMap shape (data.config.yaml) matching the prose.

Comment thread docs/authbridge/sidecar-injection.md Outdated

| Annotation | Status | Replacement |
|---|---|---|
| `kagenti.io/authbridge-mode` | **Deprecated** — still honored | Use `AgentRuntime.Spec.AuthBridgeMode` |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: The deprecated label table lists AgentRuntime.Spec.AuthBridgeMode as the replacement for kagenti.io/authbridge-mode, but the "How to switch modes" section below (the note at lines 92–95) explicitly clarifies that AgentRuntime.Spec.AuthBridgeMode is not read by the mutating webhook and does not affect injection. The replacement column should point to the namespace authbridge-runtime-config ConfigMap instead, consistent with the mode-resolution chain described in this same document.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed — the deprecated annotation table now reads: 'Set mode: in the namespace authbridge-runtime-config ConfigMap'.

@Alan-Cha Alan-Cha changed the title 📖 Docs(authbridge): add sidecar injection reference page Docs(authbridge): add sidecar injection reference page Jul 16, 2026

@mrsabath mrsabath left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

This is an unusually well-researched reference page — I verified the technical claims against the kagenti-operator webhook source and nearly all of them are correct:

  • Container names — authbridge-proxy, envoy-proxy, proxy-init ✅ (injector/constants.go, injector/container_builder.go)
  • Modes — proxy-sidecar (default), lite, envoy-sidecar, waypoint, incl. the lite = "auth-only, same shape" note ✅ (constants.go)
  • Feature gates — globalEnabled/envoyProxy/injectTools/perWorkloadConfigResolution names + defaults (true/true/false/false) ✅ (config/feature_gates.go), including the literal-vs-valueFrom behavior
  • Pre-filter + per-sidecar labels — kagenti.io/type, kagenti.io/inject=disabled, kagenti.io/envoy-proxy-inject, kagenti.io/spiffe-helper-inject, opt-out semantics ✅ (pod_mutator.go, precedence.go)
  • SPIRE narrative — in-process go-spiffe, socket /spiffe-workload-api/spire-agent.sock, /opt/*.pem written by the combined image ✅ (container_builder.go)
  • feature_gates.go link path ✅ resolves

Two things would mislead a reader who follows the page verbatim, so requesting changes:

  1. ConfigMap example is inert — the "Namespace default" example sets mode: as a direct data key, but the webhook only reads data["config.yaml"] and parses mode: from inside that YAML string (injector/namespace_config.go ExtractMode). As written the example changes nothing.
  2. Self-contradiction on the deprecated annotation — the "Deprecated label" table gives the replacement as AgentRuntime.Spec.AuthBridgeMode, but this same page (and constants.go) state the webhook does not read that field. The canonical replacement is the namespace ConfigMap — which is also what the sibling deployment-guide.md edit in this PR correctly says.

Details inline. One optional suggestion about the kagenti.io/spire label too.

Areas reviewed: Docs (accuracy vs kagenti-operator source, cross-file consistency), Commit/PR conventions
Commits: 5 commits, all signed-off (DCO passes)
CI status: all green (Link Check, Markdown Lint incl.)
Verdict: REQUEST_CHANGES — 2 must-fix; the rest of the page is accurate and can stay.

Comment thread docs/authbridge/sidecar-injection.md Resolved
Comment thread docs/authbridge/sidecar-injection.md Resolved
# Keep injection but disable SPIRE
metadata:
labels:
kagenti.io/spiffe-helper-inject: "false"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (completeness): the operator also recognizes kagenti.io/spire=disabled as a SPIRE opt-out, separate from kagenti.io/spiffe-helper-inject (see pod_mutator.go SpireEnableLabel/SpireDisabledValue). Since this section is about disabling SPIRE, worth a line noting both labels so operators aren't surprised that either one suppresses it. Not blocking.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked the source: SpireEnableLabel = "kagenti.io/spire" and SpireDisabledValue = "disabled" are defined as constants in pod_mutator.go but are never referenced in any evaluation path — not in precedence.go or anywhere else in the webhook. Setting this label has no effect. Left out of the docs to avoid misleading operators; if it should be wired in, that is a separate implementation task.

…el replacement

sidecar-injection.md:
- ConfigMap must use data.config.yaml key, not data.mode — the webhook reads
  cm.Data["config.yaml"] and calls ExtractMode on the YAML content inside
- Deprecated annotation table: replacement is namespace ConfigMap, not
  AgentRuntime.Spec.AuthBridgeMode (which is not read by the mutating webhook)

deployment-guide.md:
- Replace deprecated annotation YAML example with a correct ConfigMap example,
  matching the prose that already points to the ConfigMap as the replacement

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
@Alan-Cha

Copy link
Copy Markdown
Member Author

Fixed in 71603f4.

must-fix (ConfigMap shape): Corrected — the webhook reads cm.Data["config.yaml"] and calls ExtractMode on the YAML string inside. A top-level data.mode key is never consulted. Both sidecar-injection.md and deployment-guide.md now show the correct shape:

data:
  config.yaml: |
    mode: proxy-sidecar

must-fix (deprecated annotation replacement): Corrected — both the deprecated label table in sidecar-injection.md and the YAML example in deployment-guide.md now point to the namespace ConfigMap, not AgentRuntime.Spec.AuthBridgeMode.

suggestion (deployment-guide.md annotation YAML): Fixed — replaced the annotation example with a ConfigMap example to match the prose.

suggestion (kagenti.io/spire=disabled): I checked the source — SpireEnableLabel = "kagenti.io/spire" and SpireDisabledValue = "disabled" are defined as constants in pod_mutator.go but are never referenced in any evaluation path (not in precedence.go, not in pod_mutator.go's evaluation logic). Setting this label has no effect. I'm leaving it out of the docs to avoid misleading operators. If it should be wired in, that's a separate implementation task.

@clawgenti clawgenti left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation is clear and well-structured, covering container shapes, label vocabulary, feature gates, and the injection decision flow.

Finding: The "Selecting a mode" section in deployment-guide.md (line 28) still lists AgentRuntime.Spec.AuthBridgeMode as item #1 / canonical in the precedence chain, but the new text added by this PR (lines 47–49) declares the namespace ConfigMap as canonical, and sidecar-injection.md (lines 92–95) explicitly states that AgentRuntime.Spec.AuthBridgeMode is not read by the webhook and does not affect injection. The "Selecting a mode" section in deployment-guide.md was not updated to match, leaving the guide self-contradictory.


Reviewed by clawgenti using github:pr-review

Comment thread docs/authbridge/deployment-guide.md Outdated
> platform. The operator applies `kagenti.io/type` labels automatically.
> The deprecated `kagenti.io/authbridge-mode` annotation is still honored
> but `AgentRuntime.Spec.AuthBridgeMode` is the canonical method.
The deprecated annotation is retained for backward compatibility. Use the

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The text immediately above (the "Selecting a mode" precedence chain, line 28) still lists AgentRuntime.Spec.AuthBridgeMode as item #1 / canonical, but this new paragraph declares the namespace ConfigMap canonical instead. sidecar-injection.md (lines 92–95 added by this PR) clarifies that AgentRuntime does not affect injection at all. The "Selecting a mode" list in this file was not updated — consider removing or demoting the AgentRuntime entry (or adding a note matching sidecar-injection.md) to avoid the contradiction.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 601d8c5 — the 'Selecting a mode' section now shows the correct 3-layer chain (namespace ConfigMap canonical, deprecated annotation, cluster default) and the AgentRuntime YAML example has been removed.

@Alan-Cha Alan-Cha left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR adds a new reference page (sidecar-injection.md) for AuthBridge injection behaviour, corrects two inaccuracies in deployment-guide.md (SPIRE is go-spiffe in-process, not a separate binary; the namespace ConfigMap is canonical for mode, not AgentRuntime.Spec.AuthBridgeMode), and updates cross-references in README.md. The corrections are improvements — the old docs were misleading on both counts. The new page is well-structured and technically precise.

Author: Alan-Cha (MEMBER — maintainer)
Areas reviewed: Docs
Agent/IDE config (.claude/.vscode): none
Commits: 6 commits, all signed-off ✅
CI status: all 22 checks passing ✅

(Cannot self-approve — posting as COMMENT. Verdict would be APPROVE.)

Comment thread docs/authbridge/deployment-guide.md Outdated
### Proxy Not Injected

1. Verify the workload has an AgentRuntime CR targeting it (the operator applies the `kagenti.io/type` label automatically)
1. Verify the pod has `kagenti.io/type: agent` label

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: This is more direct than the old step, but a reader unfamiliar with the platform may wonder how kagenti.io/type: agent gets set. The causal link (AgentRuntime reconciler) exists in sidecar-injection.md but isn't visible here.

Consider:

1. Verify the pod has `kagenti.io/type: agent` label — the operator sets this when an AgentRuntime CR targets the workload

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 601d8c5 — step 1 now reads: 'Verify the pod has kagenti.io/type: agent label — the operator sets this automatically when an AgentRuntime CR targets the workload'.

Comment thread docs/authbridge/sidecar-injection.md Outdated
| Mode | Regular containers | Init containers | Notes |
|---|---|---|---|
| `proxy-sidecar` (default) | `<agent>` `authbridge-proxy` | — | SPIRE integration is in-process inside `authbridge-proxy` when `SPIRE_ENABLED=true` |
| `lite` | `<agent>` `authbridge-proxy` | — | Same shape as proxy-sidecar; uses `authbridge-lite` image (auth-only) |

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: The proxy-sidecar and envoy-sidecar rows both note SPIRE integration in-process, but the lite row is silent on SPIRE. The callout below says "every combined image" — does authbridge-lite count as a combined image?

  • If yes (SPIRE in-process when SPIRE_ENABLED=true), add a note matching the other rows.
  • If no (auth-only with no SPIRE support), make that explicit — e.g. "No SPIRE integration" — so readers don't have to infer it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

authbridge-lite is the same binary as authbridge-proxy, just built with a reduced plugin set (jwt-validation + token-exchange, no protocol parsers). The go-spiffe SPIRE integration is present and enabled when SPIRE_ENABLED=true. Fixed the table row to note this explicitly.

…hint

deployment-guide.md:
- Selecting a mode: fix 4-layer chain to match actual 3-layer webhook logic;
  remove AgentRuntime CR YAML example (field not read by mutating webhook);
  add note explaining AgentRuntime.Spec.AuthBridgeMode is validated but not wired
- Proxy Not Injected: note that kagenti.io/type is set by the operator when an
  AgentRuntime CR targets the workload

sidecar-injection.md:
- lite row: authbridge-lite is the same binary so SPIRE is in-process when
  SPIRE_ENABLED=true — note this explicitly

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Alan Cha <[email protected]>

@clawgenti clawgenti left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation-only PR adding sidecar-injection.md and correcting deployment-guide.md. All previously-requested changes have been addressed: the ConfigMap example now correctly uses data.config.yaml, the mode-resolution chain is the correct 3-layer form with the namespace ConfigMap as canonical, and the kagenti.io/spiffe-helper-inject description is consistent with the go-spiffe in-process narrative.

All checks pass. Ready for human review.


Reviewed by clawgenti using github:pr-review

@clawgenti clawgenti left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation-only PR adding sidecar-injection.md and correcting deployment-guide.md. All previously-requested changes have been addressed: the ConfigMap example correctly uses data.config.yaml, the mode-resolution chain is the correct 3-layer form with the namespace ConfigMap as canonical, the kagenti.io/spiffe-helper-inject description is consistent with the go-spiffe in-process narrative, and all 22 CI checks pass.

All checks pass. Ready for human review.


Reviewed by clawgenti using github:pr-review

@mrsabath mrsabath left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review — all must-fixes resolved ✅

Re-reviewed at 601d8c5. The two blocking issues from my last round are fixed correctly, and the earlier round's must-fixes remain correct — verified against kagenti-operator source:

  • ✅ ConfigMap example now uses data.config.yaml: | mode: … — matches how the webhook actually reads it (injector/namespace_config.go reads cm.Data["config.yaml"], then ExtractMode parses the top-level mode:).
  • ✅ Deprecated-annotation replacement now points at the namespace authbridge-runtime-config ConfigMap instead of the injection-ignored AgentRuntime.Spec.AuthBridgeMode. No longer self-contradictory.
  • ✅ Bonus: you generalized the fix to deployment-guide.md — its mode chain now correctly reads ConfigMap → annotation → default with a note that the mutating webhook doesn't read the CR field. That file's old "AgentRuntime CR (canonical)" step 1 was a latent version of the same bug; good catch.
  • ✅ Still correct from the earlier round: kagenti-feature-gates ConfigMap name, and the proxy-init "runs as root (UID 0) with NET_ADMIN/NET_RAW — not privileged" wording.
  • ✅ lite row now notes in-process SPIRE parity with the other modes.

The rest of the page remains accurate against the operator webhook source (container names, all four modes, feature-gate names/defaults, label vocabulary, SPIRE socket path). Nicely researched reference page.

My earlier kagenti.io/spire completeness note was non-blocking — leaving it to your discretion.

Areas reviewed: Docs (accuracy vs kagenti-operator source, cross-file consistency), Commit/PR conventions
Commits: 7 commits, all signed-off (DCO passes)
CI status: all green
Verdict: APPROVE

@mrsabath
mrsabath enabled auto-merge July 16, 2026 20:22
@mrsabath
mrsabath disabled auto-merge July 17, 2026 01:15
@mrsabath
mrsabath merged commit 59d7568 into main Jul 17, 2026
23 checks passed
@github-project-automation github-project-automation Bot moved this from New/ToDo to Done in Rossoctl Issue Prioritization Jul 17, 2026
@evaline-ju
evaline-ju deleted the docs/authbridge-sidecar-injection branch August 12, 2026 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-ai-review Request automated AI code review from clawgenti

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

docs(authbridge): document sidecar injection modes and label model

3 participants