Stefan
Stefan

Reputation: 11

K8S Helm Chart + ArgoCD Multi-Stage Approach --> How?

I've been involved with Kubernetes, ArgoCD and Helm Charts for a few weeks now. I already have a running EKS cluster, ArgoCD and my first Whoami app running. I have already developed my own app as a Helm Chart. I am just asking myself how best to set up my multi-staging process. Currently I do it as follows.

Folder structure

dev-cluster-manifest
|-> WhoAmi-App
|--|--> templates
|--|--|--> deployment.yaml
|--|--|--> service.yaml
|--|--> Argocd-dev.yaml
|--|--> Argocd-test.yaml
|--|--> Chart.yaml
|--|--> dev-values.yaml
|--|--> test-values.yaml

The ArgoCD Files looks like with calling dev and test values.

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: whoami-dev
  namespace: argocd
spec:
  project: default
  source:
    repoURL: 'https://github.com/myrepo'
    path: dev-cluster-manifest/whoami-app
    helm:
      valueFiles:
        - dev-values.yaml
    targetRevision: HEAD
  destination:
    server: 'https://kubernetes.default.svc'
    namespace: whoami
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
    syncOptions:
      - CreateNamespace=true

My Problem: When I update deployment.yaml ArgoCD will deploy changes to dev and test in parallel --> Not what I wanted.

My second idea was to work with packed helm charts but argoCD cant extract them. If I do it manually I have dublicated code e.g.

dev-cluster-manifest
|-> WhoAmi-App-dev
|--|--> templates
|--|--|--> deployment.yaml
|--|--|--> service.yaml
|--|--> Argocd-dev.yaml
|--|--> Chart.yaml
|--|--> dev-values.yaml

dev-cluster-manifest
|-> WhoAmi-App-test
|--|--> templates
|--|--|--> deployment.yaml
|--|--|--> service.yaml
|--|--> Argocd-test.yaml
|--|--> Chart.yaml
|--|--> test-values.yaml

Is there any solution That I can develop my Whoami-Chart in dev-cluster-manifest/whoami-app-dev and create a versioned version with e.g. git-tags (I know it doesent work) or other mechanism?

How do you version your helm-charts with argocd and eks? Thank you very much.

read docs of helm/argocd

Upvotes: 1

Views: 829

Answers (1)

thikade
thikade

Reputation: 420

When I update deployment.yaml ArgoCD will deploy changes to dev and test in parallel

There are several options that could be used:

  • You can use ArgoCD sync-windows on higher stages (ie. test, prod) or even disable auto-sync, and sync explicitly from a CI/CD pipeline via command.
  • You could encode the deployment.yaml template's differences between stages to only apply to specific stages via Helm conditional blocks
  • You could use kustomize to create env. specific overlays for your stages.

Upvotes: 0

Related Questions