Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cache busting #16

Open
wants to merge 6 commits into
base: fix-spec-update
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 3 additions & 17 deletions controller/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,23 +168,9 @@ func (m *appStateManager) getRepoObjs(app *v1alpha1.Application, sources []v1alp
targetObjs := make([]*unstructured.Unstructured, 0)

// Store the map of all sources having ref field into a map for applications with sources field
refSources := make(map[string]*appv1.RefTargeRevisionMapping)
if app.Spec.HasMultipleSources() {
// Get Repositories for all sources before generating Manifests
for _, source := range sources {
if source.Ref != "" {
repo, err := m.db.GetRepository(context.Background(), source.RepoURL)
if err != nil {
return nil, nil, err
}
refKey := "$" + source.Ref
refSources[refKey] = &appv1.RefTargeRevisionMapping{
Repo: *repo,
TargetRevision: source.TargetRevision,
Chart: source.Chart,
}
}
}
refSources, err := argo.GetRefSources(context.Background(), app.Spec, m.db)
if err != nil {
return nil, nil, fmt.Errorf("failed to get ref sources: %v", err)
}

for i, source := range sources {
Expand Down
46 changes: 21 additions & 25 deletions docs/user-guide/multiple_sources.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Multiple Sources for an Application

Argo CD has the ability to specify multiple sources to add services to the Application. Argo CD compiles all the sources and reconciles each source individually for creating the application.
Argo CD has the ability to specify multiple sources to add services to the Application. Argo CD compiles all the sources
and reconciles each source individually for creating the application.

You can provide multiple sources using the `sources` field. When you specify the sources field, Argo CD will ignore the values under `source` field for generating the application.
You can provide multiple sources using the `sources` field. When you specify the `sources` field, Argo CD will ignore
the `source` (singular) field when generating manifests for the application.

See below example for specifying multiple sources:
See the below example for specifying multiple sources:

```yaml
apiVersion: argoproj.io/v1alpha1
Expand All @@ -25,41 +27,35 @@ spec:
namespace: argocd
sources:
- chart: elasticsearch
helm:
valueFiles:
- values.yaml
repoURL: https://helm.elastic.co
targetRevision: 7.6.0
- repoURL: https://github.com/argoproj/argocd-example-apps.git
path: guestbook
targetRevision: HEAD
```

The above example has 2 sources specified. Argo CD will reconcile each source separately and combine the resources that are generated for generating the application.
The above example has two sources specified. Argo CD will generate the manifests for each source separately and combine
the resulting manifests.

In case application has multiple entries for the same source (repoURL), Argo CD would pick the source that is mentioned later in the list of sources. For example, consider the below list of sources:
In case an application has multiple entries for the same source (repoURL), Argo CD will pick the source that is
mentioned later in the list of sources. For example, consider the below list of sources:

```yaml
sources:
- chart: elasticsearch
helm:
valueFiles:
- values.yaml
repoURL: https://helm.elastic.co
targetRevision: 7.6.0
- repoURL: https://github.com/argoproj/argocd-example-apps.git
path: guestbook
targetRevision: HEAD
- chart: elasticsearch
helm:
valueFiles:
- values.yaml
repoURL: https://helm.elastic.co
targetRevision: 7.7.0
- chart: elasticsearch
repoURL: https://helm.elastic.co
targetRevision: 7.6.0
- repoURL: https://github.com/argoproj/argocd-example-apps.git
path: guestbook
targetRevision: HEAD
- chart: elasticsearch
repoURL: https://helm.elastic.co
targetRevision: 7.7.0
```

In the above list, the application has 2 sources referring to the same repoURL. In this case, Argo CD will generate the manifests for source with `targetRevision: 7.6.0` and then append the manifests generated for source with `targetRevision: 7.7.0`.

In the above list, the application has two sources referring to the same repoURL. In this case, Argo CD will generate
the manifests for source with `targetRevision: 7.6.0` and then append the manifests generated for source with
`targetRevision: 7.7.0`.

## Helm Value files from external Git repository

Expand Down
6 changes: 3 additions & 3 deletions pkg/apis/api-rules/violation_exceptions.list
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ API rule violation: names_match,github.com/argoproj/argo-cd/v2/pkg/apis/applicat
API rule violation: names_match,github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1,KustomizeOptions,BinaryPath
API rule violation: names_match,github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1,KustomizeOptions,BuildOptions
API rule violation: names_match,github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1,PullRequestGenerator,GitLab
API rule violation: names_match,github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1,RefTargeRevisionMapping,Chart
API rule violation: names_match,github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1,RefTargeRevisionMapping,Repo
API rule violation: names_match,github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1,RefTargeRevisionMapping,TargetRevision
API rule violation: names_match,github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1,RefTarget,Chart
API rule violation: names_match,github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1,RefTarget,Repo
API rule violation: names_match,github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1,RefTarget,TargetRevision
API rule violation: names_match,github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1,RepoCreds,GitHubAppEnterpriseBaseURL
API rule violation: names_match,github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1,RepoCreds,GithubAppId
API rule violation: names_match,github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1,RepoCreds,GithubAppInstallationId
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/application/v1alpha1/applicationset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ const (
// prefix "Info" means informational condition
type ApplicationSetConditionType string

//ErrorOccurred / ParametersGenerated / TemplateRendered / ResourcesUpToDate
// ErrorOccurred / ParametersGenerated / TemplateRendered / ResourcesUpToDate
const (
ApplicationSetConditionErrorOccurred ApplicationSetConditionType = "ErrorOccurred"
ApplicationSetConditionParametersGenerated ApplicationSetConditionType = "ParametersGenerated"
Expand Down
Loading