Hello Kevin, thanks for the hint with the subPath! Indeed, I missed the subPath :( Added this and now, it works just as expected. Thanks again!
Original Message:
Sent: Fri May 17, 2024 03:52 AM
From: Hermann Huebler
Subject: Mounting a ConfigMap in an OpenLibertyApplication manifest
Thanks a lot for the link with the Java Options.
Regarding the mount of the server.xml that's exactly the way I'm doing it as well. Create a ConfigMap and provide a volume and volumeMount in the manifest (standard K8S procedure) however I'm not sure about the subPath element. Need to check
------------------------------
Hermann Huebler
Alpium IT Solutions GmbH
Vienna
Austria
#IBMChampion
Original Message:
Sent: Thu May 16, 2024 03:25 PM
From: Kevin Grigorenko
Subject: Mounting a ConfigMap in an OpenLibertyApplication manifest
> so that we can depoly the application on different environments using different settings (for example HeapSize etc.) or add for example a trace statement for problem detection without having to rebuild the container
Some of this you can also accomplish with environment variables, e.g. the JVM_ARGS Liberty environment variable for JVM settings.
> would like to mount the following files from a ConfigMap
How are you doing this? I've had success with something like the following as an example:
In your current directory, create a local file named tracefromstartup.xml with the following contents and replace with your desired trace specification:
<?xml version="1.0" encoding="UTF-8"?><server> <logging traceSpecification="*=info" maxFileSize="100" maxFiles="10" /></server>
Create a ConfigMap entry based on the local file:
oc create configmap tracefromstartup --from-file tracefromstartup.xml
Edit the relevant Liberty Operator managed application. In the spec section, add or edit a volumes section that mounts the ConfigMap and a volumeMounts section that places the file into the container; for example:
spec: volumes: - name: tracefromstartup configMap: name: tracefromstartup volumeMounts: - name: tracefromstartup mountPath: /config/configDropins/overrides/tracefromstartup.xml subPath: tracefromstartup.xml
------------------------------
Kevin Grigorenko
Application Runtimes SWAT
IBM
Original Message:
Sent: Thu May 16, 2024 03:16 PM
From: Hermann Huebler
Subject: Mounting a ConfigMap in an OpenLibertyApplication manifest
We are running the OpenLiberty Operator using images from icr.io/appcafe/open-liberty on RedHat Openshift and would like to mount the following files from a ConfigMap:
We'd like to add these mounts so that we can depoly the application on different environments using different settings (for example HeapSize etc.) or add for example a trace statement for problem detection without having to rebuild the container.
However when we add these mounts the startup of the pod fail with the following error (when mounting jvm.options):
/opt/ol/helpers/runtime/docker-server.sh: line 47: /config/configDropins/defaults/keystore.xml: No such file or directory
and right, /config/configDropins/defaults does not exist in this case (but exists if we remove the mount)!
- or -
when mounting additional-server-xml
/opt/ol/helpers/runtime/docker-server.sh: line 80: /config/configDropins/overrides/truststore.xml: Read-only file system
So - any idea how we can achieve this to get the jvm.options (and an additional server.xml) mounted?
Thanks a lot in advance for any hints, Hermann
------------------------------
Hermann Huebler
Alpium IT Solutions GmbH
Vienna
Austria
#IBMChampion
------------------------------