Currently in my openshift environment, I have to manually go and edit my scc restricted yaml file using the command oc edit scc restricted
.
In this file I am updating two parameters:
allowHostDirVolumePlugin: false
TO allowHostDirVolumePlugin: true
AND
runAsUser:
type: MustRunAsRange
TO
runAsUser:
type: RunAsAny
I want to be able to update these values without actually editing them. I have tried the json patch method mentioned HERE but in that example, I am able to add. I am trying the same using something like
oc patch scc restricted --type=json -p '[{"op": "replace", "path": "/allowHostDirVolumePlugin", "value":"true"}]'
but it keeps giving an error Error from server: [pos 29]: json: decode bool: got first char "
Is there any way to achieve this without editing the yml file?
As Graham has alluded to in his comment, you are trying to set a boolean value as a string. You should be able to update both values with one line, try:
oc patch scc restricted --patch='{"allowHostDirVolumePlugin": true, "runAsUser":{"type":"RunAsAny"}}'