Skip to content

chore: Remove deprecated MCPServer (Toolhive) webhook - #155

Merged
mrsabath merged 6 commits into
rossoctl:mainfrom
cwiklik:chore/remove-mcpserver-webhook
Feb 27, 2026
Merged

mrsabath merged 6 commits into
rossoctl:mainfrom
cwiklik:chore/remove-mcpserver-webhook

Conversation

@cwiklik

@cwiklik cwiklik commented Feb 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Removes the deprecated MCPServer (Toolhive) webhook handler and all associated code
  • Drops github.com/stacklok/toolhive from go.mod / go.sum
  • Removes the Helm templates for mcpserver-mutatingwebhook and mcpserver-validatingwebhook
  • Removes MCPServer entries from config/webhook/manifests.yaml
  • Updates e2e CA injection checks and Chart.yaml description/keywords to reflect the removal

Closes #150

Test plan

  • make build passes with no errors
  • make test (unit tests) passes
  • helm lint charts/kagenti-webhook passes
  • Deploy to a Kind cluster and confirm the MCPServer webhook configuration is no longer registered (kubectl get mutatingwebhookconfigurations)
  • Confirm the AuthBridge and Agent webhooks still register and function correctly

🤖 Generated with Claude Code

cwiklik and others added 2 commits February 26, 2026 17:10
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]>
@cwiklik
cwiklik requested review from mrsabath and pdettori February 27, 2026 20:09

@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.

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:

  1. Change the reference to kagenti-webhook-agent-validating-webhook-configuration (the Agent validating webhook still exists)
  2. 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.yaml properly cleaned up (both mutating and validating MCPServer entries)
  • webhook_suite_test.go updated (scheme registration + setup call removed)
  • Chart.yaml description and keywords updated to reflect authbridge focus
  • Deprecation comments properly narrowed from "Agent and MCPServer" to "Agent" only
  • go.mod changes for fsnotify and yaml (indirect -> direct) are consistent with dependency cleanup after toolhive removal

Please fix the e2e test validating webhook reference before merge.

cwiklik and others added 4 commits February 27, 2026 15:34
- 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]>

@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.

LGTM

@mrsabath
mrsabath merged commit a20148b into rossoctl:main Feb 27, 2026
3 checks passed
anatolykoyfman added a commit that referenced this pull request Aug 26, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore: Remove deprecated MCPServer (Toolhive) webhook from Helm chart and codebase

2 participants