Skip to content

chore: Remove deprecated Agent CR webhook and kagenti/operator dependency - #157

Merged
cwiklik merged 3 commits into
rossoctl:mainfrom
cwiklik:chore/remove-agent-webhook
Mar 2, 2026
Merged

cwiklik merged 3 commits into
rossoctl:mainfrom
cwiklik:chore/remove-agent-webhook

Conversation

@cwiklik

@cwiklik cwiklik commented Feb 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Removes the deprecated Agent CR webhook (agent.kagenti.dev/v1alpha1) and all supporting code now that the AuthBridge webhook is the sole injection path
  • Drops the github.com/kagenti/operator module dependency (require + replace directive) from go.mod
  • Deletes dead code: agent_webhook.go, namespace_checker.go, and seven deprecated PodMutator methods (ShouldMutate, NeedsMutation, InjectSidecars, InjectSidecarsWithSpireOption, InjectInitContainers, InjectVolumes, InjectVolumesWithSpireOption)

Closes #151

Changes

Area Change
Go Delete agent_webhook.go, namespace_checker.go; remove deprecated PodMutator methods
Go Remove Agent scheme registration from cmd/main.go and webhook_suite_test.go
Helm Delete agent-mutatingwebhook.yaml and agent-validatingwebhook.yaml templates
Config Remove Agent entries from config/webhook/manifests.yaml and PROJECT
Config Empty config/crd/kustomization.yaml resources (no CRDs remain)
go.mod Drop github.com/kagenti/operator require + replace directive
Tests Remove Agent validating webhook CA injection test from e2e suite
Docs Update CLAUDE.md, README.md, ARCHITECTURE.md to reflect single AuthBridge-only architecture

Net change: -889 lines (939 deleted, 50 added)

Test plan

  • go build ./... — clean
  • go test -race -count=1 ./... — all pass
  • go vet ./... — clean
  • staticcheck ./... — no new findings
  • golangci-lint run ./... — no findings in changed files
  • All pre-commit hooks pass (go-fmt, go-vet, go-mod-tidy, trailing-whitespace, check-yaml)

🤖 Generated with Claude Code

…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 pdettori 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.

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.

cwiklik and others added 2 commits March 2, 2026 11:41
…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]>
@cwiklik
cwiklik merged commit 349d7af into rossoctl:main Mar 2, 2026
3 checks passed
anatolykoyfman added a commit that referenced this pull request Aug 26, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

chore: Remove deprecated Agent CR webhook from Helm chart and codebase

2 participants