WebSphere Application Server & Liberty

WebSphere Application Server & Liberty

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Mounting a ConfigMap in an OpenLibertyApplication manifest

    Posted Thu May 16, 2024 03:17 PM

    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:

    • /opt/ol/wlp/usr/servers/defaultServer/configDropins/overrides/additional-server.xml
    • /opt/ol/wlp/usr/servers/defaultServer/jvm.options

    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
    ------------------------------


  • 2.  RE: Mounting a ConfigMap in an OpenLibertyApplication manifest

    Posted Thu May 16, 2024 03:26 PM

    > 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
    ------------------------------



  • 3.  RE: Mounting a ConfigMap in an OpenLibertyApplication manifest

    Posted Fri May 17, 2024 03:52 AM

    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
    ------------------------------



  • 4.  RE: Mounting a ConfigMap in an OpenLibertyApplication manifest

    Posted Fri May 17, 2024 04:47 AM

    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!



    ------------------------------
    Hermann Huebler
    Alpium IT Solutions GmbH
    Vienna
    Austria

    #IBMChampion
    ------------------------------