quarkus

by joaquinito2051

Helm chartv0.0.3

A Helm chart to build and deploy Quarkus applications

About this chart

Quarkus Helm Chart

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

Prerequisites

Below are prerequisites that may apply to your use case.

Pull Secret

You will need to create a pull secret if you pull an S2I builder or Docker base image from an external registry. Use the following command as a reference to create your pull secret:

oc create secret docker-registry my-pull-secret --docker-server=$SERVER_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

and apply by passing --values $VALUES_FILE.

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 to helm install, or you can configure these in a values file:

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

Values

Below is a table of each value used to configure this chart.

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
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 repohttps://github.com/redhat-developer-helm-quickstarts/quarkus-getting-startedThis value defaults to a sample application. Be sure to override this if you want to build and deploy your own application.
build.refGit ref containing the application you want to buildmain-
build.contextDirThe sub-directory where the application source code exists--
build.modeDetermines whether the Quarkus mode should be set to jvm or nativejvmOptions: jvm or native
build.jvm.imageStreamTag.nameThe ImageStreamTag name of the desired builder imagejava:11Only has an effect if build.mode is set to jvm
build.jvm.imageStreamTag.useReleaseNamespaceDetermines if the builder ImageStreamTag referenced by build.jvm.imageStreamTag.name is in the same namespace you are installing this Helm chart tofalseOnly has an effect if build.mode is set to jvm
build.jvm.imageStreamTag.namespaceThe namespace containing the builder ImageStreamTagopenshiftOnly has an effect if build.jvm.imageStreamTag.useReleaseNamespace is false and build.mode is jvm
build.native.useDefaultDockerfileDetermines if Helm should generate a default Dockerfile to build a native binarytrueOnly has an effect if build.mode is native. Set this to false if you would like to provide your own Dockerfile in git.
build.native.dockerfilePathPath to the DockerfileDockerfilePath is relative to the context dir
build.output.kindDetermines if the image will be pushed to an ImageStreamTag or a DockerImage (external registry)ImageStreamTagMore information: More information: https://docs.openshift.com/container-platform/4.6/builds/managing-build-output.html
build.output.pushSecretPush secret name-Used only if build.output.kind == 'DockerImage'
build.pullSecretImage pull secret-More information: https://docs.openshift.com/container-platform/4.6/openshift_images/managing_images/using-image-pull-secrets.html
build.envFreeform env stanza-More information: https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/
build.resourcesFreeform resources stanza-More information: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
deploy.replicasNumber of pod replicas to deploy1-
deploy.resourcesFreeform resources stanza-More information: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
deploy.serviceTypeType of service to createClusterIPMore information: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types
deploy.portsFreeform service ports stanza.See values.yamlMore information: https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service
deploy.route.enabledDetermines if a Route should be createdtrueAllows clients outside of OpenShift to access your application
deploy.route.targetPortThe port that the Route should target traffic tohttp-
deploy.route.tls.enabledDetermines if the Route should be TLS-encryptedtrueMore information: https://docs.openshift.com/container-platform/4.6/networking/routes/secured-routes.html
deploy.route.tls.terminationDetermines the type of TLS termination to useedgeOptions: edge, reencrypt, passthrough
deploy.route.tls.insecureEdgeTerminationPolicyDetermines if insecure traffic should be redirectedRedirectOptions: "Allow", "Disable", "Redirect"
deploy.route.tls.keyProvides key file contents-This is a secret. Do not check this value into git.
deploy.route.tls.caCertificateProvides the cert authority certificate contents--
deploy.route.tls.certificateProvides certificate contents--
deploy.route.tls.destinationCACertificateProvides the destination CA Certificate for reencrypt routes--
deploy.livenessProbeFreeform livenessProbe stanza.See values.yamlMore information: https://docs.openshift.com/container-platform/4.6/applications/application-health.html#application-health-about_application-health
deploy.readinessProbeFreeform readinessProbe stanza.See values.yamlMore information: https://docs.openshift.com/container-platform/4.6/applications/application-health.html#application-health-about_application-health
deploy.envFreeform env stanza-More information: https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/
deploy.envFromFreeform envFrom stanza-More information: https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#configure-all-key-value-pairs-in-a-configmap-as-container-environment-variables
deploy.applicationProperties.enabledDetermines if application properties should be externalized in a ConfigMapfalse-
deploy.applicationProperties.mountPathLocation to mount the application.properties file/deployments/config/-
deploy.applicationProperties.propertiesThe application.properties file contents--
deploy.volumeMountsFreeform volume mounts-More information: https://kubernetes.io/docs/concepts/storage/volumes/
deploy.volumesFreeform volumes-More information: https://kubernetes.io/docs/concepts/storage/volumes/
deploy.initContainersFreeform init containers-More information: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
deploy.extraContainersFreeform containers-More information: https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates
global.nameOverrideOverrides the release name-Resources are named after the release name. Set this value if you want to override the release name.

JVM vs Native Modes

This chart supports building Quarkus in both jvm and native modes.

  • If build.mode is jvm, Helm will create a BuildConfig with git source and the Source strategy.

  • If build.mode is native, Helm will create a BuildConfig with git source and the Docker strategy. Additionally, if build.native.useDefaultDockerfile is true, Helm will provide a default Dockerfile as a second input for building a native Quarkus binary. Below is the default Dockerfile that will be used:

    FROM registry.redhat.io/quarkus/mandrel-20-rhel8 AS builder
    WORKDIR /build/
    COPY . /build/
    RUN ./mvnw clean package -Pnative
    
    FROM registry.redhat.io/ubi8/ubi-minimal
    WORKDIR /deployments/
    COPY --from=builder /build/target/*-runner /deployments/application
    RUN chmod 110 /deployments/application
    CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]
    

    If you wish to use the default Dockerfile, you must have the mvnw executable located in your project root.

    If you wish to override the default Dockerfile, you can set build.native.useDefaultDockerfile to false and provide your own Dockerfile in your project root.

Deploy quarkus with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has quarkus 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 chartquarkus is pinned at v0.0.3 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