Description of problem: It is not a "bug" precisely, however the option "--overwrite" for oc volume is mistakable. (I will explain in reproduce section below.) Version-Release number of selected component (if applicable): - 3.1.1.6 Steps to Reproduce: We use "--overwrite" to expect we update "test" volume to "pvc" volume, like: ~~~ $ oc volume dc/docker-registry --add --overwrite --name=test --type=emptyDir $ oc volume dc/docker-registry --add --overwrite --name=pvc1 --type=persistentVolumeClaim --claim-name=pvc1 ~~~ and try to use "pvc1". But actual result is still using "test" volume like: ~~~ volumeMounts: - mountPath: /registry name: test ... volumes: - emptyDir: {} name: test - name: pvc1 persistentVolumeClaim: claimName: pvc1 ~~~ Expected results: a. Prohibit --overwrite option from using for non-exsistent volume. - or - b. Overwrite the "test" volume by "pvc1". Additional info: - proposal patch: https://github.com/openshift/origin/pull/8094
It looks like we just want to make sure a user understands that by using the `--overwrite` option, they are not replacing the current volume that is being used. Maybe a simple clarification of this in the flag's description would be enough? The current description for the "--overwrite" flag is: ``` cmd.Flags().BoolVar(&addOpts.Overwrite, "overwrite", false, "If true, replace existing volume source and/or volume mount for the given resource") ``` We could update it to: ``` cmd.Flags().BoolVar(&addOpts.Overwrite, "overwrite", false, "If true, replace existing volume source and/or volume mount of the same name for the given resource") ```
You don't think that following results are more natural behavior? a. Prohibit --overwrite option from using for non-existent volume. or b. Overwrite the "test" volume by "pvc1". Also, if users made a typo in volumename("--name=xxx"), they don't notice that their pod keeps using wrong(previous) volume. How do you think about it?
> You don't think that following results are more natural behavior? > b. Overwrite the "test" volume by "pvc1". Although this could be interpreted as more natural based on the current description of the --override flag, it would not be a good idea to alter the existing behavior of it; it would impact scriptability and not be a usability improvement for users who intend to use it as it works today. > a. Prohibit --overwrite option from using for non-existent volume. Based on @ccoleman's comment here https://github.com/openshift/origin/pull/8094#r56688748, a negative error caused by attempting to use this flag with a volume that does not already exist might not be good in this case, as it could break existing scripts that depend on this command to return "0", for example. Maybe appending a warning, or info, to the output of a human-readable output format could work.
> Maybe appending a warning, or info, to the output of a human-readable output format could work. I see. I think that it is a good compromise. Thank you.
Related PR: https://github.com/openshift/origin/pull/12838
Fixed in https://github.com/openshift/origin/pull/12838.
This has been merged into ocp and is in OCP v3.5.0.32 or newer.
Checked on oc v3.5.0.32-1+4f84c83 $ oc volume -h …… --overwrite=false: If true, replace existing volume source with the provided name and/or volume mount for the given resource …… $ oc set volume -h …… --overwrite=false: If true, replace existing volume source with the provided name and/or volume mount for the given resource …… Now the help info for flag --overwrite has been updated as above. The issue is fixed, so move it to Verified.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2017:0884