Repository navigation
chore: Remove deprecated Agent CR webhook and kagenti/operator dependency - #157
Conversation
…ency Closes rossoctl#151 Removes the deprecated Agent CR webhook (agent.kagenti.dev/v1alpha1) that was kept for backward compatibility but is no longer needed now that the AuthBridge webhook is the sole injection path. Changes: - Delete agent_webhook.go and all Agent webhook registration code - Delete namespace_checker.go (only used by deprecated injection path) - Remove deprecated PodMutator methods: ShouldMutate, NeedsMutation, InjectSidecars, InjectSidecarsWithSpireOption, InjectInitContainers, InjectVolumes, InjectVolumesWithSpireOption - Drop github.com/kagenti/operator require + replace from go.mod (was only needed for Agent CRD types) - Delete Helm agent-mutatingwebhook.yaml and agent-validatingwebhook.yaml - Remove Agent entries from config/webhook/manifests.yaml and PROJECT - Empty config/crd/kustomization.yaml resources (no CRDs remain) - Remove Agent validating webhook CA injection test from e2e suite - Update CLAUDE.md, README.md, and ARCHITECTURE.md to reflect the single-webhook AuthBridge-only architecture Co-Authored-By: Claude Sonnet 4.6 <[email protected]> Signed-off-by: cwiklik <[email protected]>
pdettori
left a comment
There was a problem hiding this comment.
Review Summary
Clean, thorough removal of the deprecated Agent CR webhook and all supporting code. The PR follows the removal checklist that was previously documented in kagenti-webhook/CLAUDE.md. All 18 files are consistent — Go code, Helm templates, kustomize config, kubebuilder PROJECT file, tests, and documentation are all updated in lockstep.
Areas reviewed: Go, Helm/K8s, Config (kustomize/PROJECT), Tests, Documentation
Commits: 1 commit, signed-off ✓ (DCO passing)
CI status: CI Checks pass, DCO pass
Net change: −889 lines
Suggestion
charts/kagenti-webhook/templates/authbridge-mutatingwebhook.yaml:36 — Stale comment (outside this diff but newly stale as a result of it):
# This aligns with NeedsMutation() which requires kagenti-enabled: true
NeedsMutation() is deleted by this PR. Consider updating to reference InjectAuthBridge() or removing the function reference in a follow-up.
Nit
kagenti-webhook/config/webhook/manifests.yaml — The kustomize config also lost timeoutSeconds: 10 and the namespaceSelector block alongside the Agent webhook entries. Verified this is safe since the Helm chart (authbridge-mutatingwebhook.yaml) provides both values. Just flagging for awareness.
…ok manifest
The previous commit accidentally removed timeoutSeconds: 10 and the
namespaceSelector block from the AuthBridge webhook entry in
config/webhook/manifests.yaml when deleting the Agent webhook entries.
These fields belong to the AuthBridge webhook and were not part of the
Agent webhook cleanup.
Also fixes a pre-existing indentation bug: matchExpressions was at the
same indent level as namespaceSelector (invalid LabelSelector YAML);
it is now correctly nested under namespaceSelector.
Removed the ${NAMESPACE} template variable from the exclusion list as
it is not a valid static YAML value (the Helm chart handles this via
its own template).
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Signed-off-by: cwiklik <[email protected]>
NeedsMutation() was removed as part of the Agent webhook deprecation cleanup. Update the comment to reference the precedence evaluator Layer 3 instead. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> Signed-off-by: cwiklik <[email protected]>
Add agent/policy_rules_builder/diagnostic.py: a parallel diagnostic graph (START->seed->propose->precheck->audit_diagnostic->{explain|retry|END}) that reuses the live proposer/precheck/_structured_call unchanged but seeds policy_text from input (no file read), RECORDS genuine contradictions instead of raising, marks non-converging entities unevaluated, and adds a terminal explain node. The explain node classifies kind in {direct, coarse_scope} (D11), extracts verbatim granting/prohibiting quotes validated by a whitespace-normalized substring check, and does the name->id join + run-direction tagging (D12). On quote-validation failure the conflict is kept with quotes_verified=false and the auditor description as fallback.
Adds build_explain_messages to prompts.py (append-only). Exposes run_role_diagnostic / run_scope_diagnostic per-entity entry points returning DiagnosticResult(conflicts, unevaluated) for the survey use-case to fan out over. The live graph.py is byte-for-byte unedited; the live /apply -> 422 path is untouched (D14).
Refs #157. Part of #154.
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Anatoly Koyfman <[email protected]>
Summary
agent.kagenti.dev/v1alpha1) and all supporting code now that the AuthBridge webhook is the sole injection pathgithub.com/kagenti/operatormodule dependency (require + replace directive) fromgo.modagent_webhook.go,namespace_checker.go, and seven deprecatedPodMutatormethods (ShouldMutate,NeedsMutation,InjectSidecars,InjectSidecarsWithSpireOption,InjectInitContainers,InjectVolumes,InjectVolumesWithSpireOption)Closes #151
Changes
agent_webhook.go,namespace_checker.go; remove deprecatedPodMutatormethodscmd/main.goandwebhook_suite_test.goagent-mutatingwebhook.yamlandagent-validatingwebhook.yamltemplatesconfig/webhook/manifests.yamlandPROJECTconfig/crd/kustomization.yamlresources (no CRDs remain)github.com/kagenti/operatorrequire + replace directiveCLAUDE.md,README.md,ARCHITECTURE.mdto reflect single AuthBridge-only architectureNet change: -889 lines (939 deleted, 50 added)
Test plan
go build ./...— cleango test -race -count=1 ./...— all passgo vet ./...— cleanstaticcheck ./...— no new findingsgolangci-lint run ./...— no findings in changed files🤖 Generated with Claude Code