fperearodriguez / argocd-helm-configmaphash

Automatically Roll Deployments with ArgoCD and Helm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Automatically Roll Deployments with ArgoCD and Helm

Forked repository from cm-example.

In this lab, the sample application has a configmap. The main idea is to roll the deployment when the config changes.

Prerequisites

  • OCP up and running.
  • OpenShift GitOps Operator (ArgoCD)

Sample app: Helm Chart

The sample app contains several Kubernetes resources. One of these resources is the configmap. Take a look at the content of the configmap:

helm template .

# Source: sample-app/templates/cm.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: sample-app
  namespace: sample
data:
  test.conf: |
    title = "Example Config"
    enableAwesome = "true"
    version = "v1"

We see version=v1 in this case.

Let's deploy the application by using ArgoCD:

oc apply -n openshift-gitops -f app-helm.yaml

The app is running with the configuration indicated in the configmap.

Argo application Sample app

Update configmap

Now it's time to update the configmap. Once the configmap is updated, the application will be rolled out automatically to load the new configmap.

First, edit the values in the configmap. Take a look at the git diff:

Push the code. ArgoCD will refresh and sync:

See the configmap is OutOfSync, and also the deployment. Thus, the deployment will be rolled out.

Once Argocd finishes the Sync operation, the application is running with the new configmap:

Argo application Sample app

Author

Fran Perea @RedHat

About

Automatically Roll Deployments with ArgoCD and Helm


Languages

Language:Smarty 100.0%