Skip to content

ibm-cloud-architecture/eda-kc-gitops

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EDA KContainer shipment solution GitOps repository

This is the 2022 version of the KC solution GitOps.

Updated 02/25/2022.

The current update is for the SAGA pattern orchestration with MQ and Kafka for eventing.

As the implementation of the GitOps practice, this repository includes how to deploy IBM Event Streams and IBM MQ as well as the microservices that are part of the solution.

This project was created with KAM CLI and use the eda-gitop-catalog for IBM cloud pak for integration operator deployment.

Gitops approach

The main approach for the gitops is described in this note. The figure below is to illustrate that this current repository is

Saga with MQ scenario presentation

The Saga pattern helps to support a long running transaction that can be broken up to a collection of sub transactions that can be interleaved any way with other transactions.

The SAGA orchestration is done by the order service that sends commands to drive each SAGA participant on what to do and when. To support strong consistency and exactly once delivery we are using Queues.

The Saga will be started by adding a new order, or updating major caracteristics of an existing order.

The demonstration illustrates the happy path, where each participants respond positively, so voyage and container are assigned to the order,

and one uncomplete path, where the order will not be satisfied because of lack of refrigerator containers.

So the compensation logic will roll back the Voyage assignment.

Run the solution locally

You have two options to demonstrate this solution, one running on your local laptop (using docker compose) and one running on OpenShift.

MQ Saga demonstration

  • Start local MQ and services
cd local-demo/mq-based
docker compose up -d

The demonstration scenario script in this separated note.

  • Stop the demo
docker compose down

GitOps

How this repository was created

We used KAM CLI to create the project with the following parameters:

Get Github access token, to be used in the KAM bootstrap command, in future steps.

kam bootstrap \
--service-repo-url https://github.com/ibm-cloud-architecture/eda-kc-order-cmd-mq \
--gitops-repo-url  https://github.com/ibm-cloud-architecture/eda-kc-gitops \
--image-repo quay.io/ibmcase/ \
--output eda-kc-gitops \
--git-host-access-token <a-github-token> \
--prefix kc-mq --push-to-git=true

What was added

  • Added a bootstrap folder to define gitops and operator declaration and to create an ArgoCD project
  • Defined a script to install IBM Catalogs and Cloud Pak for Integration components
  • Added scripts to deploy operators: scripts/installOperators.sh
  • Specific script to install IBM's product operators.

Bootstrap GitOps

  • You may need to install the following tools:
brew install kubeseal
brew install jq
  • Login to the OpenShift Console, and get login token to be able to use oc cli

  • If not already done, use the script to install GitOps and Pipeline operators:

      ./bootstrap/scripts/installGitOpsOperators.sh

    Once the operators are running the command: oc get pods -n openshift-gitops should return a list of pods like the following:

      NAME                                                          READY   STATUS    RESTARTS   AGE
      openshift-gitops-application-controller-0                     1/1     Running   0          4h5m
      openshift-gitops-applicationset-controller-6948bcf87c-jdv2x   1/1     Running   0          4h5m
      openshift-gitops-dex-server-64cbd8d7bd-76czz                  1/1     Running   0          4h5m
      openshift-gitops-redis-7867d74fb4-dssr2                       1/1     Running   0          4h5m
      openshift-gitops-repo-server-6dc777c845-gdjhr                 1/1     Running   0          4h5m
      openshift-gitops-server-7957cc47d9-cmxvw                      1/1     Running   0          4h5m
  • If not done already, install IBM product catalog subscriptions, so the OpenShift Cluster can get visibility of IBM product within the OpenShift Operator Hub:

    ./bootstrap/scripts/installIBMCatalog.sh
  • Obtain your IBM license entitlement key

  • Update the OCP global pull secret of the openshift-operators project with the entitlement key

    export KEY=<yourentitlementkey>
    oc create secret docker-registry ibm-entitlement-key \
    --docker-username=cp \
    --docker-server=cp.icr.io \
    --namespace=openshift-operators \
    --docker-password=$KEY 
  • Deploy IBM product Operators (Event Streams, MQ) to monitor All Namespaces

    ./bootstrap/scripts/installIBMOperators.sh
  • Create ArgoCD project named kc-mq

    oc apply -k bootstrap/argocd-project
  • To get the admin user's password use the following command

    oc extract secret/openshift-gitops-cluster -n openshift-gitops --to=-
  • Get the ArgoCD User Interface URL and open a web browser

    chrome https://$(oc get route openshift-gitops-server -o jsonpath='{.status.ingress[].host}'  -n openshift-gitops)
  • To start the Continuous Deployment management with ArgoCD, just executing the following command:

    oc apply -k config/argocd

The expected set of ArgoCD apps looks like the following:

  • Argo-app is an app of apps
  • dev-env is for the rt-inventory-dev namespace
  • dev-services is for event streams and mq deployment in dev-env namespace
  • kc-dev-eda-kc-order-cmd-mq-app: the order manager microservice deployment, using MQ for the saga
  • kc-dev-eda-kc-order-mq-ui-app: the user interface app for demonstration
  • kc-dev-eda-kc-reefer-ms-mq-app: the Refrigerator container, Reefer, manager microservice participant into the SAGA
  • kc-dev-eda-kc-voyage-ms-mq-app: The Voyage (Vessel trips) manager microservice also participant into the SAGA

Releases

No releases published

Packages

No packages published

Languages