Skip to content

[FEATURE] Add ExtraContainers to SharedDeploymentSpec #1646

@renato0307

Description

@renato0307

📋 Prerequisites

  • I have searched the existing issues to avoid creating a duplicate
  • By submitting this issue, I agree to follow the Code of Conduct

📝 Feature Summary

Add support for extraContainers in SharedDeploymentSpec to allow injecting sidecar containers alongside the main kagent agent container.

❓ Problem Statement / Motivation

  • SharedDeploymentSpec currently supports volumes, volumeMounts, and env for customizing agent pods, but there is no way to inject additional containers alongside the primary kagent container.
  • Platform teams running kagent in multi-tenant Kubernetes environments need to inject sidecar containers (e.g. token-injecting proxies, log shippers, security agents) into agent pods without forking kagent or using a MutatingAdmissionWebhook.
  • A MutatingWebhook adds operational complexity and a new component to manage. The cleanest solution is a first-class field in the Agent CRD that passes through to the generated Deployment.

💡 Proposed Solution

Add an extraContainers field to SharedDeploymentSpec:

// ExtraContainers is a list of additional containers to run alongside the main agent container.
// +optional
ExtraContainers []corev1.Container `json:"extraContainers,omitempty"`

The translator (adk_api_translator.go) appends them after the primary container:

Containers: append([]corev1.Container{{ /* kagent container */ }}, dep.ExtraContainers...),

The change is minimal (~20 lines across agent_types.go, deployments.go, and adk_api_translator.go), fully backward-compatible (optional field, defaults to empty), and follows the exact same pattern as the existing volumes and volumeMounts fields.

🔄 Alternatives Considered

  • MutatingAdmissionWebhook — works but adds a separate webhook component with TLS management overhead.
  • Extending proxy.url — kagent's proxy mechanism handles MCP/A2A traffic but cannot inject sidecars or cover all outbound call paths.

🎯 Affected Service(s)

Controller Service

📚 Additional Context

A reference implementation is available at renato0307/kagent@feat/extra-containers, including the CRD change, translator update, codegen output, and a golden test case.

🙋 Are you willing to contribute?

  • I am willing to submit a PR for this feature

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions