Chapter 3. Using Helm charts to build and deploy JBoss EAP applications on OpenShift
Helm is an open-source package manager that enables you to build, deploy, and maintain your JBoss EAP applications on OpenShift. In JBoss EAP 8.1, Helm charts replace the OpenShift templates.
3.1. Helm chart use case Copy linkLink copied to clipboard!
You can use Helm charts with JBoss EAP 8.1 to:
- Build your application from a Maven project hosted on a Git repository using OpenShift Source-to-Image (S2I).
- Deploy an application image on OpenShift with deep integration with the OpenShift cluster (TLS configuration, public route to expose the application, and so on).
- Build your application image with Helm chart and use the JBoss EAP operator to deploy the image.
- Build an application image for JBoss EAP using other methods and use the Helm chart to deploy the application image.
3.2. Helm chart customization for JBoss EAP on OpenShift Copy linkLink copied to clipboard!
You can customize Helm chart for your JBoss EAP application by modifying the YAML
file that contains specific settings for your application.
In the YAML
file, there are two main sections:
-
The
build
configuration. -
The
deploy
configuration.
By selecting configure via YAML view
, You can edit the Values files
file directly on your OpenShift Development Console to upgrade your Helm release with an updated configuration.
3.3. Provisioning JBoss EAP with S2I Copy linkLink copied to clipboard!
Use the eap-maven-plugin
from the application pom.xml
to provision your JBoss EAP server.
The build.s2i.featurePacks
, build.s2i.galleonLayers
and build.s2i.channels
fields have been deprecated.
3.4. Building and deploying JBoss EAP applications using Helm charts Copy linkLink copied to clipboard!
You can build your JBoss EAP application using Helms chart by configuring the build
and deploy
values. You must provide a URL to the Git repository that hosts your application code in your build
configuration, the output is an ImageStreamTag
resource that contains the built application image.
To deploy your application, you must provide an ImageStreamTag
resource that contains your built application image. The output is your deployed application and other related resources you can use to access your application from inside and outside OpenShift.
Prerequisites
- You have logged into the OpenShift Development Console.
- You have JBoss EAP application hosted in a Git repository.
- Your application is a Maven project
-
You have configured your application to use the
org.jboss.eap.plugins:eap-maven-plugin
to provision your JBoss EAP 8.1 server.
Procedure
Build your application image from the source repository:
build: uri: <git repository URL of your application>
build: uri: <git repository URL of your application>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: Enter the secret in the
build
section:build: sourceSecret: <name of secret login to your Git repository>
build: sourceSecret: <name of secret login to your Git repository>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
- If your application has been successfully deployed, you should see a deployed badge next to the Helm release on OpenShift Development Console.
3.4.1. Using Helm chart with Bootable JAR on JBoss EAP XP Copy linkLink copied to clipboard!
In JBoss EAP XP 6.0 you can build your application as a Bootable JAR for more information about how you can do this see The Bootable JAR.
Additionally, in JBoss EAP XP 6.0 you can configure Helms Chart for JBoss EAP XP 6.0 to build an application based on Bootable JAR.
Prerequisites
- You have logged into the OpenShift Development Console.
- You have the source code of your JBoss EAP XP application hosted in a Git repository.
Your application is a Maven project. You have configured your application to create a bootable JAR using Maven plugin
org.wildfly.plugins:wildfly-jar-maven-plugin
. To learn more see Creating a bootable JAR Maven project.- Building your application image using Bootable JAR
- You can build your JBoss EAP XP application image with Bootable using Helms chart by configuring the build section on the OpenShift Development Console.
-
If you are building the application with the Helm chart, you must specify the
build.url
field with the Git URL that references your Git repository. -
You must set the
build.mode
field tobootable-jar
.
3.5. Building your application image using the OpenShift Development Console Copy linkLink copied to clipboard!
You can build your JBoss EAP application image using Helm chart by configuring the build
section on the OpenShift Development Console.
If the application image has been built by another mechanism, you can skip the building part of the Helm chart by setting the build.enabled
field to false
.
You must specify the build.url
field with the Git URL that references your Git repository.
3.6. Deploying your application image Copy linkLink copied to clipboard!
You can deploy your JBoss EAP application using Helm chart by configuring the deploy
setting on the OpenShift Development Console.
If you built your application image using another mechanism, you can skip the deployment configuration of the Helm chart by setting the build.deploy
field to false
.
3.6.1. OpenShift volumes for persistent data storage in Helm chart Copy linkLink copied to clipboard!
OpenShift volumes enable containers to store and share data from various sources, including cloud storage, network file systems (NFS), or host machines. You can use Helm chart, an OpenShift package manager, to deploy applications in a consistent and reproducible manner. By adding a volume mount to a Helm chart, you can enable your application to persist data across deployments.
3.6.2. Mounting a volume with a Helm chart Copy linkLink copied to clipboard!
This procedure explains how to mount a secret
as a volume using a Helm chart on JBoss EAP 8.1. Additionally, you can also use it to mount a ConfigMap
. This action enables the application to securely access and use the data, protecting it from unauthorized access or tampering.
For example, by mounting a secret
as a volume, the sensitive data that you store in the secret appear as a file in the POD running the deployment where the secret has been mounted.
Prerequisites
-
You have created a
secret
. For example, you have created a secret namedeap-app-secret
that refers to a file likekeystore.jks
. -
You have identified a location where to mount the secret in the container’s file system. For example, the directory
/etc/jgroups-encrypt-secre-secret-volume
is where the secret file, such askeystore.jks
is mounted.
Procedure
Specify a
volume
in thedeploy.volumes
field and configure the secret to be used. You must provide thename
of the volume and thesecretName
of the secret:volumes: - name: eap-jgroups-keystore-volume secret: secretName: eap-app-secret
volumes: - name: eap-jgroups-keystore-volume secret: secretName: eap-app-secret
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Mount the volume on the file system using the
deploy.volumeMounts
in the deployment configuration:volumeMounts: - name: eap-jgroups-keystore-volume mountPath: /etc/jgroups-encrypt-secret-volume readOnly: true
volumeMounts: - name: eap-jgroups-keystore-volume mountPath: /etc/jgroups-encrypt-secret-volume readOnly: true
Copy to Clipboard Copied! Toggle word wrap Toggle overflow When the pod starts, the container mounts the
keystore.jks
file at/etc/jgroups-encrypt-secret-volume/keystore.jks
location.