Add a file into an existing Openshift configMap
I was able to get what I think you want by using json instead of yaml, and using jq with its multiplication operator(*
) which, when used with objects, will merge them recursively (split lines for readability):
oc export configmap my-config -o json \ | jq ". * $(oc create configmap my-config --from-file path/to/file.properties --dry-run -o json)" \ | oc apply -f -
While this works fine if you're looking for a one-liner, you could also manually edit the configmap in your text editor with oc edit configmap my-config
, or oc replace
(with a newly prepared json or yaml file), or by using the web console. It might be possible with oc patch
also, but I wasn't able to get that working quickly.