Skip to content

feat: make docker and kubernetes base template image configurable - #27024

Merged
bpmct merged 1 commit into
ben/devrel-201-image-guidance-prereqsfrom
feat/template-builder-configurable-image
Jul 6, 2026
Merged

feat: make docker and kubernetes base template image configurable#27024
bpmct merged 1 commit into
ben/devrel-201-image-guidance-prereqsfrom
feat/template-builder-configurable-image

Conversation

@jeremyruppel

@jeremyruppel jeremyruppel commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Adds a container_image variable to the Docker and Kubernetes base templates so admins can override the default container image via the Template Builder wizard. The field appears as a freeform text input with codercom/enterprise-base:ubuntu as the default placeholder.

The templates reference the variable via {{ .Variables.container_image }}, the same pattern kubernetes already uses for namespace and use_kubeconfig. No special-case logic in the compose pipeline; the variable flows through mergeBaseVariables like any other base variable.

No frontend, API, or SDK changes are needed. The existing variableToField() in BaseTemplateParametersStep.tsx automatically renders non-sensitive string variables as text fields, and Docker now shows the base parameters step (previously skipped because it had no variables).

Note

This PR was authored by Coder Agents on behalf of @jeremyruppel.

Screenshot 2026-07-06 at 4 14 46 PM
Implementation plan

Approach

Use the variable the same way the kubernetes template already uses namespace and use_kubeconfig: declare it in base.json, and reference it in the .tf.tmpl via {{ .Variables.container_image }}. The variable flows through mergeBaseVariables which HCL-quotes string values, so the template just emits the value directly (no manual quoting). No special handling in compose.go or renderBase().

Why this works

mergeBaseVariables converts string variable defaults and caller-supplied values into HCL-quoted strings (e.g. "codercom/enterprise-base:ubuntu"). The kubernetes template already relies on this for namespace:

namespace = {{ .Variables.namespace }}

The same pattern works for container_image:

image = {{ .Variables.container_image }}

No variable has special meaning. No Go-side override logic.

RFC context: ImageOptions

The RFC describes ImageOptions as a curated list that renders into a coder_parameter dropdown for developers at workspace creation time. This task is complementary: it makes the static image configurable by the admin at template creation time. When ImageOptions is eventually wired up, the admin's chosen image would become the default of that coder_parameter dropdown.

@jeremyruppel
jeremyruppel marked this pull request as ready for review July 6, 2026 20:09
@jeremyruppel jeremyruppel changed the title feat(coderd/templatebuilder): make docker and kubernetes base template image configurable feat: make docker and kubernetes base template image configurable Jul 6, 2026
@jeremyruppel
jeremyruppel force-pushed the feat/template-builder-configurable-image branch from 56af5dc to 0797d13 Compare July 6, 2026 20:14
@jeremyruppel
jeremyruppel changed the base branch from main to ben/devrel-201-image-guidance-prereqs July 6, 2026 20:14
@jeremyruppel
jeremyruppel requested a review from bpmct July 6, 2026 20:15
Comment thread coderd/templatebuilder/bases/kubernetes/base.json
…e image configurable

Add a container_image variable to the Docker and Kubernetes base
templates so admins can override the default container image via the
Template Builder UI. The field is a freeform text input with the
default value matching the existing default_context.container_image.

The templates reference the variable via .Variables.container_image,
the same pattern kubernetes already uses for namespace and
use_kubeconfig. No special-case logic in the compose pipeline.
@jeremyruppel
jeremyruppel force-pushed the feat/template-builder-configurable-image branch from 0797d13 to 8ee2b83 Compare July 6, 2026 20:18
@bpmct
bpmct merged commit 37b9911 into ben/devrel-201-image-guidance-prereqs Jul 6, 2026
9 checks passed
@bpmct
bpmct deleted the feat/template-builder-configurable-image branch July 6, 2026 20:20
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants