Does anyone have any examples of editing K8s kube-...
# general
r
Does anyone have any examples of editing K8s kube-system configmaps that aren’t being defined in IaC in pulumi? Ideally I’d like to adopt them and then append to them
c
examples are aws but you get the idea
r
I was just looking at approaching it this way, thanks!
So I’ve worked through the import steps, but is there a way I can do this idempotently? It seems that to import the existing resource will require one run, and then appending to it will require running
pulumi up
with different code. If the stack gets recreated from scratch I’d like to be able to adopt and then add to the resource in one run.
I think I’m having this particular problem due to trying to mainpulate
data
in the configmap which is readonly and the documentation says can’t be updated after creation
w
Re: adopt first and then edit - one approach is to have a config setting that determines this, and run initial deployment with that set to true and then update to false after, and conditionally add the
import; id
only when this is false. (Or something along those lines) Definitely thinking about options to support a more first class version of this workflow. Do also note that adopting the resource may be a little heavy-weight - for example, it would mean that if you later destroy your stack, you will remove the config map. Which is probably not what you want. You may therefore also want to
protect: true
the resource. The broader idea of editing an existing resource in an idea potent way but without taking full ownership is something we’re definitely thinking about as a general thing.
r
Thank you for your input Luke! I think for this use case I might work around the problem another way, since I actually do want this configuration to be able to come and go with the stack. Being able to append to the config without taking ownership of it would be the easiest thing here, so glad to hear that’s on your radar as well 🙂