diff --git a/charts/eap-xp3/.helmignore b/charts/eap-xp3/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/eap-xp3/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/eap-xp3/Chart.yaml b/charts/eap-xp3/Chart.yaml new file mode 100644 index 0000000..4c4459b --- /dev/null +++ b/charts/eap-xp3/Chart.yaml @@ -0,0 +1,14 @@ +apiVersion: v2 +name: eap-xp3 +description: Build and Deploy EAP XP3 applications on OpenShift +type: application +version: 1.0.0 + +appVersion: "3.0" + +dependencies: +- name: wildfly-common + version: 1.3.0 + repository: https://docs.wildfly.org/wildfly-charts/ + # for local development + #repository: file://../../../wildfly-charts/charts/wildfly-common diff --git a/charts/eap-xp3/README.md b/charts/eap-xp3/README.md new file mode 100644 index 0000000..4fc7618 --- /dev/null +++ b/charts/eap-xp3/README.md @@ -0,0 +1,104 @@ +# Helm Chart for EAP XP3 + +A Helm chart for building and deploying a [JBoss EAP XP3](https://www.redhat.com/en/technologies/jboss-middleware/application-platform) application on OpenShift. + +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 application image (coming from the `build` output or from an external Docker registry) and the output is a `Deployment` and other related resources to access the application from inside and outside OpenShift. + +## Prerequisites +Below are prerequisites that may apply to your use case. + +### Pull Secret +You will need to create a pull secret to pull the EAP Builder and Runtime images from the Red Hat Container Catalog that requires authentication. Use the following command as a reference to create your pull secret: +```bash +$ oc create secret docker-registry my-pull-secret --docker-server=registry.redhat.io --docker-username=$USERNAME --docker-password=$PASSWORD --docker-email=$EMAIL +``` + +You can use this secret by passing `--set build.pullSecret=eap-pull-secret` to `helm install`, or you can configure this in a values file: + +```yaml +build: + pullSecret: eap-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: + +```bash +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: + +```yaml +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. + +| Value | Description | Default | Additional Information | +| ----- | ----------- | ------- | ---------------------- | +| `image.name` | Name of the image you want to build/deploy | Defaults to the Helm release name. | The chart will create/reference an [ImageStream](https://docs.openshift.com/container-platform/latest/openshift_images/image-streams-manage.html) based on this value. | +| `image.tag` | Tag that you want to build/deploy | `latest` | The chart will create/reference an [ImageStreamTag](https://docs.openshift.com/container-platform/latest/openshift_images/image-streams-manage.html#images-using-imagestream-tags_image-streams-managing) based on the name provided | + +## Building the Application + +The configuration to build the application image is configured in a `build` section. + +| Value | Description | Default | Additional Information | +| ----- | ----------- | ------- | ---------------------- | +| `build.enabled` | Determines if build-related resources should be created. | `true` | Set 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.uri` | Git URI that references your git repo | <required> | Be sure to specify this to build the application. | +| `build.ref` | Git ref containing the application you want to build | `main` | - | +| `build.contextDir` | The sub-directory where the application source code exists | - | - | +| `build.output.kind`| Determines if the image will be pushed to an `ImageStreamTag` or a `DockerImage` | `ImageStreamTag` | [OpenShift Documentation](https://docs.openshift.com/container-platform/4.6/builds/managing-build-output.html) | +| `build.output.pushSecret` | Push secret name | - | The secret must exist in the same namespace or the chart will fail to install - Used only if `build.output.kind` is `DockerImage` | +| `build.pullSecret` | Image pull secret | - | The secret must exist in the same namespace or the chart will fail to install - [OpenShift documentation](https://docs.openshift.com/container-platform/latesst/openshift_images/managing_images/using-image-pull-secrets.html) | +| `build.mode` | Determines whether the application will be built using WildFly S2I images or Bootable Jar | `bootable-jar` | Allowed values: `s2i` or `bootable-jar` | +| `build.env` | Freeform `env` items | - | [Kubernetes documentation](https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/). 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.resources` | Freeform `resources` items | - | [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) | +| `build.images`| Freeform images injected in the source during build | - | [OpenShift documentation](https://docs.openshift.com/container-platform/latest/builds/creating-build-inputs.html#builds-define-build-inputs_creating-build-inputs) | +| `build.triggers.githubSecret`| Name 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](https://docs.openshift.com/container-platform/latest/cicd/builds/triggering-builds-build-hooks.html#builds-webhook-triggers_triggering-builds-build-hooks) | +| `build.triggers.genericSecret`| Name 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](https://docs.openshift.com/container-platform/latest/cicd/builds/triggering-builds-build-hooks.html#builds-webhook-triggers_triggering-builds-build-hooks) | +| `build.s2i` | Configuration specific to building with EAP S2I images | - | - | +| `build.s2i.version` | Version of the EAP S2I images | Defaults to this chart `AppVersion` | - | +| `build.s2i.jdk` | JDK Version of the EAP S2I images | `"11"` | Allowed Values: `"11"` | +| `build.s2i.arch` | Architecture of the EAP S2I images | `amd64` | Allowed Values: `amd64` | +| `build.s2i.amd64.jdk11.builderImage` | EAP S2I Builder image for JDK 11 (for amd64 arch)| `registry.redhat.io/jboss-eap-7/eap-xp3-openjdk11-openshift-rhel8` | [EAP Documentation](https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.4/html/getting_started_with_jboss_eap_for_openshift_container_platform/index) | +| `build.s2i.amd64.jdk11.runtimeImage` | EAP S2I Runtime image for JDK 11 (for amd64 arch)| `registry.redhat.io/jboss-eap-7/eap-xp3-openjdk11-runtime-openshift-rhel8` | [EAP Documentation](https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.4/html/getting_started_with_jboss_eap_for_openshift_container_platform/index) | +| `build.s2i.galleonLayers` | A list of layer names to compose a EAP server | - | [EAP Documentation](https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.4/html/getting_started_with_jboss_eap_for_openshift_container_platform/index) | + | `build.s2i.galleonDir` | Directory relative to the root directory for the build that contains custom content for Galleon. | - | [EAP Documentation](https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.4/html/getting_started_with_jboss_eap_for_openshift_container_platform/index)| + | `build.s2i.featurePacks` | List of additional Galleon feature-packs identified by Maven coordinates (`::`) | - | 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 - [EAP Documentation](https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.4/html/getting_started_with_jboss_eap_for_openshift_container_platform/index) | +| `build.bootableJar.builderImage` | JDK Builder image for Bootable Jar | [registry.access.redhat.com/ubi8/openjdk-11:latest](https://catalog.redhat.com/software/containers/ubi8/openjdk-11/5dd6a4b45a13461646f677f4?gti-tabs=unauthenticated) | - | + + +## Deploying the Application + +The configuration to build the application image is configured in a `deploy` section. + +| Value | Description | Default | Additional Information | +| ----- | ----------- | ------- | ---------------------- | +| `deploy.enabled` | Determines if deployment-related resources should be created. | `true` | Set this to `false` if you do not want to deploy an application image built by this chart. | +| `deploy.replicas` | Number of pod replicas to deploy. | `1` | [OpenShift Documentation](https://docs.openshift.com/container-platform/latest/applications/deployments/what-deployments-are.html) | +| `deploy.route.enabled` | Determines if a `Route` should be created | `true` | Allows clients outside of OpenShift to access your application | +| `deploy.route.tls.enabled` | Determines if the `Route` should be TLS-encrypted | `true`| [OpenShift Documentation](https://docs.openshift.com/container-platform/latest/networking/routes/secured-routes.html) | +| `deploy.route.tls.termination` | Determines the type of TLS termination to use | `edge`| Allowed values: `edge, reencrypt, passthrough` | +| `deploy.route.tls.insecureEdgeTerminationPolicy` | Determines if insecure traffic should be redirected | `Redirect` | Allowed values: `Allow, Disable, Redirect` | +| `deploy.env` | Freeform `env` items | - | [Kubernetes documentation](https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/). 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.envFrom` | Freeform `envFrom` items | - | [Kubernetes documentation](https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/). 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.resources` | Freeform `resources` items | - | [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) | +| `deploy.livenessProbe` | Freeform `livenessProbe` field. | HTTP Get on `:admin/health/live` | [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/) | +| `deploy.readinessProbe` | Freeform `readinessProbe` field. | HTTP Get on `:admin/health/ready` | [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/) | +| `deploy.volumeMounts` | Freeform `volumeMounts` items| - | [Kubernetes Documentation](https://kubernetes.io/docs/concepts/storage/volumes/) | +| `deploy.volumes` | Freeform `volumes` items| - | [Kubernetes Documentation](https://kubernetes.io/docs/concepts/storage/volumes/) | +| `deploy.initContainers` | Freeform `initContainers` items | - | [Kubernetes Documentation](https://kubernetes.io/docs/concepts/workloads/pods/init-containers/) | +| `deploy.extraContainers` | Freeform extra `containers` items | - | [Kubernetes Documentation](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates) | \ No newline at end of file diff --git a/charts/eap-xp3/templates/NOTES.txt b/charts/eap-xp3/templates/NOTES.txt new file mode 100644 index 0000000..b4d1e29 --- /dev/null +++ b/charts/eap-xp3/templates/NOTES.txt @@ -0,0 +1,18 @@ +{{- if .Release.IsInstall }} + +{{- if .Values.build.enabled }} +Your EAP XP3 application is building! To follow the build, run: + +$ oc get build -w + +Note that your Deployment will report "ErrImagePull" and "ImagePullBackOff" until the build is complete. Once the build is complete, your image will be automatically rolled out. +{{- end }} + +{{- if .Values.deploy.enabled }} + +To follow the deployment of your application, run: + +$ oc get deployment {{ include "wildfly-common.appName" . }} -w +{{- end }} + +{{- end }} \ No newline at end of file diff --git a/charts/eap-xp3/templates/_helpers.tpl b/charts/eap-xp3/templates/_helpers.tpl new file mode 100644 index 0000000..2ad88cb --- /dev/null +++ b/charts/eap-xp3/templates/_helpers.tpl @@ -0,0 +1,59 @@ + +{{/* +eap-xp3.eapBuilderImage corresponds to the imagestream for the EAP S2I Builder image. +It depends on the build.s2i.jdkVersion. + +TODO: the build.s2i.arch is not used and is hard-coded to "amd64". +When we add support for Z-Series and PowerPC, we will rely on the value of build.s2i.arch +to get the proper S2I images (and validate that only jdk11 can be used with Z & P) +*/}} +{{- define "eap-xp3.eapBuilderImage" -}} +{{ .Values.build.s2i.amd64.jdk11.builderImage}}:{{ include "eap-xp3.version" . }} +{{- end -}} + +{{/* +eap-xp3.eapRuntimeImage corresponds to the imagestream for the EAP S2I Runtime image. +It depends on the build.s2i.jdkVersion. +*/}} +{{- define "eap-xp3.eapRuntimeImage" -}} +{{ .Values.build.s2i.amd64.jdk11.runtimeImage}}:{{ include "eap-xp3.version" . }} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "eap-xp3.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +If build.s2i.version is not defined, use by defaul the Chart's appVersion +*/}} +{{- define "eap-xp3.version" -}} +{{- default .Chart.AppVersion .Values.build.s2i.version -}} +{{- end -}} + + +{{- define "eap-xp3.labels" -}} +helm.sh/chart: {{ include "eap-xp3.chart" . }} +{{ include "wildfly-common.selectorLabels" . }} +app.kubernetes.io/version: {{ quote .Chart.AppVersion }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +app.openshift.io/runtime: eap-xp +{{- end }} + +{{- define "eap-xp3.metering.labels" -}} +com.company: "Red_Hat" +com.redhat.product-name: "Red_Hat_Runtimes" +com.redhat.product-version: "2021-Q3" +com.redhat.component-name: EAP_XP +com.redhat.component-version: {{ quote .Chart.AppVersion }} +com.redhat.component-type: application +{{- end }} + +{{- define "eap-xp3.metadata.labels" -}} +metadata: + labels: + {{- include "eap-xp3.labels" . | nindent 4 }} + {{- include "eap-xp3.metering.labels" . | nindent 4 }} +{{- end -}} \ No newline at end of file diff --git a/charts/eap-xp3/templates/buildconfig-bootable-jar.yaml b/charts/eap-xp3/templates/buildconfig-bootable-jar.yaml new file mode 100644 index 0000000..1d88c7d --- /dev/null +++ b/charts/eap-xp3/templates/buildconfig-bootable-jar.yaml @@ -0,0 +1,3 @@ +{{- if and .Values.build.enabled (eq .Values.build.mode "bootable-jar") }} +{{- include "wildfly-common.buildconfig-bootable-jar" (list . "eap-xp3.metadata.labels") -}} +{{- end }} \ No newline at end of file diff --git a/charts/eap-xp3/templates/buildconfig-s2i-build-artifacts.yaml b/charts/eap-xp3/templates/buildconfig-s2i-build-artifacts.yaml new file mode 100644 index 0000000..5be2743 --- /dev/null +++ b/charts/eap-xp3/templates/buildconfig-s2i-build-artifacts.yaml @@ -0,0 +1,13 @@ +{{- if and .Values.build.enabled (eq .Values.build.mode "s2i") }} +{{- include "wildfly-common.buildconfig-s2i-build-artifacts" (list . "eap-xp3.buildconfig-s2i-build-artifacts") -}} +{{- end -}} + +{{- define "eap-xp3.buildconfig-s2i-build-artifacts" -}} +{{ include "eap-xp3.metadata.labels" . }} +spec: + strategy: + sourceStrategy: + from: + kind: DockerImage + name: {{ include "eap-xp3.eapBuilderImage" . }} +{{- end -}} \ No newline at end of file diff --git a/charts/eap-xp3/templates/buildconfig-s2i.yaml b/charts/eap-xp3/templates/buildconfig-s2i.yaml new file mode 100644 index 0000000..57e4ef0 --- /dev/null +++ b/charts/eap-xp3/templates/buildconfig-s2i.yaml @@ -0,0 +1,21 @@ +{{- if and .Values.build.enabled (eq .Values.build.mode "s2i") }} +{{- include "wildfly-common.buildconfig-s2i" (list . "eap-xp3.buildconfig-s2i") -}} +{{- end -}} + +{{- define "eap-xp3.buildconfig-s2i" -}} +{{ include "eap-xp3.metadata.labels" . }} +spec: + source: + dockerfile: |- + FROM {{ include "eap-xp3.eapRuntimeImage" . }} + COPY /server $JBOSS_HOME + USER root + RUN chown -R jboss:root $JBOSS_HOME && chmod -R ug+rwX $JBOSS_HOME + USER jboss + CMD $JBOSS_HOME/bin/openshift-launch.sh + strategy: + dockerStrategy: + from: + kind: DockerImage + name: {{ include "eap-xp3.eapRuntimeImage" .}} +{{- end -}} \ No newline at end of file diff --git a/charts/eap-xp3/templates/deployment.yaml b/charts/eap-xp3/templates/deployment.yaml new file mode 100644 index 0000000..b90d275 --- /dev/null +++ b/charts/eap-xp3/templates/deployment.yaml @@ -0,0 +1,10 @@ +{{- if .Values.deploy.enabled }} +{{- include "wildfly-common.deployment" (list . "eap-xp3.deployment") -}} +{{- end -}} + +{{ define "eap-xp3.deployment" }} +{{- include "eap-xp3.metadata.labels" . }} +spec: + template: + {{- include "eap-xp3.metadata.labels" . | nindent 4 }} +{{- end -}} \ No newline at end of file diff --git a/charts/eap-xp3/templates/imagestream.yaml b/charts/eap-xp3/templates/imagestream.yaml new file mode 100644 index 0000000..2f96fbf --- /dev/null +++ b/charts/eap-xp3/templates/imagestream.yaml @@ -0,0 +1,8 @@ +{{- if and .Values.build.enabled (eq .Values.build.output.kind "ImageStreamTag") -}} +{{- include "wildfly-common.imagestream" (list . "eap-xp3.metadata.labels") }} + +{{- if eq .Values.build.mode "s2i" }} +--- +{{- include "wildfly-common.imagestream-s2i-build-artifacts" (list . "eap-xp3.metadata.labels") }} +{{- end -}} +{{- end -}} \ No newline at end of file diff --git a/charts/eap-xp3/templates/route.yaml b/charts/eap-xp3/templates/route.yaml new file mode 100644 index 0000000..7061980 --- /dev/null +++ b/charts/eap-xp3/templates/route.yaml @@ -0,0 +1,3 @@ +{{- if (and .Values.deploy.enabled .Values.deploy.route.enabled) }} +{{- include "wildfly-common.route" (list . "eap-xp3.metadata.labels") -}} +{{- end -}} \ No newline at end of file diff --git a/charts/eap-xp3/templates/service.yaml b/charts/eap-xp3/templates/service.yaml new file mode 100644 index 0000000..965375d --- /dev/null +++ b/charts/eap-xp3/templates/service.yaml @@ -0,0 +1,5 @@ +{{- if .Values.deploy.enabled }} +{{- include "wildfly-common.service.http" (list . "eap-xp3.metadata.labels") }} +--- +{{- include "wildfly-common.service.ping" (list . "eap-xp3.metadata.labels") }} +{{- end -}} \ No newline at end of file diff --git a/charts/eap-xp3/values.schema.json b/charts/eap-xp3/values.schema.json new file mode 100644 index 0000000..86b8140 --- /dev/null +++ b/charts/eap-xp3/values.schema.json @@ -0,0 +1,593 @@ +{ + "$schema": "http://json-schema.org/schema#", + "type": "object", + "properties": { + "image": { + "type": ["object", "null"], + "properties": { + "name": { + "description": "Name of the application image. If not specified, the name of the Helm release will be used.", + "type": ["string", "null"] + }, + "tag": { + "description": "Tag of the application image", + "type": ["string", "null"], + "default": "latest" + } + } + }, + "build": { + "description": "Configuration to build the application image", + "type": "object", + "properties": { + "enabled": { + "description": "Enable/Disable building the application image", + "type": "boolean", + "default": true + }, + "mode": { + "description": "Which mode to use to build the application", + "type": "string", + "enum": ["s2i", "bootable-jar"], + "default": "bootable-jar" + }, + "uri": { + "description": "URI of GitHub repository", + "type": "string" + }, + "ref": { + "description": "Git reference", + "type": ["string", "null"] + }, + "contextDir": { + "description": "Context directory within your Git repo to use as the root for the build", + "type": ["string", "null"] + }, + "pullSecret": { + "description": "Name of the Pull Secret", + "type": ["string", "null"] + }, + "output": { + "description": "Configuration for the built application image", + "type": "object", + "properties": { + "kind": { + "description": "Determines where the application images will be pushed", + "type": "string", + "enum": ["ImageStreamTag", "DockerImage"], + "default": "ImageStreamTag" + }, + "pushSecret": { + "description": "Name of the Push Secret", + "type": ["string", "null"] + } + } + }, + "env": { + "description": "List of environment variables to set in the container. Cannot be updated.", + "items": { + "description": "EnvVar represents an environment variable present in a Container.", + "properties": { + "name": { + "description": "Name of the environment variable. Must be a C_IDENTIFIER.", + "type": "string" + }, + "value": { + "description": "Variable references $(VAR_NAME) are expanded using the previous defined environment variables in the container and any service environment variables. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Defaults to \"\".", + "type": [ + "string", + "null" + ] + }, + "valueFrom": { + "description": "EnvVarSource represents a source for the value of an EnvVar.", + "properties": { + "configMapKeyRef": { + "description": "Selects a key from a ConfigMap.", + "properties": { + "key": { + "description": "The key to select.", + "type": "string" + }, + "name": { + "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + "type": [ + "string", + "null" + ] + }, + "optional": { + "description": "Specify whether the ConfigMap or its key must be defined", + "type": "boolean" + } + }, + "required": [ + "key" + ], + "type": "object" + }, + "fieldRef": { + "description": "ObjectFieldSelector selects an APIVersioned field of an object.", + "properties": { + "apiVersion": { + "description": "Version of the schema the FieldPath is written in terms of, defaults to \"v1\".", + "type": [ + "string", + "null" + ] + }, + "fieldPath": { + "description": "Path of the field to select in the specified API version.", + "type": "string" + } + }, + "required": [ + "fieldPath" + ], + "type": "object" + }, + "resourceFieldRef": { + "description": "ResourceFieldSelector represents container resources (cpu, memory) and their output format", + "properties": { + "containerName": { + "description": "Container name: required for volumes, optional for env vars", + "type": [ + "string", + "null" + ] + }, + "divisor": { + "oneOf": [ + { + "type": [ + "string", + "null" + ] + }, + { + "type": "integer" + } + ] + }, + "resource": { + "description": "Required: resource to select", + "type": "string" + } + }, + "required": [ + "resource" + ], + "type": "object" + }, + "secretKeyRef": { + "description": "SecretKeySelector selects a key of a Secret.", + "properties": { + "key": { + "description": "The key of the secret to select from. Must be a valid secret key.", + "type": "string" + }, + "name": { + "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + "type": [ + "string", + "null" + ] + }, + "optional": { + "description": "Specify whether the Secret or its key must be defined", + "type": "boolean" + } + }, + "required": [ + "key" + ], + "type": "object" + } + }, + "type": "object" + } + }, + "required": [ + "name" + ], + "type": "object" + }, + "type": [ + "array", + "null" + ] + }, + "resources": { + "description": "Freeform resources field. More information: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/" + }, + "images": { + "description": "Freeform images injected in the source during build." + }, + "triggers": { + "description": "Webhooks to trigger building the application image", + "type": ["object", "null"], + "properties": { + "githubSecret": { + "description": "Name of the secret containing the WebHookSecretKey for the GitHub Webhook", + "type": "string" + }, + "genericSecret": { + "description": "Name of the secret containing the WebHookSecretKey for the Generic Webhook", + "type": "string" + } + } + }, + "s2i": { + "description": "Configuration specific to S2I Build (applicable only if build mode is set to s2i)", + "type": ["object", "null"], + "properties": { + "version": { + "description": "EAP 7 version. If not specified, the Helm's appVersion will be used instead.", + "type": ["string", "null"] + }, + "arch": { + "description": "Architecture of the EAP S2I images", + "type": "string", + "enum": ["amd64"], + "default": "amd64" + }, + "jdk": { + "description": "JDK Version of the EAP S2I images", + "type": "string", + "enum": ["11"], + "default": "11" + }, + "amd64": { + "description": "EAP S2I images for amd64 architecture", + "type": "object", + "properties": { + "jdk8": { + "type": "object", + "properties": { + "builderImage": { + "description": "EAP S2I Builder image for JDK 8", + "type": "string" + }, + "runtimeImage": { + "description": "EAP S2I Runtime image for JDK 8", + "type": "string" + } + } + }, + "jdk11": { + "type": "object", + "properties": { + "builderImage": { + "description": "EAP S2I Builder image for JDK 11", + "type": "string" + }, + "runtimeImage": { + "description": "EAP S2I Runtime image for JDK 11", + "type": "string" + } + } + } + } + }, + "galleonLayers": { + "description": "List of Galleon Layers to provision", + "type": ["string", "array", "null"], + "items": { + "type": "string" + }, + "featurePacks": { + "description": "List of additional Galleon feature-packs identified by Maven coordinates (`::`)", + "type": ["string", "array", "null"], + "items": { + "type": "string" + } + }, + "galleonDir": { + "description": "Directory relative to the root directory for the build that contains custom content for Galleon.", + "type": ["string", "null"] + } + } + } + }, + "bootableJar": { + "description": "Configuration specific to Bootable Jar Build (applicable only if build mode is set to bootable-jar)", + "type": ["object", "null"], + "properties": { + "builderImage": { + "description": "The JDK Builder image", + "type": ["string", "null"] + } + } + } + } + }, + "deploy": { + "description": "Configuration to deploy the application", + "type": "object", + "properties": { + "enabled": { + "description": "Enable/Disable deploying the application image", + "type": "boolean", + "default": true + }, + "replicas": { + "type": "integer", + "description": "Number of pod replicas to deploy" + }, + "resources": { + "description": "Freeform resources requirements to deploy the application image" + }, + "env": { + "description": "List of environment variables to set in the container. Cannot be updated.", + "items": { + "description": "EnvVar represents an environment variable present in a Container.", + "properties": { + "name": { + "description": "Name of the environment variable. Must be a C_IDENTIFIER.", + "type": "string" + }, + "value": { + "description": "Variable references $(VAR_NAME) are expanded using the previous defined environment variables in the container and any service environment variables. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Defaults to \"\".", + "type": [ + "string", + "null" + ] + }, + "valueFrom": { + "description": "EnvVarSource represents a source for the value of an EnvVar.", + "properties": { + "configMapKeyRef": { + "description": "Selects a key from a ConfigMap.", + "properties": { + "key": { + "description": "The key to select.", + "type": "string" + }, + "name": { + "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + "type": [ + "string", + "null" + ] + }, + "optional": { + "description": "Specify whether the ConfigMap or its key must be defined", + "type": "boolean" + } + }, + "required": [ + "key" + ], + "type": "object" + }, + "fieldRef": { + "description": "ObjectFieldSelector selects an APIVersioned field of an object.", + "properties": { + "apiVersion": { + "description": "Version of the schema the FieldPath is written in terms of, defaults to \"v1\".", + "type": [ + "string", + "null" + ] + }, + "fieldPath": { + "description": "Path of the field to select in the specified API version.", + "type": "string" + } + }, + "required": [ + "fieldPath" + ], + "type": "object" + }, + "resourceFieldRef": { + "description": "ResourceFieldSelector represents container resources (cpu, memory) and their output format", + "properties": { + "containerName": { + "description": "Container name: required for volumes, optional for env vars", + "type": [ + "string", + "null" + ] + }, + "divisor": { + "oneOf": [ + { + "type": [ + "string", + "null" + ] + }, + { + "type": "integer" + } + ] + }, + "resource": { + "description": "Required: resource to select", + "type": "string" + } + }, + "required": [ + "resource" + ], + "type": "object" + }, + "secretKeyRef": { + "description": "SecretKeySelector selects a key of a Secret.", + "properties": { + "key": { + "description": "The key of the secret to select from. Must be a valid secret key.", + "type": "string" + }, + "name": { + "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + "type": [ + "string", + "null" + ] + }, + "optional": { + "description": "Specify whether the Secret or its key must be defined", + "type": "boolean" + } + }, + "required": [ + "key" + ], + "type": "object" + } + }, + "type": "object" + } + }, + "required": [ + "name" + ], + "type": "object" + }, + "type": [ + "array", + "null" + ] + }, + "envFrom": { + "description": "List of sources to populate environment variables in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence. Cannot be updated.", + "items": { + "description": "EnvFromSource represents the source of a set of ConfigMaps", + "properties": { + "configMapRef": { + "description": "ConfigMapEnvSource selects a ConfigMap to populate the environment variables with.\n\nThe contents of the target ConfigMap's Data field will represent the key-value pairs as environment variables.", + "properties": { + "name": { + "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + "type": [ + "string", + "null" + ] + }, + "optional": { + "description": "Specify whether the ConfigMap must be defined", + "type": "boolean" + } + }, + "type": "object" + }, + "prefix": { + "description": "An optional identifier to prepend to each key in the ConfigMap. Must be a C_IDENTIFIER.", + "type": [ + "string", + "null" + ] + }, + "secretRef": { + "description": "SecretEnvSource selects a Secret to populate the environment variables with.\n\nThe contents of the target Secret's Data field will represent the key-value pairs as environment variables.", + "properties": { + "name": { + "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", + "type": [ + "string", + "null" + ] + }, + "optional": { + "description": "Specify whether the Secret must be defined", + "type": "boolean" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "type": [ + "array", + "null" + ] + }, + "route": { + "description": "Route configuration", + "type": "object", + "properties": { + "enabled": { + "description": "Enable/Disable creating a Route for the application", + "default": true, + "type": "boolean" + }, + "tls": { + "description": "TLS Configuration for the Route", + "type": "object", + "properties": { + "enabled" : { + "description": "Determines if the Route should be TLS-encrypted", + "default": true, + "type": "boolean" + }, + "termination": { + "description": "Determines the type of TLS termination to use", + "type": "string", + "enum": ["edge", "reencrypt", "passthrough"], + "default": "edge" + }, + "insecureEdgeTerminationPolicy": { + "description": "Determines if insecure traffic should be redirected", + "type": "string", + "enum": ["Allow", "Disable", "Redirect"], + "default": "Redirect" + } + } + } + } + }, + "livenessProbe": { + "description": "Freeform livenessProbe configuration" + }, + "readinessProbe": { + "description": "Freeform livenessProbe configuration" + }, + "volumeMounts": { + "description": "Freeform array of volumeMounts", + "type": ["array", "null"], + "items": { + "description": "VolumeMount describes a mounting of a Volume within a container.", + "required": ["name", "mountPath"], + "properties": { + "mountPath": { + "description": "Path within the container at which the volume should be mounted. Must not contain ':'.", + "type": "string" + }, + "mountPropagation": { + "description": "mountPropagation determines how mounts are propagated from the host to container and the other way around. When not set, MountPropagationHostToContainer is used. This field is alpha in 1.8 and can be reworked or removed in a future release.", + "type": ["string", "null"] + }, + "name": { + "description": "This must match the Name of a Volume.", + "type": "string" + }, + "readOnly": { + "description": "Mounted read-only if true, read-write otherwise (false or unspecified). Defaults to false.", + "type": "boolean" + }, + "subPath": { + "description": "Path within the volume from which the container's volume should be mounted. Defaults to \"\" (volume's root).", + "type": ["string","null"] + } + } + } + }, + "volumes": { + "description": "Freeform array of volumes", + "type": [ "array", "null"] + }, + "initContainers": { + "description": "Freeform array of initContainers", + "type": [ "array", "null"] + }, + "extraContainers": { + "description": "Freeform array of extra containers", + "type": [ "array", "null"] + } + } + } + } +} diff --git a/charts/eap-xp3/values.yaml b/charts/eap-xp3/values.yaml new file mode 100644 index 0000000..ab06fb5 --- /dev/null +++ b/charts/eap-xp3/values.yaml @@ -0,0 +1,42 @@ +# Default values for wildfly +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +image: + tag: latest +build: + enabled: true + mode: bootable-jar + bootableJar: + builderImage: registry.access.redhat.com/ubi8/openjdk-11:latest + s2i: + version: latest + jdk: "11" + arch: amd64 + amd64: + jdk11: + builderImage: registry.redhat.io/jboss-eap-7/eap-xp3-openjdk11-openshift-rhel8 + runtimeImage: registry.redhat.io/jboss-eap-7/eap-xp3-openjdk11-runtime-openshift-rhel8 + output: + kind: "ImageStreamTag" + triggers: {} +deploy: + enabled: true + replicas: 1 + route: + enabled: true + tls: + enabled: true + termination: edge + insecureEdgeTerminationPolicy: Redirect + livenessProbe: + httpGet: + path: /health/live + port: admin + initialDelaySeconds: 60 + readinessProbe: + httpGet: + path: /health/ready + port: admin + initialDelaySeconds: 60 + diff --git a/examples/eap-xp3/microprofile-config/README.adoc b/examples/eap-xp3/microprofile-config/README.adoc new file mode 100644 index 0000000..93493fe --- /dev/null +++ b/examples/eap-xp3/microprofile-config/README.adoc @@ -0,0 +1,77 @@ +# Install a MicroProfile Application +:toc: left +:icons: font +:idprefix: +:idseparator: - +:keywords: openshift,wildfly,microprofile,helm + +This example shows how to deploy an Eclipse MicroProfile application with EAP XP 3 on OpenShift. + +## Prerequisites + +## Source Code + +The source code for the backend is hosted at https://github.com/jboss-developer/jboss-eap-quickstarts.git + +It is a simple MicroProfile application that uses JAX-RS to exposes HTTP endpoints that displays text configured with MicroProfile Config. + +When the application is deployed on OpenShift, it uses the `CONFIG_PROP` environment variable as the source of its config property. +This environment variable is specified in the `deploy.env` section of the Helm Chart. + +## Installation + +The application can be built with Bootable Jar or using WildFly S2I images. + +### Installation with Bootable Jar + +The application can be compiled as a Bootable Jar. +In that case, the Helm Chart is configured with `build.mode=bootable-jar`. + +[source,options="nowrap"] +---- +$ helm install microprofile-config-app -f examples/eap-xp3/microprofile-config/microprofile-config-app.yaml ./charts/eap-xp3 +---- + +## Deployment + +Once the chart is installed, let's wait for the application to be built and deployed: + +[source,options="nowrap"] +---- +$ oc get deployment/microprofile-config-app -w +NAME READY UP-TO-DATE AVAILABLE AGE +microprofile-config-app 0/1 1 0 27s +... +microprofile-config-app 1/1 1 1 5m29s +---- + +## Use the application + +Once the application is deployed on OpenShift, it can be accessed from the route `microprofile-config-app`. +Let's find the host that we can use to connect to this backend: + +[source,options="nowrap"] +---- +$ oc get route microprofile-config-app -o jsonpath="{.spec.host}" +microprofile-config-app-jmesnil1-dev.apps.sandbox.x8i5.p1.openshiftapps.com +---- + +This value will be different for every installation of the application. + +We can then query this application by calling one of its HTTP endpoints: + +[source,options="nowrap"] +---- +$ curl -L $(oc get route microprofile-config-app -o jsonpath="{.spec.host}")/config/value +Hello from OpenShift +---- + +## Clean up + +The application can be deleted by running the command: + +[source,options="nowrap"] +---- +$ helm delete microprofile-config-app +release "microprofile-config-app" uninstalled +---- diff --git a/examples/eap-xp3/microprofile-config/microprofile-config-app.yaml b/examples/eap-xp3/microprofile-config/microprofile-config-app.yaml new file mode 100644 index 0000000..b29fbf9 --- /dev/null +++ b/examples/eap-xp3/microprofile-config/microprofile-config-app.yaml @@ -0,0 +1,19 @@ +build: + uri: https://github.com/jboss-developer/jboss-eap-quickstarts.git + ref: XP_3.0.0.GA + mode: bootable-jar + env: + - name: ARTIFACT_DIR + value: microprofile-config/target + - name: MAVEN_ARGS_APPEND + # Use the bootable-jar-openshift profile to ensure that the application + # can be deployed on OpenShift but disable JKube as the image will be + # built and deployed by this chart. + value: -am -pl microprofile-config -Pbootable-jar-openshift -Djkube.skip=true + - name: MAVEN_OPTS + value: '-XX:MetaspaceSize=251m -XX:MaxMetaspaceSize=256m' +deploy: + replicas: 1 + env: + - name: CONFIG_PROP + value: Hello from OpenShift \ No newline at end of file