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

     1  # This example demonstrates a git file generator which traverses the directory structure of a git
     2  # repository to discover items based on a filename convention. For each file discovered, the
     3  # contents of the discovered files themselves, act as the set of inputs to the app template.
     4  #
     5  # Suppose the following git directory structure:
     6  #
     7  # cluster-deployments
     8  # ├── apps
     9  # │   └── guestbook
    10  # │       └── install.yaml
    11  # └── cluster-config
    12  #     ├── engineering
    13  #     │   ├── dev
    14  #     │   │   └── config.json
    15  #     │   └── prod
    16  #     │       └── config.json
    17  #     └── finance
    18  #         ├── dev
    19  #         │   └── config.json
    20  #         └── prod
    21  #             └── config.json
    22  #
    23  # The discovered files (e.g. config.json) files can be any structured data supplied to the
    24  # generated application. e.g.:
    25  # {
    26  #    "aws_account": "123456",
    27  #    "asset_id": "11223344"
    28  #    "cluster": {
    29  #        "owner": "Jesse_Suen@intuit.com",
    30  #        "name": "engineering-dev",
    31  #        "address": "http://1.2.3.4"
    32  #    }
    33  # }
    34  #
    35  apiVersion: argoproj.io/v1alpha1
    36  kind: ApplicationSet
    37  metadata:
    38    name: guestbook
    39  spec:
    40    goTemplate: true
    41    goTemplateOptions: ["missingkey=error"]
    42    generators:
    43    - git:
    44        repoURL: https://github.com/infra-team/cluster-deployments.git
    45        files:
    46        - path: "**/config.json"
    47    template:
    48      metadata:
    49        name: '{{.cluster.name}}-guestbook'
    50      spec:
    51        source:
    52          repoURL: https://github.com/infra-team/cluster-deployments.git
    53          targetRevision: HEAD
    54          path: apps/guestbook
    55        destination:
    56          server: '{{.cluster.address}}'
    57          namespace: guestbook