Skip to content

Commit

Permalink
Fix ArgoCd SyncWindow configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
sven-urbanski-freiheit-com committed Jul 6, 2022
1 parent 9cfdf67 commit 7c12a6a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
2 changes: 0 additions & 2 deletions services/cd-service/pkg/argocd/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ func RenderV1Alpha1(gitUrl string, gitBranch string, config config.EnvironmentCo
}
syncWindows = append(syncWindows, &v1alpha1.SyncWindow{
Applications: apps,
Clusters: []string{"*"},
Namespaces: []string{"*"},
Schedule: w.Schedule,
Duration: w.Duration,
Kind: w.Kind,
Expand Down
8 changes: 0 additions & 8 deletions services/cd-service/pkg/argocd/render_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,10 @@ spec:
- '*'
syncWindows:
- applications:
- '*'
clusters:
- '*'
duration: invalid duration
kind: neither deny nor allow
manualSync: true
namespaces:
- '*'
schedule: not a valid crontab entry
`,
},
Expand Down Expand Up @@ -200,13 +196,9 @@ spec:
syncWindows:
- applications:
- app*
clusters:
- '*'
duration: invalid duration
kind: neither deny nor allow
manualSync: true
namespaces:
- '*'
schedule: not a valid crontab entry
`,
},
Expand Down
10 changes: 8 additions & 2 deletions services/cd-service/pkg/argocd/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,16 @@ type SyncWindow struct {
Duration string `json:"duration,omitempty" protobuf:"bytes,3,opt,name=duration"`
// Applications contains a list of applications that the window will apply to
Applications []string `json:"applications,omitempty" protobuf:"bytes,4,opt,name=applications"`

// NOTE: Applications, Clusters and Namespaces are an OR-expression in ArgoCd!
// Example: You set Application="my-app" and Clusters="*"
// This means: It applies to ALL applications.
// To avoid this, we omit the settings for Clusters and Namespaces completely.

// Namespaces contains a list of namespaces that the window will apply to
Namespaces []string `json:"namespaces,omitempty" protobuf:"bytes,5,opt,name=namespaces"`
//Namespaces []string `json:"namespaces,omitempty" protobuf:"bytes,5,opt,name=namespaces"`
// Clusters contains a list of clusters that the window will apply to
Clusters []string `json:"clusters,omitempty" protobuf:"bytes,6,opt,name=clusters"`
//Clusters []string `json:"clusters,omitempty" protobuf:"bytes,6,opt,name=clusters"`
// ManualSync enables manual syncs when they would otherwise be blocked
ManualSync bool `json:"manualSync,omitempty" protobuf:"bytes,7,opt,name=manualSync"`
}
Expand Down

0 comments on commit 7c12a6a

Please sign in to comment.