Skip to content

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

Open
QuentinBisson wants to merge 9 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 9 commits into
kagent-dev:mainfrom
QuentinBisson:feat/go-runtime-image-config

Conversation

@QuentinBisson

@QuentinBisson QuentinBisson commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Fixes #2018.

What

Adds DefaultGoImageConfig (registry, repository, tag, pullPolicy) so the Go (ADK) runtime agent image is configured independently instead of being derived from the Python repository by string surgery. Exposed end-to-end as:

  • --go-image-{registry,repository,tag,pull-policy} controller flags (auto-mapped to GO_IMAGE_* env vars via LoadFromEnv)
  • controller.goAgentImage.{registry,repository,tag,pullPolicy} Helm values
  • GO_IMAGE_* ConfigMap keys, following the same defaulting as agentImage/skillsInitImage (registry/pullPolicy default to the globals, tag coalesces with the global tag then the Chart version)

Defaults are encoded in the variable (ghcr.io/kagent-dev/kagent/golang-adk), matching DefaultImageConfig and DefaultSkillsInitImageConfig. Since #2242, regular declarative agents reference the image by tag; sandbox agents still pin by digest via GoADKImageDigest / GoADKFullImageDigest. The -full variant selection is unchanged for both paths.

Why

When spec.declarative.runtime: go is used, the controller derived 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, which the derivation cannot produce).

Breaking change

Operators who mirror images and only set agentImage no longer get a derived Go image location; they must set controller.goAgentImage as well. The controller logs a startup warning when the two registries differ so a misconfigured mirror is visible before a Go agent fails to pull. As discussed in the review thread, this targets a minor release (0.10.x).

Files changed

File Change
go/core/internal/controller/translator/agent/adk_api_translator.go DefaultGoImageConfig with encoded defaults
go/core/internal/controller/translator/agent/deployments.go Go image resolution via DefaultGoImageConfig; tag threaded through resolveRuntimeImage
go/core/pkg/app/app.go four --go-image-* flags + registry-mismatch startup warning
helm/kagent/values.yaml controller.goAgentImage block
helm/kagent/templates/controller-configmap.yaml GO_IMAGE_* keys
go/core/internal/controller/translator/agent/runtime_test.go, imageconfig_test.go tests updated to tag-based expectations

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed: the flags now use the DefaultGoImageConfig fields as StringVar defaults, same as the skills-init-image-* flags. Defaults are encoded in the config since the derivation fallback was dropped.

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")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed: the tests now assert equality on the full image reference (e.g. my-registry.io/kagent-golang-adk:v0.0.0-test) instead of substring matching.

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
}
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added TestRuntime_GoImageConfig_ExplicitPullPolicy: asserts the Go deployment uses the explicit pull policy and the Python deployment does not inherit it.

…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
Contributor 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.

@iplay88keys iplay88keys Jun 17, 2026

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.

I see, is there another workaround we can build in? Maybe something like: if they are overriding the image for the python image, but not for the go image, throw an error/warning?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think we should be able to add a log warning if the 2 registries are different yes

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.

@EItanya thoughts on the breaking change aspect? I'm thinking it's fine if we document it and we'd likely want that to go in on a minor release to draw attention to the breaking nature of that change.

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.

I agree with @iplay88keys suggestion, this would likely go into the next minor release where we will make go runtime by default and it would be helpful to be able to configure go runtime images. So I think the breaking change would be fine as it's more clear in the long run

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.

Agreed, we can put it in 0.10.x

@github-actions

Copy link
Copy Markdown

This pull request has been marked as stale because of no activity in the last 15 days. It will be closed in the next 5 days unless it is tagged "no stalebot" or other activity occurs.

@github-actions github-actions Bot added the stale This issue or PR has become stale label Jul 11, 2026
Encode concrete defaults into DefaultGoImageConfig (registry, repository,
pullPolicy) like the other image configs, and drop the repository derivation
from the Python image. The Helm chart always emits GO_IMAGE_* and defaults the
registry to the global registry, so mirroring through .Values.registry covers
the Go runtime image too. The controller warns at startup when the Go and agent
image registries differ.

Signed-off-by: QuentinBisson <quentin@giantswarm.io>
@QuentinBisson
QuentinBisson requested a review from a team as a code owner July 11, 2026 23:28
@github-actions github-actions Bot removed the stale This issue or PR has become stale label Jul 12, 2026

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

There are a few changes that will need to be made to work with main. The biggest is that regular declarative agents are now referenced by tag and digests are only used for sandbox agents.

// Tag is unused: Go runtime images are digest-pinned at controller link time
// via GoADKImageDigest / GoADKFullImageDigest.
var DefaultGoImageConfig = ImageConfig{
Registry: "cr.kagent.dev",

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.

This should be changed to ghcr.io

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done. Rebased on main and moved the defaults to ghcr.io/kagent-dev/kagent/golang-adk. Also adapted to #2242: regular Go agents are now tag-referenced (new tag field on goAgentImage, --go-image-tag, GO_IMAGE_TAG), sandbox agents still pin by digest.

Adapts to kagent-dev#2242 (declarative agents referenced by tag, digests only for
sandbox agents):
- DefaultGoImageConfig defaults to ghcr.io/kagent-dev/kagent/golang-adk
  and now carries a Tag (regular Go agents are tag-referenced)
- resolveRuntimeImage takes the tag as a parameter so the Go runtime
  resolves via DefaultGoImageConfig.Tag
- new --go-image-tag flag, controller.goAgentImage.tag Helm value and
  GO_IMAGE_TAG ConfigMap key (coalesced with global tag / Chart version)
- tests updated from digest to tag expectations; drops the upstream
  derivation test superseded by explicit Go image config
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Jul 17, 2026
Signed-off-by: QuentinBisson <quentin@giantswarm.io>
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

5 participants