Merge existing configuration files with files created by configmap, or multiple configmaps

3,930 views
Skip to first unread message

Dmitriy Shulyak

unread,
Jul 13, 2016, 9:21:37 AM7/13/16
to kubernetes-dev
Hi folks,
I am trying to come up with solution for the problem when one may need to merge multiple configuration files that are stored in different
configmaps, or they are pre-created, and stored in image.

In image I have existing tree, like

/etc/configs

└── config1


And the following tree will be mounted by k8s configmap

/etc/configs

└── config2


As a result - existing configuration files won't be visible, as long as configmap volume is mounted.


I thought about several solutions for this problem:

1. Mount each file from configmap separately (this information should be available when mounts are created in kubelet)

- it might be a problem with big amount of keys in configmap, and thus shouldnt be default behaviour

2. Use overlayfs/aufs and make necessary changes in docker

- still tricky to merge multiple configmaps into single directory

3. Mount configmap to another directory and copy them using init-container

- is it possible to mount configmap in init-container?


I believe this should be common thing, and probably someone already thought about it. 

Is there any plans how to tackle this case, or maybe there is already a solution?

Eric Tune

unread,
Jul 13, 2016, 12:08:37 PM7/13/16
to Dmitriy Shulyak, kubernetes-dev
Let me see if I understand you correctly.

Are you talking about merging lines from two sources (image and configmap) into a single file, or putting two files from different sources into a single directory?

Are you trying to solve this for the general case, or for a specific application?




--
You received this message because you are subscribed to the Google Groups "kubernetes-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-de...@googlegroups.com.
To post to this group, send email to kuberne...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kubernetes-dev/5c462b3b-ac1a-46df-a19f-7b63e6e33226%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted

Dmitriy Shulyak

unread,
Jul 19, 2016, 7:50:06 AM7/19/16
to kubernetes-dev, et...@google.com
1st problem:
On the image we have /etc/nova/api-paste.ini which is generated during installation, and
other configuration files will be mounted using configmap. So somehow I want to "merge" configmap
with existing directory content.

2nd problem:
Mount /etc/rsyslog.conf

I want to propose: optionally copy data from image into configmap directory before that directory will be mounted
into container, but it will not solve 2nd use case.

Can someone suggest path to address this issues?


On Thursday, July 14, 2016 at 10:08:52 PM UTC+3, Dmitriy Shulyak wrote:
2nd, two files from different sources.
There is use case with openstack services, i will add details in the morning.

Sorry for confusion.



To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-dev+unsubscribe@googlegroups.com.
To post to this group, send email to kubernetes-dev@googlegroups.com.

Dmitriy Shulyak

unread,
Jul 20, 2016, 6:41:05 AM7/20/16
to kubernetes-dev, et...@google.com

Eric Tune

unread,
Jul 20, 2016, 11:08:35 AM7/20/16
to Dmitriy Shulyak, kubernetes-dev
Feel free to file an issue in kubernetes/kubernetes about this.  I think you best solution right now is probably to mount your config files in separate volumes, and then use an init container to copy them to /etc before the main container runs.  Or, if you want dynamic updates, use a sidecar to watch for changes and copy the files.



To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-de...@googlegroups.com.
To post to this group, send email to kuberne...@googlegroups.com.

Dmitriy Shulyak

unread,
Jul 20, 2016, 11:13:32 AM7/20/16
to Eric Tune, kubernetes-dev
Using subPath it is possible to mount only single file, i added this info to configmap documentation [0]

Eric Tune

unread,
Jul 20, 2016, 11:18:38 AM7/20/16
to Dmitriy Shulyak, kubernetes-dev
Awesome, thanks!
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages