-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Add --volume-mode flag for container/pod creation #27866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Add a new --volume-mode flag that controls behavior when a named volume doesn't exist during container or pod creation. Supported modes: - create (default): auto-create missing named volumes - fail: return an error if the volume doesn't exist The flag is available on: podman create, podman run, podman pod create, and podman pod clone. See: containers#27862 Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
Luap99
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really want a new cli option for this? Would it not be bvetter to pass this on a per volume basis as volume option? --volume name:/dest:nocreate or something like this.
| } | ||
| // Volume does not exist - check if we should fail | ||
| if ctr.config.VolumeMode == define.VolumeModeFail { | ||
| return nil, fmt.Errorf("volume %s does not exist and --volume-mode is set to fail: %w", vol.Name, define.ErrNoSuchVolume) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error messages in the backend logic like here should not refer to the cli names, we might be called via rest API, etc.. where these names don't make sense
@mheon and I discussed this question and we also weren't sure if this should be global or volume specific. I don't mind changing it if you think that would be better. |
|
[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore. |
I don't care to strongly either way, |
Add a new --volume-mode flag that controls behavior when a named volume doesn't exist during container or pod creation.
Supported modes:
The flag is available on: podman create, podman run, podman pod create, and podman pod clone.
See: #27862
Checklist
Ensure you have completed the following checklist for your pull request to be reviewed:
commits. (
git commit -s). (If needed, usegit commit -s --amend). The author email must matchthe sign-off email address. See CONTRIBUTING.md
for more information.
Fixes: #00000in commit message (if applicable)make validatepr(format/lint checks)Noneif no user-facing changes)Does this PR introduce a user-facing change?