github.com/argoproj/argo-cd/v3@v3.2.1/docs/user-guide/multiple_sources.md (about)

     1  # Multiple Sources for an Application
     2  
     3  By default an Argo CD application is a link between a single source and a cluster. Sometimes however, you want to combine
     4  files from multiple locations to form a single Application.
     5  
     6  Argo CD has the ability to specify multiple sources for a single Application. Argo CD compiles all the sources
     7  and reconciles the combined resources.
     8  
     9  You can provide multiple sources using the `sources` field. When you specify the `sources` field, Argo CD will ignore 
    10  the `source` (singular) field.
    11  
    12  See the below example for specifying multiple sources:
    13  
    14  ```yaml
    15  apiVersion: argoproj.io/v1alpha1
    16  kind: Application
    17  metadata:
    18    name: my-billing-app
    19    namespace: argocd
    20  spec:
    21    project: default
    22    destination:
    23      server: https://kubernetes.default.svc
    24      namespace: default
    25    sources:
    26      - repoURL: https://github.com/mycompany/billing-app.git
    27        path: manifests
    28        targetRevision: 8.5.1
    29      - repoURL: https://github.com/mycompany/common-settings.git
    30        path: configmaps-billing
    31        targetRevision: HEAD
    32  ```
    33  
    34  The above example has two sources specified that need to be combined in order to create the "billing" application. Argo CD will generate the manifests for each source separately and combine 
    35  the resulting manifests.
    36  
    37  !!! warning "Do not abuse multiple sources"
    38      Note this feature is **NOT** destined as a generic way to group different/unrelated applications. Take a look at [applicationsets](../user-guide/application-set.md) and the [app-of-apps](../../operator-manual/cluster-bootstrapping/) pattern if you want to have a single entity for multiple applications. If you find yourself using more than 2-3 items in the `sources` array then you are almost certainly abusing this feature and you need to rethink your application grouping strategy.
    39  
    40  If multiple sources produce the same resource (same `group`, `kind`, `name`, and `namespace`), the last source to 
    41  produce the resource will take precedence. Argo CD will produce a `RepeatedResourceWarning` in this case, but it will 
    42  sync the resources. This provides a convenient way to override a resource from a chart with a resource from a Git repo.
    43  
    44  ## Helm value files from external Git repository
    45  
    46  One of the most common scenarios for using multiple sources is the following
    47  
    48  1. Your organization wants to use an external/public Helm chart
    49  1. You want to override the Helm values with your own local values
    50  1. You don't want to clone the Helm chart locally as well because that would lead to duplication and you would need to monitor it manually for upstream changes.
    51  
    52  In this scenario you can use the multiple sources features to combine the external chart with your own local values.
    53  
    54  Helm sources can reference value files from git sources. This allows you to use a third-party Helm chart with custom,
    55  git-hosted values.
    56  
    57  ```yaml
    58  apiVersion: argoproj.io/v1alpha1
    59  kind: Application
    60  spec:
    61    sources:
    62    - repoURL: 'https://prometheus-community.github.io/helm-charts'
    63      chart: prometheus
    64      targetRevision: 15.7.1
    65      helm:
    66        valueFiles:
    67        - $values/charts/prometheus/values.yaml
    68    - repoURL: 'https://git.example.com/org/value-files.git'
    69      targetRevision: dev
    70      ref: values
    71  ```
    72  
    73  In the above example, the `prometheus` chart will use the value file from `git.example.com/org/value-files.git`. 
    74  For Argo to reference the external Git repository containing the value files, you must set the `ref` parameter on
    75  the repository. In the above example, the parameter `ref: values` maps to the variable `$values`, which resolves
    76  to the root of the `value-files` repository. 
    77  Note that the `$values` variable can only be used at the beginning of the value file path and that its path is always relative to the root of the referenced source.
    78  
    79  If the `path` field is set in the `$values` source, Argo CD will attempt to generate resources from the git repository
    80  at that URL. If the `path` field is not set, Argo CD will use the repository solely as a source of value files.
    81  
    82  !!! note
    83      Sources with the `ref` field set cannot include the `chart` field. Currently, Argo CD does not support using another Helm chart as a source for value files.
    84  
    85  !!! note
    86      Even when the `ref` field is configured with the `path` field, `$value` still represents the root of sources with the `ref` field. Consequently, `valueFiles` must be specified as relative paths from the root of sources.