Skip to content

feat(controller): make Go (ADK) runtime agent image independently configurable#2021

Open
QuentinBisson wants to merge 4 commits into
kagent-dev:mainfrom
QuentinBisson:feat/go-runtime-image-config
Open

feat(controller): make Go (ADK) runtime agent image independently configurable#2021
QuentinBisson wants to merge 4 commits into
kagent-dev:mainfrom
QuentinBisson:feat/go-runtime-image-config

Conversation

@QuentinBisson

Copy link
Copy Markdown

Fixes #2018.

What

Adds DefaultGoImageConfig (registry, repository, pullPolicy) to the translator with per-field fallback to DefaultImageConfig and the existing golang-adk derivation when unset. Exposed end-to-end as:

  • --go-image-{registry,repository,pull-policy} controller flags (auto-mapped to GO_IMAGE_* env vars via the existing LoadFromEnv mechanism)
  • controller.goAgentImage.{registry,repository,pullPolicy} Helm values
  • Conditional GO_IMAGE_* keys in the controller ConfigMap (only emitted when set, so a default install emits nothing and the fallback stays in the controller)

Why

When spec.declarative.runtime: go is used, the controller derives the Go runtime repository from the Python repository by replacing the last path segment with golang-adk. This breaks for flat-name registry layouts (e.g. a mirrored registry where the image is my-registry.io/kagent-golang-adk — the derivation cannot produce a hyphen-prefixed name).

What doesn't change

  • Default installs: no GO_IMAGE_* keys are emitted in the ConfigMap, flags default to empty, DefaultGoImageConfig is all-zero. getRuntimeImageRepository falls back to the existing string-surgery logic. Behavior is byte-for-byte identical.
  • Tag is not configurable here — Go runtime images are digest-pinned at controller link time via GoADKImageDigest / GoADKFullImageDigest.
  • The -full digest selection for sandboxed agents is unaffected.

Files changed

File Change
go/core/internal/controller/translator/agent/adk_api_translator.go DefaultGoImageConfig var
go/core/internal/controller/translator/agent/deployments.go fallback resolution in getRuntimeImageRepository + resolveInlineDeployment
go/core/pkg/app/app.go three --go-image-* flags
helm/kagent/values.yaml controller.goAgentImage block
helm/kagent/templates/controller-configmap.yaml conditional GO_IMAGE_* keys
go/core/internal/controller/translator/agent/runtime_test.go 4 new tests + withGoImageConfig helper

@github-actions github-actions Bot added the enhancement New feature or request label Jun 15, 2026
@QuentinBisson QuentinBisson marked this pull request as ready for review June 15, 2026 17:52
Copilot AI review requested due to automatic review settings June 15, 2026 17:52
@QuentinBisson QuentinBisson force-pushed the feat/go-runtime-image-config branch from 3e0ab42 to 10a9c6f Compare June 15, 2026 17:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds Go (ADK) runtime image configurability so operators can override registry/repository/pull policy independently from the default (Python) agent image, while preserving the existing derived-repo behavior.

Changes:

  • Introduces controller.goAgentImage Helm values and wires them into the controller ConfigMap as GO_IMAGE_* settings.
  • Adds controller flags for Go runtime image overrides and a DefaultGoImageConfig to drive translation.
  • Updates translator logic + adds unit tests covering explicit Go repo/registry overrides and fallback derivation.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
helm/kagent/values.yaml Adds controller.goAgentImage values with fallback/derivation semantics.
helm/kagent/templates/controller-configmap.yaml Exposes Go image override values via GO_IMAGE_* entries when set.
go/core/pkg/app/app.go Adds --go-image-* flags to set Go-specific image defaults.
go/core/internal/controller/translator/agent/adk_api_translator.go Introduces DefaultGoImageConfig global for Go runtime image overrides.
go/core/internal/controller/translator/agent/deployments.go Applies Go-specific registry/pullPolicy overrides and optional repository override logic.
go/core/internal/controller/translator/agent/runtime_test.go Adds tests for explicit Go repo/registry overrides and fallback derivation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread go/core/pkg/app/app.go Outdated
Comment on lines +221 to +223
commandLine.StringVar(&agent_translator.DefaultGoImageConfig.Registry, "go-image-registry", "", "The registry to use for the Go (ADK) runtime agent image. When empty, falls back to --image-registry.")
commandLine.StringVar(&agent_translator.DefaultGoImageConfig.Repository, "go-image-repository", "", "The repository to use for the Go (ADK) runtime agent image. When empty, derived from --image-repository by replacing the last path segment with \"golang-adk\".")
commandLine.StringVar(&agent_translator.DefaultGoImageConfig.PullPolicy, "go-image-pull-policy", "", "The pull policy to use for the Go (ADK) runtime agent image. When empty, falls back to --image-pull-policy.")
Comment on lines +541 to +544
img := deployment.Spec.Template.Spec.Containers[0].Image
assert.Contains(t, img, "/kagent-golang-adk@", "Image should use the explicit flat repository")
assert.NotContains(t, img, "/golang-adk@", "Derived path must not appear when repository is explicitly set")
assert.Contains(t, img, "@sha256:test-go-base")
Comment on lines +174 to +185
// Resolve base registry and pull policy; Go runtime uses DefaultGoImageConfig fields
// when set, falling back to DefaultImageConfig for any unset field.
baseRegistry := DefaultImageConfig.Registry
basePullPolicy := DefaultImageConfig.PullPolicy
if runtime == v1alpha2.DeclarativeRuntime_Go {
if DefaultGoImageConfig.Registry != "" {
baseRegistry = DefaultGoImageConfig.Registry
}
if DefaultGoImageConfig.PullPolicy != "" {
basePullPolicy = DefaultGoImageConfig.PullPolicy
}
}
…figurable

Adds DefaultGoImageConfig (registry, repository, pullPolicy) with per-field
fallback to DefaultImageConfig and the existing golang-adk derivation logic.
Exposed as --go-image-{registry,repository,pull-policy} flags (auto-mapped to
GO_IMAGE_* env vars via LoadFromEnv) and as controller.goAgentImage.* Helm values.

Fixes registry layouts where the Python repository is a flat name that cannot
produce a valid path via last-segment replacement (e.g. kagent-golang-adk).

Tag is not configurable — Go runtime images are digest-pinned at link time.

Closes kagent-dev#2018

Signed-off-by: QuentinBisson <quentin@giantswarm.io>
@QuentinBisson QuentinBisson force-pushed the feat/go-runtime-image-config branch from ac8e81a to b54ae33 Compare June 15, 2026 17:57
// the derived repository (last segment of DefaultImageConfig.Repository replaced with
// "golang-adk") when Repository is empty. Tag is unused — Go runtime images are
// digest-pinned at controller link time via GoADKImageDigest / GoADKFullImageDigest.
var DefaultGoImageConfig = ImageConfig{}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't we just encode the defaults into this variable like we do for the other image configs?

@QuentinBisson QuentinBisson Jun 15, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @iplay88keys I wanted to preserve the issue's framing.

The empty default was there to avoid a breaking change: the controller currently derives the Go image from agentImage.repository, so anyone mirroring images only sets that one value and the Go image follows. If we hardcode the default and always emit GO_IMAGE_REPOSITORY, their next helm upgrade silently repoints the Go image back to cr.kagent.dev and pods fail to pull.

I do agree that this is not the better change though and I will replace this PR with the way it is done for the other images.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Make the Go runtime agent image independently configurable

4 participants