DEV Community

K8s K8s
K8s K8s

Posted on

Argo directory

Apps repo

the repo that hold all the apps configurations and the available environments.

 environments
     test
         Chart.yaml
         templates
             app1.yaml
     production
         Chart.yaml
         templates
             app1.yaml
 app_helms
     app1
         Chart.yaml
         tempaltes
         values.yaml
Enter fullscreen mode Exit fullscreen mode

The environment directory hold two environments test and production (both of them are helm charts), the templates hold the argo definition of each app

it will be something like this.

 apiVersion: argoproj.io/v1alpha1
 kind: Application
 metadata:
   name: app1
   namespace: argocd
 spec:
   destination:
     namespace: app1
     server: https://kubernetes.default.svc
   project: default
   source:
     helm:
       values: |
         image.tag: test_image_tag
         env: test
     path: app_helms/app1
     repoURL: http://apps-repo.git
     targetRevision: HEAD
   syncPolicy:
     automated:
       prune: true
       selfHeal: true
Enter fullscreen mode Exit fullscreen mode

This argo application takes the app helm from (app_helms/app1) and modify the tag to use the test_image_tag.

#### The Argo setup:
first of all you need to create argo app in each of your argo instances (clusters).
in the testing cluster create an app like

 apiVersion: argoproj.io/v1alpha1
 kind: Application
 metadata:
   name: testing
   namespace: argocd
 spec:
   destination:
     namespace: argocd
     server: https://kubernetes.default.svc
   project: default
   source:
     helm:
     path: environments/test
     repoURL: http://apps-repo.git
     targetRevision: HEAD
   syncPolicy:
     automated:
       prune: true
       selfHeal: true
Enter fullscreen mode Exit fullscreen mode

and in the production

 apiVersion: argoproj.io/v1alpha1
 kind: Application
 metadata:
   name: production
   namespace: argocd
 spec:
   destination:
     namespace: argocd
     server: https://kubernetes.default.svc
   project: default
   source:
     helm:
     path: environments/production
     repoURL: http://apps-repo.git
     targetRevision: HEAD
   syncPolicy:
     automated:
       prune: true
Enter fullscreen mode Exit fullscreen mode

Both apps will setup the cluster to create apps when ever there is a change in environments/*

Top comments (0)