Repository navigation
chore: Remove deprecated MCPServer (Toolhive) webhook - #155
Conversation
MCPServer CR (toolhive.stacklok.dev/v1alpha1) is no longer supported.
This removes all related webhook code, Helm templates, and the external
toolhive dependency.
Changes:
- Delete internal/webhook/v1alpha1/mcpserver_webhook.go and _test.go
- Remove toolhive scheme registration and MCPServer setup from cmd/main.go
- Remove toolhive scheme from webhook_suite_test.go
- Drop github.com/stacklok/toolhive from go.mod (go mod tidy)
- Delete charts/kagenti-webhook/templates/mcpserver-{mutating,validating}webhook.yaml
- Remove MCPServer entries from config/webhook/manifests.yaml
- Update e2e CA injection checks to reference authbridge webhook
- Update Chart.yaml description and keywords
- Update deprecation comments to reference Agent CR only
Closes rossoctl#150
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Signed-off-by: cwiklik <[email protected]>
mrsabath
left a comment
There was a problem hiding this comment.
Code Review
CI: All checks passing (CI Checks, DCO, Spellcheck skipped).
Overall: Clean, well-scoped removal of the deprecated MCPServer/Toolhive webhook. The toolhive dependency is properly dropped from go.mod/go.sum, Helm templates are deleted, manifests cleaned up, and deprecation comments updated. One bug to fix before merge.
Bug: E2e test references nonexistent authbridge validating webhook (Blocker)
The e2e test should have CA injection for validating webhooks was updated to look up:
kagenti-webhook-authbridge-validating-webhook-configuration
But no authbridge validating webhook exists. The AuthBridge webhook is a raw admission.Handler (mutating only) -- there is no authbridge-validatingwebhook.yaml in the Helm templates. Only agent-validatingwebhook.yaml remains after this PR.
This test will fail at e2e time because kubectl get validatingwebhookconfigurations ... kagenti-webhook-authbridge-validating-webhook-configuration will return a not-found error.
Fix options:
- Change the reference to
kagenti-webhook-agent-validating-webhook-configuration(the Agent validating webhook still exists) - Remove the validating webhook CA injection test entirely if validating webhooks aren't critical to verify
Minor: Import alias webhooktoolhivestacklokdevv1alpha1 is misleading (Low)
In cmd/main.go, the import alias for the internal webhook package is still:
webhooktoolhivestacklokdevv1alpha1 "github.com/kagenti/kagenti-extensions/kagenti-webhook/internal/webhook/v1alpha1"After this PR, there's no toolhive code in that package -- it only has Agent and AuthBridge webhooks. Consider renaming to something like webhookv1alpha1 for clarity. Not a blocker.
Minor: Extra blank line in cmd/main.go (Low)
After removing the MCPServer webhook setup block, there's a leading blank line inside the if os.Getenv("ENABLE_WEBHOOKS") != "false" block before the Agent webhook comment. Cosmetic only.
Nice-to-have: CLAUDE.md references MCPServer
Both CLAUDE.md and kagenti-webhook/CLAUDE.md still reference the MCPServer webhook in architecture tables, directory structure, and "Removing Deprecated Code" sections. Could be updated as a follow-up or when the Agent webhook is also removed.
What looks good
- Toolhive dependency cleanly removed from
go.mod/go.sum - Both Helm templates (
mcpserver-mutating/validatingwebhook.yaml) deleted config/webhook/manifests.yamlproperly cleaned up (both mutating and validating MCPServer entries)webhook_suite_test.goupdated (scheme registration + setup call removed)Chart.yamldescription and keywords updated to reflect authbridge focus- Deprecation comments properly narrowed from "Agent and MCPServer" to "Agent" only
go.modchanges forfsnotifyandyaml(indirect -> direct) are consistent with dependency cleanup after toolhive removal
Please fix the e2e test validating webhook reference before merge.
- Remove MCPServer resource block from kagenti-webhook/PROJECT - Remove MCPServer/toolhive entries from kagenti-webhook/README.md and ARCHITECTURE.md - Rename stale import alias webhooktoolhivestacklokdevv1alpha1 to webhookv1alpha1 in cmd/main.go - Remove toolhive from spellcheck wordlist - Rename goreleaser step from "toolhive webhook chart" to "kagenti webhook chart" - Update ISSUE_TEMPLATE_EXAMPLE.md toolhive-webhook refs to kagenti-webhook - Update root README.md and CLAUDE.md to remove MCPServer/toolhive mentions - Update kagenti-webhook/CLAUDE.md to reflect two webhooks (AuthBridge + Agent) Co-Authored-By: Claude Sonnet 4.6 <[email protected]> Signed-off-by: cwiklik <[email protected]>
The AuthBridge webhook is mutating-only (raw admission.Handler); there is no authbridge ValidatingWebhookConfiguration. Fix the e2e CA injection check to reference the agent-validating-webhook-configuration, which is the only ValidatingWebhookConfiguration present. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> Signed-off-by: cwiklik <[email protected]>
The kustomize build config/crd step in make install requires a kustomization.yaml. This file was missing, causing e2e setup to fail. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> Signed-off-by: cwiklik <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 <[email protected]> Signed-off-by: cwiklik <[email protected]>
Extract the focal-entity resolution inlined in ServicePolicyBuilder.build() into a standalone resolve_focal_entities(service_id, service_type) -> FocalEntitySet in agent/shared/focal_entities.py, callable by both the live builder and the upcoming policy-conflict diagnostic. Pure extraction, no behavior change to the live /apply path: existing builder tests pass unchanged. The HTTPException(502) (IdP unreachable) / HTTPException(404) (unknown service) boundary moves into the resolver, where the diagnostic's pre-survey HTTP boundary needs it. builder.py keeps routing service_type through its parameter (not focus.type), preserving the live /apply contract. Refs #155. Part of #154. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Anatoly Koyfman <[email protected]>
Summary
github.com/stacklok/toolhivefromgo.mod/go.summcpserver-mutatingwebhookandmcpserver-validatingwebhookconfig/webhook/manifests.yamlCloses #150
Test plan
make buildpasses with no errorsmake test(unit tests) passeshelm lint charts/kagenti-webhookpasseskubectl get mutatingwebhookconfigurations)🤖 Generated with Claude Code