【问题标题】:ArgoCD tracking subdirectories in a specified pathArgoCD 跟踪指定路径中的子目录
【发布时间】:2020-09-10 12:42:36
【问题描述】:

我正在使用 ArgoCD,我想跟踪不同子目录下的文件。我已将路径设置为 ./root_directory,但我还想跟踪 root_directory 的子目录中的文件。例如/root_directory/dir1、/root_directory/dir2,还有/root_directory/dir1/dir1.1 ecc.. 我该怎么做?

感谢您的帮助

【问题讨论】:

    标签: kubernetes openshift kustomize argocd gitops


    【解决方案1】:

    如果您想设置 ArgoCD 应用程序以递归地遍历目录,则可以选择该配置。

    UI 中有一个用于递归的复选框和/或如果您以声明方式执行此操作,那么您可以看到 CRD https://argoproj.github.io/argo-cd/operator-manual/application.yaml 具有 spec.source.directory.recurse 选项。

    【讨论】:

      【解决方案2】:

      您可能应该为每个子目录创建不同的 Argo 应用程序。您已决定在代码组织中对它们进行分段,因此在 Argo 中对它们进行分段可能同样有用。

      【讨论】:

      • 我发现argocd中有recurse选项。否则可以在每个目录中添加一个kustomization文件来跟踪每个子目录。但是每个目录的 argo 应用程序是个好主意。谢谢!
      【解决方案3】:

      您可以添加spec.source.directory.recurse 属性。

      请看下面的例子:

      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
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2012-02-07
        • 2018-09-18
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-04-04
        相关资源
        最近更新 更多