Comparing JBoss EAP 7 deployment methods in Openshift 4

Solution Verified - Updated

Environment

  • Red Hat Enterprise Application Platform

    • 7.x
    • 8.x
  • Red Hat Openshift Container Platform

    • 4.x

Issue

  • What are the deployment methods of JBoss EAP 7 in Openshift 4?
  • What are the deployment methods of EAP 8 in Openshift 4?

Resolution

The following are the options to deploy respectively EAP 7 and EAP 8.

EAP 7

MethodPrimary resource of interaction
Template deploymentDeployment/DeploymentConfig
JBoss EAP OperatorWildflyServer Custom Resource

Template Deployment

The EAP 7 images have the EAP 7 jars fully, so the process of deployment in Openshift is to trim the jars and put inside the runtime image, which is then deployed with some arguments.

The solution JBoss EAP 7 thin image and How do I deploy jboss-eap-7/eap-74-openjdk8-openshift-rhel8 image on OpenShift? demonstrate the deployment with template, which is an argument on the buildconfig that sets some arguments for the build.

oc new-project eap-demo
oc new-app --template=eap74-basic-s2i -p EAP_IMAGE_NAME=jboss-eap74-openjdk11-openshift:7.4.0 \
 -p EAP_RUNTIME_IMAGE_NAME=jboss-eap74-openjdk11-runtime-openshift:7.4.0 \
 -p SOURCE_REPOSITORY_URL=https://github.com/jboss-developer/jboss-eap-quickstarts \
 -p SOURCE_REPOSITORY_REF=7.4.x \
 -p GALLEON_PROVISION_LAYERS=jaxrs-server,web-clustering,sso \
 -p CONTEXT_DIR=helloworld-html5
...

For tuning, see the solution JBoss EAP S2I build template options.

DISCLAIMER: here, when deploying EAP directly via deployment/deployment config (not template) this will lead to environment arguments not be set, such as the ones below:

"env":
        "name": "JGROUPS_PING_PROTOCOL",
        "value": "dns.DNS_PING"
...
        "name": "OPENSHIFT_DNS_PING_SERVICE_NAME",
        "value": "${APPLICATION_NAME}-ping"
...
        "name": "OPENSHIFT_DNS_PING_SERVICE_PORT",
        "value": "8888"
...
        "name": "MQ_CLUSTER_PASSWORD",
        "value": "${MQ_CLUSTER_PASSWORD}"
...
        "name": "MQ_QUEUES",
        "value": "${MQ_QUEUES}"
...
        "name": "MQ_TOPICS",
        "value": "${MQ_TOPICS}"
...
        "name": "JGROUPS_CLUSTER_PASSWORD",
        "value": "${JGROUPS_CLUSTER_PASSWORD}"
...
        "name": "AUTO_DEPLOY_EXPLODED",
        "value": "${AUTO_DEPLOY_EXPLODED}"
...
        "name": "ENABLE_GENERATE_DEFAULT_DATASOURCE",
        "value": "${ENABLE_GENERATE_DEFAULT_DATASOURCE}"

However, the Java settings will also be affected: when not deploying via template the OpenJDK layer will impose the Java settings via JAVA_OPTS, which will then not be overwritten by the EAP layer (run.sh/standalone.conf) script:

JAVA_OPTS already set in environment; overriding default settings with values: -XX:MaxRAMPercentage=51.0 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -XX:MetaspaceSize=96m -XX:+ExitOnOutOfMemoryError -Djava.security.egd=file:/dev/./urandom -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=jdk.nashorn.api,com.sun.crypto.provider

Therefore: Direct deployment, although it could be technically done (deployment file with EAP image), it must be runtime and the environment variables should be set.

EAP 7 Operator deployment

apiVersion: wildfly.org/v1alpha1
kind: WildFlyServer
metadata:
  name: example1
  namespace: eap-project
spec:
  applicationImage: 'image-registry.openshift-image-registry.svc:5000/eap-project/eap-7@sha256:id'
  env:
    - name: JAVA_MAX_MEM_RATIO
      value: '52'
  replicas: 1

The WildflyServer custom Resource will create a statefulset, which the user should not handle directly, instead, the handling should be done via EAP Operator's custom resources.

EAP 8

MethodPrimary resource of interaction
Helm ChartsStatefulset
JBoss EAP Operator 3WildflyServer Custom Resource

EAP 8 Helm Chart

Example to deploy EAP 8 with Helm charts:

build:
  uri: https://github.com/jboss-developer/jboss-eap-quickstarts.git
  ref: 8.0.x
  contextDir: helloworld
  env:
  - name: MAVEN_OPTS
    value: '-XX:MetaspaceSize=251m -XX:MaxMetaspaceSize=256m'
deploy:
  replicas: 1
  env:
  - name: JAVA_OPTS_APPEND
    value: -XX:MetaspaceSize=251m -XX:MaxMetaspaceSize=256m

EAP 8 Operator deployment

Below is the deployment of EAP 8, via EAP Operator 3 (not 2)'s WildflyServer Custom Resource - similar to EAP 7, but the image changes:

apiVersion: wildfly.org/v1alpha1
kind: WildFlyServer
metadata:
  name: example1
  namespace: eap-project
spec:
  applicationImage: 'image-registry.openshift-image-registry.svc:5000/eap-project/eap-8@sha256:id'
  env:
    - name: JAVA_MAX_MEM_RATIO
      value: '52'
  replicas: 1

Root Cause

Users have a few options when deploying JBoss EAP in Openshift.
For EAP 7 the options are:

For EAP 8 the options are:

  • Helm Charts
  • JBoss EAP Operator 3
Components
Tags

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.