feat(mcpserver): add configurable init container image #1007
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds support for customizing the init container image in
MCPServerresources, allowing users to specify a custom registry or image for the transport adapter init container.Motivation
Currently, the init container image for stdio transport type is hardcoded to
ghcr.io/agentgateway/agentgateway:0.9.0-musl. This creates challenges for:ghcr.ioChanges
API Changes
Added an optional
initContainerfield toMCPServerDeployment:Behavior
spec.deployment.initContainer.imageis specified, it overrides the default imageimagePullPolicydefaults toIfNotPresentif not specifiedExample Usage
Files Modified
go/api/v1alpha1/mcpserver_types.go- AddedInitContainerConfigtypego/internal/controller/translator/mcp/translator_adapter.go- Updated translator logichelm/kagent-crds/templates/kagent.dev_mcpservers.yaml- Generated CRDgo/config/crd/bases/kagent.dev_mcpservers.yaml- Generated base CRDcontrib/tools/mcpserver-custom-registry-example.yaml- Example usageTesting
Manual Testing
Expected output:
myregistry.com/agentgateway/agentgateway:0.9.0-muslBackward Compatibility
Existing MCPServer resources without the
initContainerfield continue to work as before:Expected output:
ghcr.io/agentgateway/agentgateway:0.9.0-muslChecklist
make generate manifests)go build ./...)Related Issues
Closes #[issue-number] (if applicable)
Additional Notes
This change only affects MCPServer resources with
transportType: stdio. HTTP transport type servers do not use an init container and are not affected by this change.