Kogito - Developer Guide
- Requirements
- Build Kogito Runtimes
git clone https://github.com/kiegroup/kogito-runtimes
cd kogito-runtimes
mvn clean install -DskipTests
- Build Kogito Apps
git clone https://github.com/kiegroup/kogito-apps
cd kogito-apps
npm install -D yarn
yarn install
mvn clean install -DskipTests
-
Prepare Your Openshift Project
-
Install Third Party Operators
As we are going to install the operator manually from sources, we need to install the third party operators by ourselves (when installing the operator from OperatorHub, this is not needed).
- Install operator group:
export OC_NAMESPACE=mynamespace # your openshift project
cat > operatorGroup.yaml << EOF
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
name: $OC_NAMESPACE
namespace: $OC_NAMESPACE
spec:
targetNamespaces:
- $OC_NAMESPACE
EOF
oc apply -f operatorGroup.yaml
rm operatorGroup.yaml
export OPERATOR_PACKAGE=infinispan
export OPERATOR_CHANNEL=stable
cat > infinispan.yaml << EOF
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: $OPERATOR_PACKAGE
namespace: $OC_NAMESPACE
spec:
name: $OPERATOR_PACKAGE
source: community-operators
sourceNamespace: openshift-marketplace
channel: $OPERATOR_CHANNEL
EOF
oc apply -f infinispan.yaml
rm infinispan.yaml
export OPERATOR_PACKAGE=strimzi-kafka-operator
export OPERATOR_CHANNEL=stable
cat > strimzi.yaml << EOF
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: $OPERATOR_PACKAGE
namespace: $OC_NAMESPACE
spec:
name: $OPERATOR_PACKAGE
source: community-operators
sourceNamespace: openshift-marketplace
channel: $OPERATOR_CHANNEL
EOF
oc apply -f strimzi.yaml
rm strimzi.yaml
- Build and Deploy Kogito Cloud Operator
First, we need to install some prerequisities:
- Operator SDK V0.16.0 or later
- Golint dependency: go get -u golang.org/x/lint/golint
Then, build the operator:
git clone https://github.com/kiegroup/kogito-cloud-operator
cd kogito-cloud-operator
make build
Deploy the operator into Quay:
PACKAGE_VERSION=<THE OPERATOR VERSION> -- 0.9.0
QUAY_USERNAME=<YOUR QUAY USERNAME>
QUAY_PASSWORD=<YOUR QUAY PASSWORD>
QUAY_NAMESPACE=<YOUR QUAY NAMESPACE>
TARGET_REPOSITORY=quay.io/$QUAY_NAMESPACE/kogito-cloud-operator:$PACKAGE_VERSION
docker login -u $QUAY_USERNAME -p $QUAY_PASSWORD quay.io
docker tag quay.io/kiegroup/kogito-cloud-operator:$PACKAGE_VERSION $TARGET_REPOSITORY
docker push $TARGET_REPOSITORY
echo "Operator is now in $TARGET_REPOSITORY"
Expected output:
Operator is now in quay.io/jcarvaja/kogito-cloud-operator:0.9.0
Check whether the operator is now in your Quay account and make the repository public so Openshift can reach it out. |
Finally, run the Operator into Openshift:
oc login youropenshiftinstance.com # login
oc project mynamespace # select openshift project
make deploy-operator-on-ocp image=quay.io/jcarvaja/kogito-cloud-operator:0.9.0
- Install Services
First, we need to install Kogito CLI:
cd kogito-cloud-operator
make install-cli
And, then the services:
kogito use-project mynamespace # your openshift project
kogito install data-index
kogito install jobs-service
kogito install mgmt-console
And, let’s finish deploying an example:
kogito deploy-service example-drools https://github.com/kiegroup/kogito-examples --context-dir drools-quarkus-example
Appendix. Add Latest Images from Source:
In case we want to override the images that the operator is using to deploy the components, we can do it this way:
git clone https://github.com/kiegroup/kogito-images
cd kogito-images
oc apply -f kogito-imagestream.yaml