fix: pod create template inheritance for containerDiskInGb, volumeInGb, and env overrides#294
Open
jamesrahenry wants to merge 4 commits into
Open
Conversation
…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 prepared a documentation update related to this change. Triggered by runpodctl PR #294 Documents how Review: Document pod create template inheritance for disk, volume, and env |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three silent failures when using
pod create --template-id:--container-disk-in-gbnot inherited: the CLI always sent the flag's default value of20, overriding the template's configured disk size with no error or warning.--volume-in-gbnot inherited: unlikecontainerDiskInGb, the RunPod API does not propagatevolumeInGbfrom 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.--envoverrides silently dropped: whentemplateIdandenvare 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.goomitemptytoCreatePodGQLInput.ContainerDiskInGbso the field is absent from the request when not explicitly set, allowing the server to inherit it from the template.cmd/pod/create.gocreateContainerDiskInGbwhen--container-disk-in-gbis not explicitly provided, triggering theomitemptybehaviour above.--template-idis used, fetch the template before sending the create request. Use the fetch to: (1) inheritvolumeInGbwhen--volume-in-gbis not explicitly provided, and (2) merge template env as the base with user-provided--envvalues winning for duplicate keys, then send the full merged set.AGENTS.mdcontainerDiskInGbis inherited,volumeInGbis 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) → podcontainerDiskInGbmatches template value, not 20pod create --template-id <id>(no--volume-in-gb) → podvolumeInGbmatches template value, not 0pod create --template-id <id> --env '{"KEY":"override"}'→ pod env contains override value forKEY; all other template env vars are presentpod create --template-id <id> --container-disk-in-gb 10→ explicit flag still respectedpod create --template-id <id> --volume-in-gb 50→ explicit flag still respectedgo test ./...🤖 Generated with Claude Code