Skip to content

fix: pod create template inheritance for containerDiskInGb, volumeInGb, and env overrides#294

Open
jamesrahenry wants to merge 4 commits into
runpod:mainfrom
jamesrahenry:fix/pod-container-disk-template-inheritance
Open

fix: pod create template inheritance for containerDiskInGb, volumeInGb, and env overrides#294
jamesrahenry wants to merge 4 commits into
runpod:mainfrom
jamesrahenry:fix/pod-container-disk-template-inheritance

Conversation

@jamesrahenry

Copy link
Copy Markdown

Summary

Three silent failures when using pod create --template-id:

  • --container-disk-in-gb not inherited: the CLI always sent the flag's default value of 20, overriding the template's configured disk size with no error or warning.
  • --volume-in-gb not inherited: unlike containerDiskInGb, the RunPod API does not propagate volumeInGb from the template when the field is absent — pods always came up with 0 (no volume), falling back to the 40 GB overlay instead of the dedicated network volume the template specified.
  • --env overrides silently dropped: when templateId and env are both sent, the server merges template env on top of request env with template values winning for duplicate keys, making targeted per-pod overrides impossible without SSH + post-boot intervention.

Changes

internal/api/graphql.go

  • Add omitempty to CreatePodGQLInput.ContainerDiskInGb so the field is absent from the request when not explicitly set, allowing the server to inherit it from the template.

cmd/pod/create.go

  • Zero out createContainerDiskInGb when --container-disk-in-gb is not explicitly provided, triggering the omitempty behaviour above.
  • When --template-id is used, fetch the template before sending the create request. Use the fetch to: (1) inherit volumeInGb when --volume-in-gb is not explicitly provided, and (2) merge template env as the base with user-provided --env values winning for duplicate keys, then send the full merged set.

AGENTS.md

  • Document the asymmetric server inheritance behaviour (containerDiskInGb is inherited, volumeInGb is not) and the env merge direction so future contributors don't inadvertently revert the workarounds.

Test plan

All three fixes were verified end-to-end against the live API:

  • pod create --template-id <id> (no --container-disk-in-gb) → pod containerDiskInGb matches template value, not 20
  • pod create --template-id <id> (no --volume-in-gb) → pod volumeInGb matches template value, not 0
  • pod create --template-id <id> --env '{"KEY":"override"}' → pod env contains override value for KEY; all other template env vars are present
  • pod create --template-id <id> --container-disk-in-gb 10 → explicit flag still respected
  • pod create --template-id <id> --volume-in-gb 50 → explicit flag still respected
  • Unit tests pass: go test ./...

🤖 Generated with Claude Code

kodxana and others added 4 commits June 24, 2026 17:21
…fied

pod create with --template-id was always sending containerDiskInGb: 20
(the flag default), which silently overrode the template's configured
disk size. zero out the value when the flag is not explicitly set so
omitempty drops it from the request and the server uses the template value.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…reate

two related template inheritance failures on pod create with --template-id:

1. volumeInGb was always sent as 0 (the flag default), and unlike
   containerDiskInGb, the server does not inherit this field from the
   template. pods created from templates with network volumes would get
   no volume at all, falling back to the 40gb overlay on /workspace.

2. when --env is provided alongside --template-id, the server applied
   template env vars on top, silently winning for any duplicate key.
   fix: fetch the template before creating the pod, inherit volumeInGb
   when --volume-in-gb is not explicitly set, and merge template env
   with user-provided env (user values take precedence) when --env is
   given. one api call covers both cases.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ents

AGENTS.md: add two pitfalls covering podFindAndDeployOnDemand behavior —
containerDiskInGb is inherited from the template when omitted but volumeInGb
is not; and the server's env merge gives template values precedence over
request env for duplicate keys. both are fixed client-side in pod create.

cmd/pod/create.go: add comments explaining the server behavior that each
workaround is compensating for, so the non-obvious fetch-before-create
pattern is not mistaken for dead code or simplified away.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@promptless

promptless Bot commented Jun 26, 2026

Copy link
Copy Markdown

Promptless prepared a documentation update related to this change.

Triggered by runpodctl PR #294

Documents how runpodctl pod create --template-id inherits container disk size and volume size from the template when those flags are omitted, and that --env values now merge on top of the template's environment variables (user values win on key conflicts) — reflecting the silent-override, missing-volume, and dropped-env fixes in this PR.

Review: Document pod create template inheritance for disk, volume, and env

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants