You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe
When a configmap is mounted as a directory rather that every individual file is mounted, Kubernetes creates files with its own internal names that contain timestamp and then creates symlinks at the desired destination to the actual location. For example, when a configmap is mounted into /etc/nginx/templates, it looks somewhat like this:
drwxrwxrwx 3 root root 4.0K Mar 3 19:44 .
drwxr-xr-x 1 app app 4.0K Mar 3 19:34 ..
drwxr-xr-x 2 root root 4.0K Mar 3 19:44 ..2023_08_18_16_14_47.392410265
lrwxrwxrwx 1 root root 31 Mar 3 19:44 ..data -> ..2023_08_18_16_14_47.392410265
lrwxrwxrwx 1 root root 18 Mar 3 19:40 default.conf.template -> ..data/default.conf.template
It results into default.conf being rendered multiple times:
20-envsubst-on-templates.sh: Running envsubst on /etc/nginx/templates/..2023_08_18_16_14_47.392410265/default.conf.template to /etc/nginx/conf.d/..2023_08_18_16_14_47.392410265/default.conf
20-envsubst-on-templates.sh: Running envsubst on /etc/nginx/templates/..data/default.conf.template to /etc/nginx/conf.d/..data/default.conf
20-envsubst-on-templates.sh: Running envsubst on /etc/nginx/templates/default.conf.template to /etc/nginx/conf.d/default.conf
Apparently, nginx won't start because of duplication in config.
Describe the solution you'd like
While this is not really the nginx's issue and this is how configmaps work, it would be nice to still have possibility to mount configmap as a directory and have only the expected entries rendered into resulting config directory.
For example, ! -name '..*' (or similar) added to find would do in my case.
So, it can be either a simple option designated for working around configmaps structure which would optionally add a predefined search terms to find or just an ability to pass arbitrary terms via environment variables (in the same way as template extension is redefined, for example).
Describe alternatives you've considered
As a workaround, the whole 20-envsubst-on-templates.sh can be replaced and do whatever one wants it to do but I assume that the issue with configmap structure affects every single person who mounts the whole template directory and I'd appreciate the out-of-the box solution for this
Additional context
I don't have anything to add but ready to answer questions if there are any or contribute the solution we'd agree upon in a discussion.
The text was updated successfully, but these errors were encountered:
Sure. It's self-hosted Kubernetes 1.22.8 at the moment where I'm deploying nginx to, but I think we're not really special as to how configmap works; here are few links that mention the same behavior:
Also, there is a PR on a similar matter but regarding entrypoint scripts: #731; in my case, I didn't override the whole docker-entrypoint.d and mounted just one script I needed instead, so I didn't hit this issue there, but generally, it exists there, too. So, if the options that are passed to findhere (and below) and here (and below) were customizable, if would let me work around the way k8s mounts a configmap, and maybe help someone who wants their own layout there for any reason.
Is your feature request related to a problem? Please describe
When a configmap is mounted as a directory rather that every individual file is mounted, Kubernetes creates files with its own internal names that contain timestamp and then creates symlinks at the desired destination to the actual location. For example, when a configmap is mounted into
/etc/nginx/templates
, it looks somewhat like this:It results into
default.conf
being rendered multiple times:Apparently, nginx won't start because of duplication in config.
Describe the solution you'd like
While this is not really the nginx's issue and this is how configmaps work, it would be nice to still have possibility to mount configmap as a directory and have only the expected entries rendered into resulting config directory.
For example,
! -name '..*'
(or similar) added tofind
would do in my case.So, it can be either a simple option designated for working around configmaps structure which would optionally add a predefined search terms to find or just an ability to pass arbitrary terms via environment variables (in the same way as template extension is redefined, for example).
Describe alternatives you've considered
As a workaround, the whole
20-envsubst-on-templates.sh
can be replaced and do whatever one wants it to do but I assume that the issue with configmap structure affects every single person who mounts the whole template directory and I'd appreciate the out-of-the box solution for thisAdditional context
I don't have anything to add but ready to answer questions if there are any or contribute the solution we'd agree upon in a discussion.
The text was updated successfully, but these errors were encountered: