For security reasons, I need to renew the password field of a Secret in Openshift every 30 days, so my idea is to create a cronjob and execute a ocp command to remove the password field from that Secret, so after this, the password field is autogenerated with a new password. So I'm trying to edit a field from a Secret using the patch command but without success. This is what the help command shows regarding patch:
and I tried the patch command like this:
oc patch secret test-secret -p '{"data":{"password":}}'
or
oc patch secret test-secret -p $'data:\n password: '
but I see this kind of errors:
Error from server (BadRequest): json: cannot unmarshal string into Go value of type map[string]interface {}
Error from server (NotFound): secrets "password:" not found
Error from server (NotFound): secrets "'" not found
Does anyone knows how to use the patch command to update the field of a ocp Secret?
Thanks!
oc patch secret test-secret -p '{"data":{"password": ""}}'