Skip to content

Commit

Permalink
cache busing
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
  • Loading branch information
crenshaw-dev committed Dec 6, 2022
1 parent 6fb63a6 commit 6509625
Show file tree
Hide file tree
Showing 11 changed files with 429 additions and 249 deletions.
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
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
14 changes: 7 additions & 7 deletions pkg/client/clientset/versioned/fake/register.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions pkg/client/clientset/versioned/scheme/register.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6509625

Please sign in to comment.