Im trying to create a step in my Jenkins pipeline wherein I would like to determine if a volume is already existing, if it is not existing then i will issue an oc set volume dc/mydeployment-config ... command, if its already existing then i will just use the --overwrite option.
I'm looking at jsonpath to determine if the expected name of my volume is already there, here is what i have right now.
$.spec.template.spec.volumes[?(@.name == 'mydeployment-volume')].name
I also tried this
oc set volume dc/mydeployment-config -o jsonpath={'$.spec.template.spec.volumes[?(@.name == 'mydeployment-volume')].name'}
The error was
error: --list and --output may not be specified together
Can anyone nudge me in the right direction to determine the correct
oc set volume
command to use? Or if there is a better way to do this?