Chapter 10. OpenShift deployment options with the RHPAM Kogito Operator After you create your Red Hat build of Kogito microservices as part of a business application, you can use the Red Hat OpenShift Container Platform web console to deploy your microservices. The RHPAM Kogito Operator page in the OpenShift web console guides you through the deployment process. The RHPAM Kogito Operator supports the following options for building and deploying Red Hat build of Kogito microservices on Red Hat OpenShift Container Platform: Git source build and deployment Binary build and deployment Custom image build and deployment File build and deployment 10.1. Deploying Red Hat build of Kogito microservices on OpenShift using Git source build and OpenShift web console The RHPAM Kogito Operator uses the following custom resources to deploy domain-specific microservices (the microservices that you develop): KogitoBuild builds an application using the Git URL or other sources and produces a runtime image. KogitoRuntime starts the runtime image and configures it as per your requirements. In most use cases, you can use the standard runtime build and deployment method to deploy Red Hat build of Kogito microservices on OpenShift from a Git repository source, as shown in the following procedure. Note If you are developing or testing your Red Hat build of Kogito microservice locally, you can use the binary build, custom image build, or file build option to build and deploy from a local source instead of from a Git repository. Prerequisites The RHPAM Kogito Operator is installed. The application with your Red Hat build of Kogito microservices is in a Git repository that is reachable from your OpenShift environment. You have access to the OpenShift web console with the necessary permissions to create and edit KogitoBuild and KogitoRuntime . (Red Hat build of Quarkus only) The pom.xml file of your project contains the following dependency for the quarkus-smallrye-health extension. This extension enables the liveness and readiness probes that are required for Red Hat build of Quarkus projects on OpenShift. SmallRye Health dependency for Red Hat build of Quarkus applications on OpenShift <dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-smallrye-health</artifactId> </dependency> Procedure Go to Operators Installed Operators and select RHPAM Kogito Operator . To create the Red Hat build of Kogito build definition, on the operator page, select the Kogito Build tab and click Create KogitoBuild . In the application window, use Form View or YAML View to configure the build definition. At a minimum, define the application configurations shown in the following example YAML file: Example YAML definition for a Red Hat build of Quarkus application with Red Hat build of Kogito build apiVersion: rhpam.kiegroup.org/v1 # Red Hat build of Kogito API for this service kind: KogitoBuild # Application type metadata: name: example-quarkus # Application name spec: type: RemoteSource gitSource: uri: 'https://github.com/kiegroup/kogito-examples' # Git repository containing application (uses default branch) contextDir: dmn-quarkus-example # Git folder location of application Example YAML definition for a Spring Boot application with Red Hat build of Kogito build apiVersion: rhpam.kiegroup.org/v1 # Red Hat build of Kogito API for this service kind: KogitoBuild # Application type metadata: name: example-springboot # Application name spec: runtime: springboot type: RemoteSource gitSource: uri: 'https://github.com/kiegroup/kogito-examples' # Git repository containing application (uses default branch) contextDir: dmn-springboot-example # Git folder location of application Note If you configured an internal Maven repository, you can use it as a Maven mirror service and specify the Maven mirror URL in your Red Hat build of Kogito build definition to shorten build time substantially: spec: mavenMirrorURL: http://nexus3-nexus.apps-crc.testing/repository/maven-public/ For more information about internal Maven repositories, see the Apache Maven documentation. After you define your application data, click Create to generate the Red Hat build of Kogito build. Your application is listed in the Red Hat build of KogitoBuilds page. You can select the application name to view or modify application settings and YAML details. To create the Red Hat build of Kogito microservice definition, on the operator page, select the Kogito Runtime tab and click Create KogitoRuntime . In the application window, use Form View or YAML View to configure the microservice definition. At a minimum, define the application configurations shown in the following example YAML file: Example YAML definition for a Red Hat build of Quarkus application with Red Hat build of Kogito microservices apiVersion: rhpam.kiegroup.org/v1 # Red Hat build of Kogito API for this microservice kind: KogitoRuntime # Application type metadata: name: example-quarkus # Application name Example YAML definition for a Spring Boot application with Red Hat build of Kogito microservices apiVersion: rhpam.kiegroup.org/v1 # Red Hat build of Kogito API for this microservice kind: KogitoRuntime # Application type metadata: name: example-springboot # Application name spec: runtime: springboot Note In this case, the application is built from Git and deployed using KogitoRuntime. You must ensure that the application name is same in KogitoBuild and KogitoRuntime . After you define your application data, click Create to generate the Red Hat build of Kogito microservice. Your application is listed in the Red Hat build of Kogito microservice page. You can select the application name to view or modify application settings and the contents of the YAML file. In the left menu of the web console, go to Builds Builds to view the status of your application build. You can select a specific build to view build details. Note For every Red Hat build of Kogito microservice that you create for OpenShift deployment, two builds are generated and listed in the Builds page in the web console: a traditional runtime build and a Source-to-Image (S2I) build with the suffix -builder . The S2I mechanism builds the application in an OpenShift build and then passes the built application to the OpenShift build to be packaged into the runtime container image. The Red Hat build of Kogito S2I build configuration also enables you to build the project directly from a Git repository on the OpenShift platform. After the application build is complete, go to Workloads Deployments to view the application deployments, pod status, and other details. After your Red Hat build of Kogito microservice is deployed, in the left menu of the web console, go to Networking Routes to view the access link to the deployed application. You can select the application name to view or modify route settings. With the application route, you can integrate your Red Hat build of Kogito microservices with your business automation solutions as needed. 10.2. Deploying Red Hat build of Kogito microservices on OpenShift using binary build and OpenShift web console OpenShift builds can require extensive amounts of time. As a faster alternative for building and deploying your Red Hat build of Kogito microservices on OpenShift, you can use a binary build. The operator uses the following custom resources to deploy domain-specific microservices (the microservices that you develop): KogitoBuild processes an uploaded application and produces a runtime image. KogitoRuntime starts the runtime image and configures it as per your requirements. Prerequisites The RHPAM Kogito Operator is installed. The oc OpenShift CLI is installed and you are logged in to the relevant OpenShift cluster. For oc installation and login instructions, see the OpenShift documentation . You have access to the OpenShift web console with the necessary permissions to create and edit KogitoBuild and KogitoRuntime . (Red Hat build of Quarkus only) The pom.xml file of your project contains the following dependency for the quarkus-smallrye-health extension. This extension enables the liveness and readiness probes that are required for Red Hat build of Quarkus projects on OpenShift. SmallRye Health dependency for Red Hat build of Quarkus applications on OpenShift <dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-smallrye-health</artifactId> </dependency> Procedure Build an application locally. Go to Operators Installed Operators and select RHPAM Kogito Operator . To create the Red Hat build of Kogito build definition, on the operator page, select the Kogito Build tab and click Create KogitoBuild . In the application window, use Form View or YAML View to configure the build definition. At a minimum, define the application configurations shown in the following example YAML file: Example YAML definition for a Red Hat build of Quarkus application with Red Hat build of Kogito build apiVersion: rhpam.kiegroup.org/v1 # Red Hat build of Kogito API for this service kind: KogitoBuild # Application type metadata: name: example-quarkus # Application name spec: type: Binary Example YAML definition for a Spring Boot application with Red Hat build of Kogito build apiVersion: rhpam.kiegroup.org/v1 # Red Hat build of Kogito API for this service kind: KogitoBuild # Application type metadata: name: example-springboot # Application name spec: runtime: springboot type: Binary After you define your application data, click Create to generate the Red Hat build of Kogito build. Your application is listed in the Red Hat build of KogitoBuilds page. You can select the application name to view or modify application settings and YAML details. Upload the built binary using the following command: from-dir is equals to the target folder path of the built application. namespace is the namespace where KogitoBuild is created. To create the Red Hat build of Kogito microservice definition, on the operator page, select the Kogito Runtime tab and click Create KogitoRuntime . In the application window, use Form View or YAML View to configure the microservice definition. At a minimum, define the application configurations shown in the following example YAML file: Example YAML definition for a Red Hat build of Quarkus application with Red Hat build of Kogito microservices apiVersion: rhpam.kiegroup.org/v1 # Red Hat build of Kogito API for this microservice kind: KogitoRuntime # Application type metadata: name: example-quarkus # Application name Example YAML definition for a Spring Boot application with Red Hat build of Kogito microservices apiVersion: rhpam.kiegroup.org/v1 # Red Hat build of Kogito API for this microservice kind: KogitoRuntime # Application type metadata: name: example-springboot # Application name spec: runtime: springboot Note In this case, the application is built locally and deployed using KogitoRuntime. You must ensure that the application name is same in KogitoBuild and KogitoRuntime . After you define your application data, click Create to generate the Red Hat build of Kogito microservice. Your application is listed in the Red Hat build of Kogito microservice page. You can select the application name to view or modify application settings and the contents of the YAML file. In the left menu of the web console, go to Builds Builds to view the status of your application build. You can select a specific build to view build details. After the application build is complete, go to Workloads Deployments to view the application deployments, pod status, and other details. After your Red Hat build of Kogito microservice is deployed, in the left menu of the web console, go to Networking Routes to view the access link to the deployed application. You can select the application name to view or modify route settings. With the application route, you can integrate your Red Hat build of Kogito microservices with your business automation solutions as needed. 10.3. Deploying Red Hat build of Kogito microservices on OpenShift using custom image build and OpenShift web console You can use custom image build as an alternative for building and deploying your Red Hat build of Kogito microservices on OpenShift. The operator uses the following custom resources to deploy domain-specific microservices (the microservices that you develop): KogitoRuntime starts the runtime image and configures it as per your requirements. Note The Red Hat Process Automation Manager builder image does not supports native builds. However, you can perform a custom build and use Containerfile to build the container image as shown in the following example: FROM registry.redhat.io/rhpam-7-tech-preview/rhpam-kogito-runtime-native-rhel8:7.13.5 ENV RUNTIME_TYPE quarkus COPY --chown=1001:root target/*-runner USDKOGITO_HOME/bin This feature is Technology Preview only. To build the native binary with Mandrel, see Compiling your Quarkus applications to native executables . Prerequisites The RHPAM Kogito Operator is installed. You have access to the OpenShift web console with the necessary permissions to create and edit KogitoRuntime . (Red Hat build of Quarkus only) The pom.xml file of your project contains the following dependency for the quarkus-smallrye-health extension. This extension enables the liveness and readiness probes that are required for Red Hat build of Quarkus projects on OpenShift. SmallRye Health dependency for Red Hat build of Quarkus applications on OpenShift <dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-smallrye-health</artifactId> </dependency> Procedure Build an application locally. Create Containerfile in the project root folder with the following content: Example Containerfile for a Red Hat build of Quarkus application Example Containerfile for a Spring Boot application application-jar-file is the name of the JAR file of the application. Build the Red Hat build of Kogito image using the following command: In the command, final-image-name is the name of the Red Hat build of Kogito image and Container-file is name of the Containerfile that you created in the step. Optionally, test the built image using the following command: Push the built Red Hat build of Kogito image to an image registry using the following command: Go to Operators Installed Operators and select RHPAM Kogito Operator . To create the Red Hat build of Kogito microservice definition, on the operator page, select the Kogito Runtime tab and click Create KogitoRuntime . In the application window, use Form View or YAML View to configure the microservice definition. At a minimum, define the application configurations shown in the following example YAML file: Example YAML definition for a Red Hat build of Quarkus application with Red Hat build of Kogito microservices apiVersion: rhpam.kiegroup.org/v1 # Red Hat build of Kogito API for this microservice kind: KogitoRuntime # Application type metadata: name: example-quarkus # Application name spec: image: <final-image-name> # Kogito image name insecureImageRegistry: true # Can be omitted when image is pushed into secured registry with valid certificate Example YAML definition for a Spring Boot application with Red Hat build of Kogito microservices apiVersion: rhpam.kiegroup.org/v1 # Red Hat build of Kogito API for this microservice kind: KogitoRuntime # Application type metadata: name: example-springboot # Application name spec: image: <final-image-name> # Kogito image name insecureImageRegistry: true # Can be omitted when image is pushed into secured registry with valid certificate runtime: springboot After you define your application data, click Create to generate the Red Hat build of Kogito microservice. Your application is listed in the Red Hat build of Kogito microservice page. You can select the application name to view or modify application settings and the contents of the YAML file. After the application build is complete, go to Workloads Deployments to view the application deployments, pod status, and other details. After your Red Hat build of Kogito microservice is deployed, in the left menu of the web console, go to Networking Routes to view the access link to the deployed application. You can select the application name to view or modify route settings. With the application route, you can integrate your Red Hat build of Kogito microservices with your business automation solutions as needed. 10.4. Deploying Red Hat build of Kogito microservices on OpenShift using file build and OpenShift web console You can build and deploy your Red Hat build of Kogito microservices from a single file, such as a Decision Model and Notation (DMN), Drools Rule Language (DRL), or properties file, or from a directory with multiple files. You can specify a single file from your local file system path or specify a file directory from a local file system path only. When you upload the file or directory to an OpenShift cluster, a new Source-to-Image (S2I) build is automatically triggered. The operator uses the following custom resources to deploy domain-specific microservices (the microservices that you develop): KogitoBuild generates an application from a file and produces a runtime image. KogitoRuntime starts the runtime image and configures it as per your requirements. Prerequisites The RHPAM Kogito Operator is installed. The oc OpenShift CLI is installed and you are logged in to the relevant OpenShift cluster. For oc installation and login instructions, see the OpenShift documentation . You have access to the OpenShift web console with the necessary permissions to create and edit KogitoBuild and KogitoRuntime . Procedure Go to Operators Installed Operators and select RHPAM Kogito Operator . To create the Red Hat build of Kogito build definition, on the operator page, select the Kogito Build tab and click Create KogitoBuild . In the application window, use Form View or YAML View to configure the build definition. At a minimum, define the application configurations shown in the following example YAML file: Example YAML definition for a Red Hat build of Quarkus application with Red Hat build of Kogito build apiVersion: rhpam.kiegroup.org/v1 # Red Hat build of Kogito API for this service kind: KogitoBuild # Application type metadata: name: example-quarkus # Application name spec: type: LocalSource Example YAML definition for a Spring Boot application with Red Hat build of Kogito build apiVersion: rhpam.kiegroup.org/v1 # Red Hat build of Kogito API for this service kind: KogitoBuild # Application type metadata: name: example-springboot # Application name spec: runtime: springboot type: LocalSource Note If you configured an internal Maven repository, you can use it as a Maven mirror service and specify the Maven mirror URL in your Red Hat build of Kogito build definition to shorten build time substantially: spec: mavenMirrorURL: http://nexus3-nexus.apps-crc.testing/repository/maven-public/ For more information about internal Maven repositories, see the Apache Maven documentation. After you define your application data, click Create to generate the Red Hat build of Kogito build. Your application is listed in the Red Hat build of KogitoBuilds page. You can select the application name to view or modify application settings and YAML details. Upload the file asset using the following command: file-asset-path is the path of the file asset that you want to upload. namespace is the namespace where KogitoBuild is created. To create the Red Hat build of Kogito microservice definition, on the operator page, select the Kogito Runtime tab and click Create KogitoRuntime . In the application window, use Form View or YAML View to configure the microservice definition. At a minimum, define the application configurations shown in the following example YAML file: Example YAML definition for a Red Hat build of Quarkus application with Red Hat build of Kogito microservices apiVersion: rhpam.kiegroup.org/v1 # Red Hat build of Kogito API for this microservice kind: KogitoRuntime # Application type metadata: name: example-quarkus # Application name Example YAML definition for a Spring Boot application with Red Hat build of Kogito microservices apiVersion: rhpam.kiegroup.org/v1 # Red Hat build of Kogito API for this microservice kind: KogitoRuntime # Application type metadata: name: example-springboot # Application name spec: runtime: springboot Note In this case, the application is built from a file and deployed using KogitoRuntime. You must ensure that the application name is same in KogitoBuild and KogitoRuntime . After you define your application data, click Create to generate the Red Hat build of Kogito microservice. Your application is listed in the Red Hat build of Kogito microservice page. You can select the application name to view or modify application settings and the contents of the YAML file. In the left menu of the web console, go to Builds Builds to view the status of your application build. You can select a specific build to view build details. Note For every Red Hat build of Kogito microservice that you create for OpenShift deployment, two builds are generated and listed in the Builds page in the web console: a traditional runtime build and a Source-to-Image (S2I) build with the suffix -builder . The S2I mechanism builds the application in an OpenShift build and then passes the built application to the OpenShift build to be packaged into the runtime container image. After the application build is complete, go to Workloads Deployments to view the application deployments, pod status, and other details. After your Red Hat build of Kogito microservice is deployed, in the left menu of the web console, go to Networking Routes to view the access link to the deployed application. You can select the application name to view or modify route settings. With the application route, you can integrate your Red Hat build of Kogito microservices with your business automation solutions as needed.

Commands:
<dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-smallrye-health</artifactId> </dependency>
apiVersion: rhpam.kiegroup.org/v1 # Red Hat build of Kogito API for this service kind: KogitoBuild # Application type metadata: name: example-quarkus # Application name spec: type: RemoteSource gitSource: uri: 'https://github.com/kiegroup/kogito-examples' # Git repository containing application (uses default branch) contextDir: dmn-quarkus-example # Git folder location of application
apiVersion: rhpam.kiegroup.org/v1 # Red Hat build of Kogito API for this service kind: KogitoBuild # Application type metadata: name: example-springboot # Application name spec: runtime: springboot type: RemoteSource gitSource: uri: 'https://github.com/kiegroup/kogito-examples' # Git repository containing application (uses default branch) contextDir: dmn-springboot-example # Git folder location of application
spec: mavenMirrorURL: http://nexus3-nexus.apps-crc.testing/repository/maven-public/
apiVersion: rhpam.kiegroup.org/v1 # Red Hat build of Kogito API for this microservice kind: KogitoRuntime # Application type metadata: name: example-quarkus # Application name
apiVersion: rhpam.kiegroup.org/v1 # Red Hat build of Kogito API for this microservice kind: KogitoRuntime # Application type metadata: name: example-springboot # Application name spec: runtime: springboot
<dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-smallrye-health</artifactId> </dependency>
apiVersion: rhpam.kiegroup.org/v1 # Red Hat build of Kogito API for this service kind: KogitoBuild # Application type metadata: name: example-quarkus # Application name spec: type: Binary
apiVersion: rhpam.kiegroup.org/v1 # Red Hat build of Kogito API for this service kind: KogitoBuild # Application type metadata: name: example-springboot # Application name spec: runtime: springboot type: Binary
oc start-build example-quarkus --from-dir=target/ -n namespace
apiVersion: rhpam.kiegroup.org/v1 # Red Hat build of Kogito API for this microservice kind: KogitoRuntime # Application type metadata: name: example-quarkus # Application name
apiVersion: rhpam.kiegroup.org/v1 # Red Hat build of Kogito API for this microservice kind: KogitoRuntime # Application type metadata: name: example-springboot # Application name spec: runtime: springboot
<dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-smallrye-health</artifactId> </dependency>
FROM registry.redhat.io/rhpam-7/rhpam-kogito-runtime-jvm-rhel8:7.13.5 ENV RUNTIME_TYPE quarkus COPY target/quarkus-app/lib/ USDKOGITO_HOME/bin/lib/ COPY target/quarkus-app/*.jar USDKOGITO_HOME/bin COPY target/quarkus-app/app/ USDKOGITO_HOME/bin/app/ COPY target/quarkus-app/quarkus/ USDKOGITO_HOME/bin/quarkus/
FROM registry.redhat.io/rhpam-7/rhpam-kogito-runtime-jvm-rhel8:7.13.5 ENV RUNTIME_TYPE springboot COPY target/<application-jar-file> USDKOGITO_HOME/bin
build --tag <final-image-name> -f <Container-file>
run --rm -it -p 8080:8080 <final-image-name>
push <final-image-name>
apiVersion: rhpam.kiegroup.org/v1 # Red Hat build of Kogito API for this microservice kind: KogitoRuntime # Application type metadata: name: example-quarkus # Application name spec: image: <final-image-name> # Kogito image name insecureImageRegistry: true # Can be omitted when image is pushed into secured registry with valid certificate
apiVersion: rhpam.kiegroup.org/v1 # Red Hat build of Kogito API for this microservice kind: KogitoRuntime # Application type metadata: name: example-springboot # Application name spec: image: <final-image-name> # Kogito image name insecureImageRegistry: true # Can be omitted when image is pushed into secured registry with valid certificate runtime: springboot
apiVersion: rhpam.kiegroup.org/v1 # Red Hat build of Kogito API for this service kind: KogitoBuild # Application type metadata: name: example-quarkus # Application name spec: type: LocalSource
apiVersion: rhpam.kiegroup.org/v1 # Red Hat build of Kogito API for this service kind: KogitoBuild # Application type metadata: name: example-springboot # Application name spec: runtime: springboot type: LocalSource
spec: mavenMirrorURL: http://nexus3-nexus.apps-crc.testing/repository/maven-public/
oc start-build example-quarkus-builder --from-file=<file-asset-path> -n namespace
apiVersion: rhpam.kiegroup.org/v1 # Red Hat build of Kogito API for this microservice kind: KogitoRuntime # Application type metadata: name: example-quarkus # Application name
apiVersion: rhpam.kiegroup.org/v1 # Red Hat build of Kogito API for this microservice kind: KogitoRuntime # Application type metadata: name: example-springboot # Application name spec: runtime: springboot