Skip to content

vaibhavjainwiz/rhpam-cloud-enablement

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RHPAM Cloud Enablement

Kogito Operator

Kogito operator deploys Kogito Runtime services on Openshift environment.

Table of Contents

Prerequisite

Create a namespace

kubectl create namespace cloud-enablement-demo

Grafana and Prometheus Operator should be installed beforehand to configure monitoring.

When you deploy a Kogito service that uses the monitoring-prometheus-quarkus-addon add-on, and the Prometheus Operator is installed, the Kogito Operator creates a ServiceMonitor custom resource to expose the metrics for Prometheus. For information about downloading and using Prometheus, see the https://prometheus.io/docs/introduction/overview/[Prometheus documentation page].

The RHPAM Kogito Operator also creates a GrafanaDashboard custom resource defined by the Grafana Operator for each of the Grafana dashboards generated by the add-on. For information about downloading and using Prometheus, see the https://operatorhub.io/operator/grafana-operator[Grafana Operator].

To know more about How to integrate Kogito Application with Prometheus and Grafana see the https://docs.jboss.org/kogito/release/latest/html_single/#con-kogito-operator-with-prometheus-and-grafana_kogito-deploying-on-openshift[Kogito doc].

Note: Prometheus and Grafana Operator should be installed in same namespace in which Kogito Application needs to be deployed.

Deploy Kogito Service

Kogito service could be deployed in two ways :

  • From Kogito Runtime Custom Image
  • From Kogito Application code

Deploy Kogito Application using Kogito Runtime Image

Create KogitoRuntime custom image

Step 1: Compile Kogito application using maven.

cd kogito-examples/dmn-drools-quarkus-metrics
mvn clean install -DskipTests

Step 2: Create Dockerfile using quay.io/kiegroup/kogito-runtime-jvm as base image.

FROM quay.io/kiegroup/kogito-runtime-jvm:latest

ENV RUNTIME_TYPE quarkus

COPY target/quarkus-app/lib/ $KOGITO_HOME/bin/lib/
COPY target/quarkus-app/*.jar $KOGITO_HOME/bin
COPY target/quarkus-app/app/ $KOGITO_HOME/bin/app/
COPY target/quarkus-app/quarkus/ $KOGITO_HOME/bin/quarkus/

# For the legacy quarkus application jar use the commands below
# COPY target/*-runner.jar $KOGITO_HOME/bin
# COPY target/lib $KOGITO_HOME/bin/lib

Step 3: Create Docker image and push it to repo.

docker build -t quay.io/vajain/dmn-drools-quarkus-metrics:1.0 .
docker push quay.io/vajain/dmn-drools-quarkus-metrics:1.0

Step 4: Deploy Kogito custom Image on Openshift

apiVersion: rhpam.kiegroup.org/v1
kind: KogitoRuntime
metadata:
  name: dmn-drools-quarkus-metrics
  namespace: cloud-enablement-demo
spec:
  image: quay.io/vajain/dmn-drools-quarkus-metrics:1.0

Setup prometheus

When you deploy a Kogito service that uses the monitoring-prometheus-quarkus-addon add-on and the Prometheus Operator is installed, the Kogito Operator creates a ServiceMonitor custom resource to expose the metrics for Prometheus.

Create Prometheus Custom Resource

apiVersion: monitoring.coreos.com/v1
kind: Prometheus
metadata:
  name: dmn-drools-quarkus-metrics
  namespace: cloud-enablement-demo
spec:
  serviceAccountName: prometheus-k8s
  serviceMonitorSelector:
    matchLabels:
      app: dmn-drools-quarkus-metrics

Create Route to access from browser

Navigate to the Networking -> Route and then click on the [Create Route] button. Fill in the form with the following:

  • Name=prometheus-route
  • Service=prometheus-operated
  • Target Port=9090 -> web(TCP)

and click on the [Create] button.

Setup Grafana

The RHPAM Kogito Operator also creates a GrafanaDashboard custom resource defined by the Grafana Operator for each of the Grafana dashboards generated by the add-on.

Create Grafana Custom Resource

apiVersion: integreatly.org/v1alpha1
kind: Grafana
metadata:
  name: dmn-drools-quarkus-metrics-grafana
  namespace: cloud-enablement-demo
spec:
  config:
    auth:
      disable_signout_menu: true
    auth.anonymous:
      enabled: true
    log:
      level: warn
      mode: console
    security:
      admin_password: secret
      admin_user: root
  ingress:
    enabled: true    
  dashboardLabelSelector:
    - matchExpressions:
        - key: app
          operator: In
          values:
            - dmn-drools-quarkus-metrics

Deploy Kogito Application using Kogito Build

RHPAM Kogito Build Overview

Kogito Build using Remote source

apiVersion: rhpam.kiegroup.org/v1
kind: KogitoBuild
metadata:
  name: dmn-quarkus-example-remote
  namespace: cloud-enablement-demo
spec:
  buildImage: quay.io/kiegroup/kogito-builder:latest
  runtimeImage: quay.io/kiegroup/kogito-runtime-jvm:latest
  gitSource:
    contextDir: dmn-quarkus-example
    uri: 'https://github.com/kiegroup/kogito-examples'
  type: RemoteSource
  enableMavenDownloadOutput: true
---
apiVersion: rhpam.kiegroup.org/v1
kind: KogitoRuntime
metadata:
  name: dmn-quarkus-example-remote
  namespace: cloud-enablement-demo  

Kogito Build using binary

apiVersion: rhpam.kiegroup.org/v1
kind: KogitoBuild
metadata:
  name: dmn-quarkus-example-binary
  namespace: cloud-enablement-demo
spec:
  buildImage: quay.io/kiegroup/kogito-builder:latest
  runtimeImage: quay.io/kiegroup/kogito-runtime-jvm:latest
  type: Binary
---
apiVersion: rhpam.kiegroup.org/v1
kind: KogitoRuntime
metadata:
  name: dmn-quarkus-example-binary
  namespace: cloud-enablement-demo  

Trigger Build using oc client

oc start-build dmn-quarkus-example-binary --from-dir=/home/vaibhavjain/RedHatRepo/kogito-examples/dmn-drools-quarkus-metrics/target -n cloud-enablement-demo

Kogito Build using local source

apiVersion: rhpam.kiegroup.org/v1
kind: KogitoBuild
metadata:
  name: dmn-quarkus-example-local
  namespace: cloud-enablement-demo
spec:
  buildImage: quay.io/kiegroup/kogito-builder:latest
  runtimeImage: quay.io/kiegroup/kogito-runtime-jvm:latest
  type: LocalSource
---
apiVersion: rhpam.kiegroup.org/v1
kind: KogitoRuntime
metadata:
  name: dmn-quarkus-example-local
  namespace: cloud-enablement-demo    

Trigger Build using oc client

oc start-build dmn-quarkus-example-local-builder --from-file=/home/vaibhavjain/RedHatRepo/kogito-examples/dmn-quarkus-example/src/main/resources/TrafficViolation.dmn -n cloud-enablement-demo

default {buildImage} is registry.redhat.io/rhpam-7/rhpam-kogito-builder-rhel8:7.11 and {runtimeImage} is registry.redhat.io/rhpam-7/rhpam-kogito-runtime-jvm-rhel8:7.11. For a demo, I am using builder and runtime image of Community kogito operator because RHPAM builder and runtime images are not available at this instance.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published