wildfly

by joaquinito2051

Helm chartv1.5.5App 26.1

Build and Deploy WildFly applications on OpenShift

About this chart

Helm Chart for WildFly

A Helm chart for building and deploying a WildFly application on OpenShift.

Overview

The build and deploy steps are configured in separate build and deploy values.

The input of the build step is a Git repository that contains the application code and the output is an ImageStreamTag resource that contains the built application image.

The input of the deploy step is an ImageStreamTag resource that contains the built application image and the output is a Deployment and related resources to access the application from inside and outside OpenShift.

To be able to install a Helm release with that chart, you must be able to provide a valid application image.

Build an Application Image from Source

If the application image must be built from source, the minimal configuration is:

build:
  uri: <git repository URL of your application>

The build step will use OpenShift BuildConfig to build an application image from this Git repository.

Pull an existing Application Image

If your application image already exists, you can skip the build step and directly deploy your application image. In that case, the minimal configuration is:

image:
  name: <name of the application image. e.g. "quay.io/example.org/my-app">
  tag: <tag of the applicication image. e.g. "1.3" (defaults to "latest")>
build:
  enabled: false

Prerequisites

Below are prerequisites that may apply to your use case.

Pull Secret

You will need to create a pull secret if you need to pull an image from an external registry that requires authentication. Use the following command as a reference to create your pull secret:

oc create secret docker-registry my-pull-secret --docker-server=$REGISTRY_URL --docker-username=$USERNAME --docker-password=$PASSWORD --docker-email=$EMAIL

You can use this secret by passing --set build.pullSecret=my-pull-secret to helm install, or you can configure this in a values file:

build:
  pullSecret: my-pull-secret

Push Secret

You will need to create a push secret if you want to push your image to an external registry. Use the following command as a reference to create your push secret:

oc create secret docker-registry my-push-secret --docker-server=$SERVER_URL --docker-username=$USERNAME --docker-password=$PASSWORD --docker-email=$EMAIL

You can use this secret by passing --set build.output.pushSecret=my-push-secret and --set build.output.kind=DockerImage, or you can configure these in a values file:

build:
  output:
    kind: DockerImage
    pushSecret: my-push-secret

Application Image

The configuration for the image that is built and deployed is configured in a image section.

ValueDescriptionDefaultAdditional Information
image.nameName of the image you want to build/deployDefaults to the Helm release name.The chart will create/reference an ImageStream based on this value.
image.tagTag that you want to build/deploylatestThe chart will create/reference an ImageStreamTag based on the name provided

Building the Application

The configuration to build the application image is configured in a build section.

ValueDescriptionDefaultAdditional Information
build.enabledDetermines if build-related resources should be created.trueSet this to false if you want to deploy a previously built image. Leave this set to true if you want to build and deploy a new image.
build.uriGit URI that references your git repo<required>Be sure to specify this to build the application.
build.refGit ref containing the application you want to buildmain-
build.contextDirThe sub-directory where the application source code exists--
build.output.kindDetermines if the image will be pushed to an ImageStreamTag or a DockerImageImageStreamTagOpenShift Documentation
build.output.pushSecretName of the push secret-The secret must exist in the same namespace or the chart will fail to install - Used only if build.output.kind is DockerImage
build.pullSecretName of the pull secret-The secret must exist in the same namespace or the chart will fail to install - OpenShift documentation
build.modeDetermines whether the application will be built using WildFly S2I images or Bootable Jars2iAllowed values: s2i or bootable-jar
build.envFreeform env items-Kubernetes documentation. These environment variables will be used when the application is built. If you need to specify environment variables for the running application, use deploy.env instead.
build.resourcesFreeform resources items-Kubernetes documentation
build.imagesFreeform images injected in the source during build-OpenShift documentation
build.triggers.githubSecretName of the secret containing the WebHookSecretKey for the GitHub Webhook-The secret must exist in the same namespace or the chart will fail to install - OpenShift documentation
build.triggers.genericSecretName of the secret containing the WebHookSecretKey for the Generic Webhook-The secret must exist in the same namespace or the chart will fail to install - OpenShift documentation
build.s2iConfiguration specific to building with WildFly S2I images--
build.s2i.versionVersion of the WildFly S2I images.Defaults to this chart AppVersion-
build.s2i.builderImageWildFly S2I Builder imagequay.io/wildfly/wildfly-centos7WildFly S2I documentation
build.s2i.runtimeImageWildFly S2I Runtime imagequay.io/wildfly/wildfly-runtime-centos7WildFly S2I documentation
build.s2i.galleonDirDirectory relative to the root directory for the build that contains custom content for Galleon.-WildFly S2I documentation - since WildFly 23.0.2
build.s2i.featurePacksList of additional Galleon feature-packs identified by Maven coordinates (<groupId>:<artifactId>:<version>)-The value can be be either a string with a list of comma-separated Maven coordinate or an array where each item is the Maven coordinate of a feature pack - WildFly S2I documentation - since WildFly 23.0.2
build.s2i.galleonLayersA list of layer names to compose a WildFly server-The value can be be either a string with a list of comma-separated layers or an array where each item is a layer - WildFly S2I documentation
build.bootableJar.builderImageJDK Builder image for Bootable Jarregistry.access.redhat.com/ubi8/openjdk-11:latest-

Deploying the Application

The configuration to build the application image is configured in a deploy section.

ValueDescriptionDefaultAdditional Information
deploy.enabledDetermines if deployment-related resources should be created.trueSet this to false if you do not want to deploy an application image built by this chart.
deploy.replicasNumber of pod replicas to deploy.1OpenShift Documentation
deploy.route.enabledDetermines if a Route should be createdtrueAllows clients outside of OpenShift to access your application
deploy.route.tls.enabledDetermines if the Route should be TLS-encryptedtrueOpenShift Documentation
deploy.route.tls.terminationDetermines the type of TLS termination to useedgeAllowed values: edge, reencrypt, passthrough
deploy.route.tls.insecureEdgeTerminationPolicyDetermines if insecure traffic should be redirectedRedirectAllowed values: Allow, Disable, Redirect
deploy.envFreeform env items-Kubernetes documentation. These environment variables will be used when the application is running. If you need to specify environment variables when the application is built, use build.env instead.
deploy.envFromFreeform envFrom items-Kubernetes documentation. These environment variables will be used when the application is running. If you need to specify environment variables when the application is built, use build.envFrom instead.
deploy.resourcesFreeform resources items-Kubernetes documentation
deploy.livenessProbeFreeform livenessProbe field.HTTP Get on <ip>:admin/health/liveKubernetes documentation
deploy.readinessProbeFreeform readinessProbe field.HTTP Get on <ip>:admin/health/readyKubernetes documentation
deploy.startupProbeFreeform startupProbe field.HTTP Get on <ip>:admin/health/liveKubernetes documentation
deploy.volumeMountsFreeform volumeMounts items-Kubernetes Documentation
deploy.volumesFreeform volumes items-Kubernetes Documentation
deploy.initContainersFreeform initContainers items-Kubernetes Documentation
deploy.extraContainersFreeform extra containers items-Kubernetes Documentation

Deploy wildfly with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has wildfly on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartwildfly is pinned at v1.5.5 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply