Bug 2129679

Summary: clusters belong to global clusterset is not selected by placement when rescheduling
Product: Red Hat Advanced Cluster Management for Kubernetes Reporter: qhao <qhao>
Component: Cluster LifecycleAssignee: qhao <qhao>
Status: CLOSED ERRATA QA Contact: Song Lai <slai>
Severity: high Docs Contact:
Priority: unspecified    
Version: rhacm-2.6CC: cbynum, dhuynh, huichen, leyan
Target Milestone: ---Flags: slai: qe_test_coverage+
cbynum: rhacm-2.6+
bot-tracker-sync: rhacm-2.6.z+
Target Release: rhacm-2.6.2   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-12-14 22:40:31 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description qhao 2022-09-26 02:43:21 UTC
Description of the problem:

The env has 1 managedclusters, belongs to both global clustersets, and global clustersets binds to namespace open-cluster-management-global-set.
```
$ clusteradm get clusters
NAME       ACCEPTED   AVAILABLE   CLUSTERSET   CPU   MEMORY       KUBERNETES VERSION
cluster1   true       True        default      24    49265492Ki   v1.23.4

$ clusteradm get clustersets
NAME      BOUND NAMESPACES                     STATUS
default                                        1 ManagedClusters selected
global    open-cluster-management-global-set   1 ManagedClusters selected
```

Create placement under namespace open-cluster-management-global-set, 1 cluster selected.
```
$ cat placement.yaml
apiVersion: cluster.open-cluster-management.io/v1beta1
kind: Placement
metadata:
  name: demo-placement
  namespace: open-cluster-management-global-set
spec:
  predicates:
  - requiredClusterSelector:
      labelSelector:
        matchExpressions:
        - key: name
          operator: NotIn
          values:
          - local-clusterr
  tolerations:
  - key: cluster.open-cluster-management.io/unreachable
    operator: Exists

$ oc create -f placement.yaml
placement.cluster.open-cluster-management.io/demo-placement created

$ oc get placement -A
NAMESPACE                            NAME             SUCCEEDED   REASON                  SELECTEDCLUSTERS
open-cluster-management-global-set   demo-placement   True        AllDecisionsScheduled   1
```

Add new cluster cluster2, it also belongs to global clusterset.
```
$ cat cluster2.yaml
apiVersion: cluster.open-cluster-management.io/v1
kind: ManagedCluster
metadata:
  name: cluster2
spec:
  hubAcceptsClient: true
  leaseDurationSeconds: 60
$ oc create -f cluster2.yaml
managedcluster.cluster.open-cluster-management.io/cluster2 created

$ clusteradm get clusters
NAME       ACCEPTED   AVAILABLE   CLUSTERSET   CPU   MEMORY       KUBERNETES VERSION
cluster1   true       True        default      24    49265492Ki   v1.23.4
cluster2   true       Unknown     default

$ clusteradm get clustersets
NAME      BOUND NAMESPACES                     STATUS
default                                        2 ManagedClusters selected
global    open-cluster-management-global-set   2 ManagedClusters selected
```

However, the placement decision didn't update, and only 1 cluster was selected.
```
$ oc get placement -A
NAMESPACE                            NAME             SUCCEEDED   REASON                  SELECTEDCLUSTERS
open-cluster-management-global-set   demo-placement   True        AllDecisionsScheduled   1
```

Release version:
2.6

Operator snapshot version:

OCP version:

Browser Info:

Steps to reproduce:
1.
2.
3.

Actual results:

Expected results:
Both of the 2 clusters were selected.
```
$ oc get placement -A
NAMESPACE                            NAME             SUCCEEDED   REASON                  SELECTEDCLUSTERS
open-cluster-management-global-set   demo-placement   True        AllDecisionsScheduled   2
```

Additional info:

Comment 5 errata-xmlrpc 2022-12-14 22:40:31 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: Red Hat Advanced Cluster Management 2.6.3 security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:9040