github.com/argoproj/argo-cd/v3@v3.2.1/applicationset/examples/design-doc/git-directory-discovery.yaml (about)

     1  # This example demonstrates the git directory generator, which produces an items list 
     2  # based on discovery of directories in a git repo matching a specified pattern.
     3  # Git generators automatically provide {{path}} and {{path.basename}} as available
     4  # variables to the app template.
     5  #
     6  # Suppose the following git directory structure (note the use of different config tools):
     7  #
     8  # cluster-deployments
     9  # └── add-ons
    10  #     ├── argo-rollouts
    11  #     │   ├── all.yaml
    12  #     │   └── kustomization.yaml
    13  #     ├── argo-workflows
    14  #     │   └── install.yaml
    15  #     ├── grafana
    16  #     │   ├── Chart.yaml
    17  #     │   └── values.yaml
    18  #     └── prometheus-operator
    19  #         ├── Chart.yaml
    20  #         └── values.yaml
    21  #
    22  # The following ApplicationSet would produce four applications (in different namespaces),
    23  # using the directory basename as both the namespace and application name. 
    24  apiVersion: argoproj.io/v1alpha1
    25  kind: ApplicationSet
    26  metadata:
    27    name: cluster-addons
    28  spec:
    29    goTemplate: true
    30    goTemplateOptions: ["missingkey=error"]
    31    generators:
    32    - git:
    33        repoURL: https://github.com/infra-team/cluster-deployments.git
    34        directories:
    35        - path: add-ons/*
    36    template:
    37      metadata:
    38        name: '{{.path.basename}}'
    39      spec:
    40        source:
    41          repoURL: https://github.com/infra-team/cluster-deployments.git
    42          targetRevision: HEAD
    43          path: '{{.path.path}}'
    44        destination:
    45          server: http://kubernetes.default.svc
    46          namespace: '{{.path.basename}}'