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.
-
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
andgit
should be available on your workstation to manage the application deployment
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
Make sure the values specified in values.yaml
and argo-application.yaml
are as desired.
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
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
You can monitor the application deployment using CLI
oc project banking-demo
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
-
Virtual machine can be scaled easily by modifying
webserver.replicas
count -
Virtual machine uses cloud-init scripts to instantiate itself
-
Virtual machine uses Liveness and Readiness probes to monitor itself and reboot in case of any failure
-
Virtual machine uses OpenShift’s services and routes to expose itself to the external world