ArgoCD tracking subdirectories in a specified path
Asked Answered
M

3

11

I'm using ArgoCD and I want to track files under different subdirectories. I've setted the path as ./root_directory, but I would like to track also files in the subdirectories of root_directory. For instance /root_directory/dir1, /root_directory/dir2, but also /root_directory/dir1/dir1.1 ecc.. How can I do that?

Thanks for your help

Melanoid answered 10/9, 2020 at 12:42 Comment(0)
P
8

If you want to set up an ArgoCD Application to recursively go through directories there is an option for that configuration.

There is a checkbox in the UI for recursive and/or if you are doing it declaratively then you can see the CRD https://argoproj.github.io/argo-cd/operator-manual/application.yaml has the spec.source.directory.recurse option.

Prevent answered 23/12, 2020 at 15:10 Comment(0)
K
11

You can add the spec.source.directory.recurse attribute.

See an example below:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: argocd-app
  namespace: argocd
spec:
  project: default
  source:
    path: some/path/
    repoURL: https://github.com/your-repo.git
    targetRevision: HEAD
    directory:
      recurse: true # <--- Here
  destination:
    namespace: '*'
    server: https://kubernetes.default.svc
  syncPolicy:
    automated:
      prune: true
Knowledge answered 10/8, 2021 at 10:57 Comment(2)
Is recurse required? I feel like I've been doing it before without enabling it in my application and it was working by default.Ruelle
It is not the default as far I know.Knowledge
P
8

If you want to set up an ArgoCD Application to recursively go through directories there is an option for that configuration.

There is a checkbox in the UI for recursive and/or if you are doing it declaratively then you can see the CRD https://argoproj.github.io/argo-cd/operator-manual/application.yaml has the spec.source.directory.recurse option.

Prevent answered 23/12, 2020 at 15:10 Comment(0)
C
1

You should probably create different Argo Applications for each sub dir. You have decided to segmented them in your code organisation, therefore it may be equally useful to segment them in Argo.

Chaldean answered 1/10, 2020 at 19:51 Comment(1)
I've found that there is a recurse option in argocd.. Otherwise is possible to add a kustomization file in each directory to track each subdirectory. But the argo app for each directory is a good idea. Thank you!Melanoid

© 2022 - 2024 — McMap. All rights reserved.