Skip to content

linusali/vm-gitops-demo

Repository files navigation

VM GitOps Demo

This repository demonstrates deploying a hybrid application on OpenShift using GitOps. It includes a VM-based web server, a containerized backend, and a database, showcasing how legacy and modern workloads can coexist.

It uses Helm charts for easily scaling virtual machines, but deployed through OpenShift GitOps (ArgoCD) rather than using the Helm in OpenShift.

1. Prerequisites

  • OpenShift Cluster with a RWX capable Storage

  • OpenShift Virtualization should be enabled

  • OpenShift GitOps should be installed from the operator hub

  • CLI Tools - oc, helm, argocd and git should be available on your workstation to manage the application deployment

2. Application deployment

2.1. Prepare

We are starting a new project called banking-demo. First, we will create a system group called cluster-admins in OpenShift. Next, we will add the admin user to the cluster-admins group. Finally, we will label the new namespace banking-demo so that the default GitOps (ArgoCD) instance running in openshift-gitops namesapce can manage the artifacts within this namespace.

Now the admin user can login using SSO option of ArgoCD.

oc new-project banking-demo
oc adm groups new cluster-admins
oc adm groups add-users cluster-admins admin
oc label namespace banking-demo argocd.argoproj.io/managed-by=openshift-gitops

2.2. Verify Helm variables

Make sure the values specified in values.yaml and argo-application.yaml are as desired.

File: values.yaml
appDomain: apps.cnv.dxb.rhdxb.net
webserver:
  replicas: 2
  image: fedora
  image_ns: openshift-virtualization-os-images
  size: u1.small
  fineract_image: docker.io/fintecheando/web-app:master

database:
  image: mariadb:11.4
  storage: 10Gi
  storageclass: ocs-storagecluster-cephfs
  resources:
    requests:
      memory: "1Gi"
      cpu: "1000m"

backend:
  image: docker.io/apache/fineract:latest
File: argo-application.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: mifos-x
spec:
  destination:
    name: ''
    namespace: banking-demo
    server: https://kubernetes.default.svc
  source:
    path: .
    repoURL: https://github.com/linusali/vm-gitops-demo.git
    targetRevision: HEAD
    helm:
      valueFiles:
        - values.yaml
      parameters:
        - name: webserver.replicas
          value: "3"
  sources: []
  project: default
  syncPolicy:
    automated:
      prune: true
      selfHeal: true

Create the ArgoCD application

oc apply -f argo-application.yaml

2.3. Monitor the appliation deployment

You can monitor the application deployment using CLI

oc project banking-demo

2.3.1. List pods

Using CLI list the pods deployed in the current namespace banking-demo

oc get pods

2.3.2. List PVC

List Persistant storage deployed

oc get pvc

2.3.3. List Virtual Machines

List virtual machines deployed. Since the deployment is done in batches based on the dependencies, it might take a while before the virtual machine show up

oc get vms

2.3.4. Access the application

Get the URL to access the deployed Mifo-X application’s frontend

oc get routes

3. Interesting facts about this deployment

  1. Virtual machine can be scaled easily by modifying webserver.replicas count

  2. Virtual machine uses cloud-init scripts to instantiate itself

  3. Virtual machine uses Liveness and Readiness probes to monitor itself and reboot in case of any failure

  4. Virtual machine uses OpenShift’s services and routes to expose itself to the external world

About

A Helm chart for deploying a demo application using both containers and virtual machines.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published