Openshift 4.19 (Kubernetes 1.19) Tomcat spring app overwrite deployed file with config map entry clears complete deployment directory Openshift 4.19 (Kubernetes 1.19) Tomcat spring app overwrite deployed file with config map entry clears complete deployment directory kubernetes kubernetes

Openshift 4.19 (Kubernetes 1.19) Tomcat spring app overwrite deployed file with config map entry clears complete deployment directory


The directory that is used as mount point shadows all other content, therefore it appears like overwriting what you expect to be there. Even if you want to 'just' have a single file mounted, a mount point must exist.

For your specific scenario you could either mount to a different directory, like /config and add it to the classpath, or you can use a subdirectory like /deployments/zfaRouter/WEB-INF/classes/config and add that to the classpath.

If you don't want to change the classpath you could mount the config file to, f.e. /config and change your application start script to copy it to a fitting location, for example to the tomcat shared lib folder that is picked up by the tomcat classloader.