Repository navigation
Description
Bug
On OpenShift/OKD, MCPServers that use an HTTP transport (SSE or streamable-http) never become ready. The proxy runner exits while it creates the backend Services:
failed to set up workload: failed to create container: failed to create headless service: failed to apply service mcp-fetch-headless: services "mcp-fetch-headless" is forbidden: cannot set blockOwnerDeletion if an ownerReference refers to a resource you can't set finalizers on
stdio servers aren't affected.
Cause
OpenShift turns on the OwnerReferencesPermissionEnforcement admission plugin by default. When an object gets an ownerReference with blockOwnerDeletion: true, the plugin requires the caller to have update on the owner's /finalizers subresource. See the upstream docs.
Since #3992, the proxy runner gives the headless and ClusterIP Services an owner reference to their StatefulSet with blockOwnerDeletion: true (pkg/container/kubernetes/client.go, ensureBackendServices and the service apply helper). The proxy-runner Role doesn't include apps/statefulsets/finalizers, so the apply is rejected.
Vanilla Kubernetes and kind don't enable this plugin, so CI never saw the failure.
Reproduce
- Install the operator on OpenShift/OKD.
- Create an MCPServer with
transport: streamable-http(orsse). - The proxy runner pod crash-loops with the error above.
Notes
- Operator-created objects are owned by toolhive CRs. They work today only because the operator ClusterRole has a
toolhive.stacklok.devresources: ["*"]updaterule, and*matches the/finalizerssubresources. - A fix that grants the missing permission is in Add /finalizers subresource for OKD/OpenShift installs #6756.
- Possible follow-up: stop setting
blockOwnerDeletionon these Services. Nothing in toolhive deletes StatefulSets with foreground propagation, so the flag doesn't do anything for us. With it gone, the extra RBAC isn't needed. - Possible follow-up: enable
OwnerReferencesPermissionEnforcementin the kind e2e cluster config so CI catches this class of bug.
Activity
Test proxy-runner RBAC under ownerref admission