FROM k8spatterns/gomplate COPY in /in 

The base image k8spatterns/gomplate  contains the template processor and an entry point script that uses the following directories by default: 

• /in  holds the WildFly configuration templates, including the parameterized standalone.xml . These are added directly to the image. 

• /params  is used to look up the Gomplate data sources, which are YAML files. This directory is mounted from a ConfigMap-backed Pod volume. 

• /out  is the directory into which the processed files are stored. This directory is mounted in the WildFly application container and used for the configuration. 

The second ingredient of our example is the ConfigMap holding the parameters. In Example 21-3, we just use a simple file with key-value pairs. 

logFormat : "DEVELOPMENT: %-5p %s%e%n" 

A ConfigMap named wildfly-parameters  contains this YAML-formatted data refer‐ enced by a key config.yml  and is picked up by an init container. 

Finally, we need the Deployment resource for the WildFly server (Example 21-4). 

apiVersion : extensions/v1beta1 kind : Deployment metadata : labels : example : cm-template name : wildfly-cm-template spec : replicas : 1 template : metadata : labels : example : cm-template spec : initContainers : - image : k8spatterns/example-config-cm-template-init name : init volumeMounts : - mountPath : "/params" 

