Adding entries to existing ConfigMap on OpenShift

Adding entries  – especially files – to an existing ConfigMap on an OpenShift project is painful because there is no add or update feature available for ConfigMaps. So in case you would like to add entries from files you are supposed to delete the ConfigMap and create a new one which is not very effective.

In my case I have a ConfigMap containing several p12 key files. The ConfigMap was created using the CLI command

oc create configmap my-configmap --from-file=my-secret-1.p12 --from-file=my-secret-2.p12

Now I do not want to delete my ConfigMap and create all entries again in order to just add a new p12 file. In fact I didn’t keep the old p12 files (yeah you shouldn’t let your secrets lie around) so I would have created them all over again. So my solution was to create a new ConfigMap with the new file only and copy the content using OpenShift’s web console to the existing one. After saving the new entry to the existing ConfigMap I deleted the newly created ConfigMap (and the locally stored p12 file of course).

This solution works for me but it has a disadvantage. It is not possible to automate the steps by integrating them into a CI like Jenkins because there are some manual tasks to do. If you have a solution for this please let me know!

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert