Skip to content

Conversation

@jojje
Copy link
Contributor

@jojje jojje commented Jan 23, 2026

Add edit pod command

Modify existing pods without having to remove the pod and reprovision new machines as a result. This is a CLI version of the same functionality in the web console, where one can change container images, ports etc without releasing the machine.

Same caveat to the web console applies; the container disk may be wiped if the backend decides it has to re-launch the container for the pod, even if on the same machine.

Closes #35

How I tested it

  • Unit tests (many new included)
  • Integration test with backend, for all options and permutations to ensure the backend behaved as expected from the command's CLI surface.

Reviewer notes

This is a rather large commit. It is large because it expands the scope of the CLI in three dimensions:

  1. A new type of backend interaction (graphql query).
  2. A new top category; edit
  3. A new sub-command to the new category edit pod.

The second reason it's large is because it tries to avoid the pitfalls of other commands that unfortunately mutate the backend in ways the user did not intend. For instance, by confusing template variables with CLI defaults and user specified options. For that reason a new "option binding" scaffolding was added that overcomes the main issue with Cobra; no clean way to determine if an option was set by the user or if it was a result of a default value.

The third reason is because this is a delta handling problem, and getting it wrong will may cause data-loss for users. That is unacceptable. Other than a lot of unit tests the new edit command also has a dry-run flag, which allows the user to inspect exactly what will be sent to the backend, if ever in doubt. That should minimize the risk of data loss as the user has complete visibility into precisely what a given command invocation will result in before sending it.

The PR contains a good deal of documentation (comments) on the binding machinery, so with a bit of squinting, I hope it makes sense after a minute or so. If not, please ask and I'll be happy to clarify, as well as revise, if a better solution can be found to "parsing and acting on the user provided options only".

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.

update docker image for existing pod using runpodctl

1 participant