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

     1  # This example demonstrates a git file generator which produces its items based on one or
     2  # more files referenced in a git repo. The referenced files would contain a json/yaml list of
     3  # arbitrary structured objects. Each item of the list would become a set of parameters to a
     4  # generated application.
     5  #
     6  # Suppose the following git directory structure:
     7  #  
     8  # cluster-deployments
     9  # ├── apps
    10  # │   └── guestbook
    11  # │       ├── v1.0
    12  # │       │   └── install.yaml
    13  # │       └── v2.0
    14  # │           └── install.yaml
    15  # └── config
    16  #     └── clusters.json
    17  #
    18  # In this example, the `clusters.json` file is json list of structured data:
    19  # [
    20  #     {
    21  #         "account": "123456",
    22  #         "asset_id": "11223344",
    23  #         "cluster": {
    24  #             "owner": "Jesse_Suen@intuit.com",
    25  #             "name": "engineering-dev",
    26  #             "address": "http://1.2.3.4"
    27  #         },
    28  #         "appVersions": {
    29  #             "prometheus-operator": "v0.38",
    30  #             "guestbook": "v2.0"
    31  #         }
    32  #     },
    33  #     {
    34  #         "account": "456789",
    35  #         "asset_id": "55667788",
    36  #         "cluster": {
    37  #             "owner": "Alexander_Matyushentsev@intuit.com",
    38  #             "name": "engineering-prod",
    39  #             "address": "http://2.4.6.8"
    40  #         },
    41  #         "appVersions": {
    42  #             "prometheus-operator": "v0.38",
    43  #             "guestbook": "v1.0"
    44  #         }
    45  #     }
    46  # ]
    47  #
    48  apiVersion: argoproj.io/v1alpha1
    49  kind: ApplicationSet
    50  metadata:
    51    name: guestbook
    52  spec:
    53    goTemplate: true
    54    goTemplateOptions: ["missingkey=error"]
    55    generators:
    56    - git:
    57        repoURL: https://github.com/infra-team/cluster-deployments.git
    58        files:
    59        - path: config/clusters.json
    60    template:
    61      metadata:
    62        name: '{{.cluster.name}}-guestbook'
    63      spec:
    64        source:
    65          repoURL: https://github.com/infra-team/cluster-deployments.git
    66          targetRevision: HEAD
    67          path: apps/guestbook/{{.appVersions.guestbook}}
    68        destination:
    69          server: http://kubernetes.default.svc
    70          namespace: guestbook