Repository navigation
docs(authbridge): document sidecar injection labels and feature gates - #1782
Conversation
huang195
left a comment
There was a problem hiding this comment.
Summary
Solid, well-sourced doc, Mariusz — you even tracked down precedence.go and nailed the tricky kagenti.io/spire "layer 7" label. Dobra robota! 👏 I verified every label, the opt-out semantics, and the ConfigMap name/namespace/key against the live kagenti-operator source — all correct.
One blocker before merge: the feature-gates YAML example invents three keys that don't exist in the operator (spiffeHelper, clientRegistration, combinedSidecar) and omits the two real ones (perWorkloadConfigResolution, skillImageVolumes). For a page that markets itself as "sourced directly from the production paths, so it stays consistent with reality"... mamma mia, that phantom spiffeHelper kill switch has to go. 😄 Two small suggestions alongside it. Fix the gate list and this is an easy approve. 🟢
Areas reviewed: Docs (accuracy vs kagenti-operator source), commit/PR conventions, CI
Commits: 1, signed-off: yes
CI status: all green
| globalEnabled: true # kill switch — false disables ALL injection | ||
| injectTools: false # tool workloads are not injected by default | ||
| envoyProxy: true # per-sidecar enable | ||
| spiffeHelper: true |
There was a problem hiding this comment.
🛑 must-fix — these keys don't exist in the operator. The real FeatureGates struct (internal/webhook/config/feature_gates.go) and the chart (charts/kagenti-operator/values.yaml) ship exactly:
globalEnabled, envoyProxy, injectTools, perWorkloadConfigResolution, skillImageVolumesspiffeHelper— not a gate at all. spiffe-helper is controlled by thekagenti.io/spirelabel + theSPIRE_ENABLEDenv var (the struct comment says so explicitly).spiffeHelper: falsehere is a silent no-op — an admin would think they have a kill switch and they don't.clientRegistration/combinedSidecar— no such keys exist.
Also missing the two real gates perWorkloadConfigResolution and skillImageVolumes. Swap in the real five and we're golden.
| | `kagenti.io/spire` | (allow) | Set to `disabled` to skip `spiffe-helper` (no SPIFFE identity / JWT-SVID for this workload). | | ||
| | `kagenti.io/envoy-proxy-inject` | (allow) | Set to `false` to skip `envoy-proxy` (and the `proxy-init` init container) in envoy-sidecar mode. | | ||
| | `kagenti.io/spiffe-helper-inject` | (allow) | Set to `false` to skip the `spiffe-helper` sidecar. | | ||
| | `kagenti.io/client-registration-inject` | (skip) | Set to `true` to opt back into the legacy in-pod client-registration sidecar. | |
There was a problem hiding this comment.
suggestion — small accuracy nit on what this label actually does. Per internal/clientreg/names.go (SkipReason), client-registration-inject=true doesn't inject anything — it tells the operator to stand down from operator-managed registration (the in-pod decision struct dropped client-registration entirely; nothing injects a sidecar). "opt back into the legacy in-pod sidecar" / "can still be requested" (also the intro paragraph ~line 83) overstates it.
Suggest: "disables operator-managed registration for this workload (for workloads that supply their own legacy registration)."
| combinedSidecar: false | ||
| ``` | ||
|
|
||
| Workload-level labels are evaluated against these gates: a sidecar is |
There was a problem hiding this comment.
suggestion — true for envoy-proxy, but spiffe-helper has no cluster feature gate (only the kagenti.io/spire label + SPIRE_ENABLED; see precedence.go evaluateSpiffeHelper, which skips the feature-gate layer). "both the cluster gate and the workload label" doesn't hold for spiffe-helper. Once the gate list above is fixed, worth noting envoy-proxy is the only per-sidecar cluster gate.
|
@huang195 you're right — the doc is sourced against Going with your suggestion plus a follow-up:
Does that work for you? |
Add a "Verifying and Tuning Sidecar Injection" section to deployment-guide.md covering: - A kubectl one-liner to inspect a pod's containers and injection labels - A "containers per mode + label combination" table answering the recurring "why am I seeing 3/3 instead of 2/2?" question - The current opt-out label vocabulary (kagenti.io/inject, kagenti.io/spire, kagenti.io/envoy-proxy-inject, kagenti.io/spiffe-helper-inject, kagenti.io/client-registration-inject) with defaults and effects, sourced from kagenti-operator's pod_mutator.go and precedence.go - The cluster-admin feature-gates ConfigMap (globalEnabled, injectTools, per-sidecar gates) so cluster operators can find the global controls Mode coverage (proxy-sidecar / envoy-sidecar / waypoint) and configuration reference are unchanged. Fixes #1775 Signed-off-by: Mariusz Sabath <[email protected]> Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Mariusz Sabath <[email protected]>
4b3d96d to
8f109a0
Compare
|
@huang195 thanks for the careful read — 一针见血 (yī zhēn jiàn xiě, "one needle, sees blood" → straight to the point). You saved this PR from landing on Quick status:
For completeness, I weighed three other paths before going with yours: (1) one combined doc with 0.6/0.7 columns on |
huang195
left a comment
There was a problem hiding this comment.
Correction — this supersedes my earlier CHANGES_REQUESTED
Mariusz, the apology is mine — my previous review was wrong, and the mistake was a good one to catch. 🙇 I verified the feature-gate keys against kagenti-operator main, but this PR targets release-0.6, which pins operator v0.2.0-rc.6. On main, spiffeHelper / clientRegistration / combinedSidecar were removed; at v0.2.0-rc.6 they all still exist:
// internal/webhook/config/feature_gates.go @ v0.2.0-rc.6
type FeatureGates struct {
GlobalEnabled, EnvoyProxy, SpiffeHelper, ClientRegistration,
InjectTools, PerWorkloadConfigResolution, CombinedSidecar bool
}
// DefaultFeatureGates: SpiffeHelper/ClientRegistration default true, CombinedSidecar falseSo for this branch everything in the doc checks out:
- Feature-gate YAML —
spiffeHelper,clientRegistration,combinedSidecarare all real gates at rc.6. ✅ (OnlyperWorkloadConfigResolutionis omitted from the example — fine for an illustrative admin snippet.) client-registration-inject=true—precedence.go'sevaluateClientRegistrationopts into the legacy in-pod sidecar, exactly as the doc says. ✅- "both the cluster gate and the workload label" — at rc.6 spiffe-helper is feature-gated (
evaluateSidecar("spiffe-helper", featureGates.SpiffeHelper, …)), so the statement holds. ✅ - Labels, opt-out semantics, ConfigMap name/namespace/key — already verified, unchanged.
Dobra robota — the doc is accurate for release-0.6. Disregard my earlier comments; they applied to main, not this branch.
Areas reviewed: docs accuracy vs kagenti-operator v0.2.0-rc.6 (the release-0.6-pinned version), commit/PR conventions, CI
Commits: 1, signed-off: yes
CI status: green at last check
Summary
Adds a new Verifying and Tuning Sidecar Injection section to
docs/authbridge/deployment-guide.mdthat closes the documentation gap surfaced in #1775. The existing mode coverage (proxy-sidecar / envoy-sidecar / waypoint) is unchanged — this PR adds the label model on top of it.Why
A user following the basic weather-agent demo today sees
3/3 Runningcontainers (agent envoy-proxy spiffe-helper) but the demo's verification step claims2/2. There is no canonical page that explains:kagenti.io/inject,kagenti.io/spire, and per-sidecar*-injectlabels do.This PR makes that information discoverable from one section, sourced directly from
kagenti-operator/internal/webhook/injector/pod_mutator.goandprecedence.go(the production paths), so it stays consistent with reality.What's new
The new section contains:
kubectlone-liner to print containers + labels for a workload.2/2vs3/3cases users actually see, including thekagenti.io/inject=disabledopt-out.kagenti-feature-gatesConfigMap (globalEnabled,injectTools, per-sidecar gates).Cross-references the operator's webhook source so future changes to the precedence chain stay in sync.
Test plan
make lint, secret detection, attribution).kagenti-operator/internal/webhook/injector/pod_mutator.go(SpireEnableLabel,AuthBridgeInjectLabel) andprecedence.go(evaluateSpiffeHelper,evaluateSidecar) at v0.2.0-rc.5.kubectl get pod -n team1 -l app.kubernetes.io/name=weather-service -o jsonpath='{.items[0].spec.containers[*].name}'returnsagent envoy-proxy spiffe-helperwith the default Helm install.Fixes #1775