Add possibility to modify `find` arguments
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 3.5k
- Forks
- 1.8k
- Avg merge
- 42m
- Merged PRs (30d)
- 2
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading 20-envsubst-on-templates.sh and the existing environment-variable handling for redefining the template extension. Trace how its find arguments select files, then determine an interface for excluding Kubernetes ConfigMap entries such as ..data and timestamped directories. Done means mounted template directories render only the expected entries without duplicate output, while the existing workaround remains supported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, shell
- Domain
- devops
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100