Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't mount ConfigMaps to provide container configuration #118

Open
Florent-A opened this issue Jul 30, 2021 · 1 comment
Open

Can't mount ConfigMaps to provide container configuration #118

Florent-A opened this issue Jul 30, 2021 · 1 comment

Comments

@Florent-A
Copy link

I try to use this image on multiple Openshift 4.7 platforms, where the httpd service needs to be configured independently, and I can't afford rebuilding a new image for each cluster (all clusters are supposed to use the same images for alignment sake)

Therefore I'm trying to mount ConfigMaps volumes at pod runtime, containing httpd-configuration files and httpd-pre-init scripts so that the specific configuration is provided at runtime (similarly to what is described here https://github.com/sclorg/httpd-container/tree/master/2.4#direct-usage-with-a-mounted-directory )

When mounting a first ConfigMap into /opt/app-root/src/httpd-cfg with .conf files, the script run-httpd > pre-init/20-copy-config.sh > process_config_files fails when trying to delete the read only files [1].

When mounting a second ConfigMap into /opt/app-root/src/httpd-pre-init with .sh files, the script run-httpd > process_extending_files only lists actual files (not symlinks) [2] while ConfigMap volumes rather provide symlinks to the actual files in a timestamped subfolder [3].

This makes the image difficult to configure at runtime, and prevents my current usecase to be implemented.

Would it be possible to update the way configuration is processed so that use of ConfigMaps can work?
Thanks for your help

Refs:
[1] rm fails on readonly volumes
https://github.com/sclorg/httpd-container/blob/master/2.4/root/usr/share/container-scripts/httpd/common.sh#L164

[2] only files are listed
https://github.com/sclorg/httpd-container/blob/master/2.4/root/usr/share/container-scripts/httpd/common.sh#L117-L142

[3] ConfigMap mount example

bash-4.4# ls -al /configs/
total 12
drwxrwxrwx    3 root     root          4096 Jun  4 14:47 .
drwxr-xr-x    1 root     root          4096 Jun  4 14:47 ..
drwxr-xr-x    2 root     root          4096 Jun  4 14:47 ..2018_06_04_14_47_03.291041453
lrwxrwxrwx    1 root     root            31 Jun  4 14:47 ..data -> ..2018_06_04_14_47_03.291041453
lrwxrwxrwx    1 root     root            18 Jun  4 14:47 stripe1.xml -> ..data/stripe1.xml
lrwxrwxrwx    1 root     root            18 Jun  4 14:47 stripe2.xml -> ..data/stripe2.xml
@eclipsewebmaster
Copy link

FWIW this is similar to our use case, which fails on startup with:

sed: cannot rename /etc/httpd/conf/sedfNzfTt: Device or resource busy

when using a ConfigMap to manage the /etc/httpd/conf/httpd.conf file

In looking at the code for /usr/share/container-scripts/httpd/common.sh, wrapping the sed commands with something like "if [ -w ${HTTPD_MAIN_CONF_PATH}/httpd.conf ]" would probably fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants