argoproj / argo-cd

Declarative Continuous Deployment for Kubernetes
https://argo-cd.readthedocs.io
Apache License 2.0
17.92k stars 5.46k forks source link

Sync Window doesn't match if based on cluster name #9866

Open mtougeron opened 2 years ago

mtougeron commented 2 years ago

Checklist:

Describe the bug

When adding a Sync Window the matching works for Applications, Namespaces and Cluster.Server but not Cluster.Name

To Reproduce

Create a sync window based on just a cluster name without an Application or Namespace

argocd proj windows add default --kind deny --schedule "* * * * *" --duration 24h --clusters "tge-aws"

image

I've tried creating the Sync Window both via the cli and via the ui and the results are the same.

Expected behavior

I would expect Applications that sync to the cluster named "tge-aws" would be blocked by the deny of the Sync Window.

However, when I create a Sync Window based on the Cluster.Server it works as expected. It appears to just be the Cluster.Name that is not working properly.

Version

argocd: v2.4.3+471685f.dirty
  BuildDate: 2022-06-28T02:02:50Z
  GitCommit: 471685feae063c1c2e36a5ff268c4da87c697b85
  GitTreeState: dirty
  GoVersion: go1.18.3
  Compiler: gc
  Platform: darwin/amd64
argocd-server: v2.4.3+471685f
  BuildDate: 2022-06-27T21:02:55Z
  GitCommit: 471685feae063c1c2e36a5ff268c4da87c697b85
  GitTreeState: clean
  GoVersion: go1.18.3
  Compiler: gc
  Platform: linux/amd64
  Kustomize Version: v4.4.1 2021-11-11T23:36:27Z
  Helm Version: v3.8.1+g5cb9af4
  Kubectl Version: v0.23.1
  Jsonnet Version: v0.18.0

Other

I saw the code at https://github.com/argoproj/argo-cd/blob/v2.4.3/pkg/apis/application/v1alpha1/types.go#L1832:L1842 but it seems fine to me.

This may be related to https://github.com/argoproj/argo-cd/issues/6110 but I thought it is different enough that it warranted opening a new issue, apologies if not.

sambonbonne commented 1 year ago

I have a similar issue, I expect the clusters and applications lists to make a AND match but it seems it makes a OR match, which is not what I wanted.