GitOps: OpenShift and ArgoCD

Gokhan YUCEGOK
Devops Türkiye☁️ 🐧 🐳 ☸️
3 min readJun 18, 2020

It’s mid 2020. We have by now deployed our OpenShift/Kubernetes clusters, on-prem or the cloud, done our integrations and are already developing cloud-native microservices. CI/CD pipelines are there in place, automated testing makes sure development is smooth as possible, and we get our software staged between our environments.

We have all these capabilities but seem to be a step behind when it comes down to standardize our Infrastructure configurations and Application Deployments. There may still be issues getting DevOps and SRE principles right, and a large group of us are still conservative applying Continuous Deployment to production.

GitOps steps in to solve our issues by suggesting standardized configurations to our environments with principles trying to broaden what was there for Infrastructure as Code, and products/projects are providing some sort of Continuous Deployment functionality which makes them versatile and more inclusive than IaC. As the name suggests, its source of truth is Git as expected.

There are lots of great articles and content around GitOps and ArgoCD. The reason I’m writing this post is to complement them, and showcase some further functionality. The following post is an excellent resource on what GitOps is, and the video below shows how to install ArgoCD with Operators on OpenShift 4.

Blog post for an Introduction to GitOps on OpenShift;

Installation video to get ArgoCD installed with an Operator;

Getting Started with ArgoCD on OpenShift 4

Now since we know more on GitOps, ArgoCD and installing on OpenShift; let’s start playing around and understand how GitOps principles apply with some examples.

Our first video shows how an OpenShift project can be deployed with ArgoCD. As we mentioned, our source of truth is Git, so we created a repository in GitHub and will use that for the rest of this article. The repo was forked from Christian Hernandez’s work for the above video, a Principal Technical Marketing Manager at Red Hat.

The Video will simply show how we deploy an app by pointing to a GitHub repository. We’ll see that the app gets deployed along with all it’s manifests and configurations.

GitOps: OpenShift and ArgoCD — Deploy an App

Congratulations! We have our first application running with ArgoCD. This is the “green” version, and we’ll now show how ArgoCD reacts in case of changes along the way. One note here, we chose the Synch policy as manual to take things slow in the demo.

Let’s change something now in OpenShift. We’ll change the color from green to blue. This is a typical scenario where Ops tries to fix/change things in production and is not complying with IaC or GitOps principles. The ideal scenario would be to change the manifests in the SVC (our GitHub repo), and apply them from there. We’ll see that ArgoCD will mark the change nicely, and roll it back since our source of truth is Git and this was a rogue change from a policy point of view.

GitOps: OpenShift and ArgoCD — Rogue Change

We know now that ArgoCD has things under control when it comes to preserving our status quo. Let’s keep moving on and show how to actually make a proper change, and how it gets applied to our systems. Here we’ll see that ArgoCD will know when a Git repo gets updated, and apply that change to our environment

GitOps: OpenShift and ArgoCD — Proper Change

Again, ArgoCD will nicely mark the change, and we’ll choose to apply the changes to our environment by properly pulling from Git.

Lastly, I encourage you to fork the repo and try the demo for yourself. You can easily spawn a mini OCP cluster on your Laptop of choice with Code Ready Containers.

And here is Christian’s repo;

--

--