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

Fix ArgoCd SyncWindow configuration #227

Merged
merged 2 commits into from
Jul 6, 2022
Merged
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
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
4 changes: 0 additions & 4 deletions services/cd-service/pkg/repository/transformer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1512,14 +1512,10 @@ spec:
- '*'
syncWindows:
- applications:
- '*'
clusters:
- '*'
duration: 1h
kind: deny
manualSync: true
namespaces:
- '*'
schedule: '* * * * *'
`
if string(content) != expected {
Expand Down