diff --git a/services/cd-service/pkg/argocd/render.go b/services/cd-service/pkg/argocd/render.go index 449c520c7..b09e2f3be 100644 --- a/services/cd-service/pkg/argocd/render.go +++ b/services/cd-service/pkg/argocd/render.go @@ -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, diff --git a/services/cd-service/pkg/argocd/render_test.go b/services/cd-service/pkg/argocd/render_test.go index e414adbf4..58f348aec 100644 --- a/services/cd-service/pkg/argocd/render_test.go +++ b/services/cd-service/pkg/argocd/render_test.go @@ -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 `, }, @@ -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 `, }, diff --git a/services/cd-service/pkg/argocd/v1alpha1/types.go b/services/cd-service/pkg/argocd/v1alpha1/types.go index 8b62e9764..e65d9926c 100644 --- a/services/cd-service/pkg/argocd/v1alpha1/types.go +++ b/services/cd-service/pkg/argocd/v1alpha1/types.go @@ -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"` } diff --git a/services/cd-service/pkg/repository/transformer_test.go b/services/cd-service/pkg/repository/transformer_test.go index f895771d2..95fbd2461 100644 --- a/services/cd-service/pkg/repository/transformer_test.go +++ b/services/cd-service/pkg/repository/transformer_test.go @@ -1512,14 +1512,10 @@ spec: - '*' syncWindows: - applications: - - '*' - clusters: - '*' duration: 1h kind: deny manualSync: true - namespaces: - - '*' schedule: '* * * * *' ` if string(content) != expected {