Bug 2042223

Summary: the value of name label changed from clusterclaim name to cluster name
Product: Red Hat Advanced Cluster Management for Kubernetes Reporter: Hui Chen <huichen>
Component: Cluster LifecycleAssignee: Jian Qiu <jqiu>
Status: CLOSED ERRATA QA Contact: Hui Chen <huichen>
Severity: medium Docs Contact: Christopher Dawson <cdawson>
Priority: high    
Version: rhacm-2.4.zCC: crizzo, dhuynh, yuhe
Target Milestone: ---Keywords: Regression
Target Release: rhacm-2.4.3Flags: bot-tracker-sync: rhacm-2.4.z+
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-04-20 23:47:32 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 Hui Chen 2022-01-19 03:42:33 UTC
Description of the problem:

I have a clusterpool created, and I try to claim the cluster from this clusterpool by creating a clusterclaim resources. then I can see the clusterdeployment created and imported in my hub cluster.

below was the labels of the managedclusters:
```
hchenxa@huichen-mac clc-ui-e2e % oc get managedcluster acmqe-clc-auto-pool-aws-b6h6t --show-labels
NAME                            HUB ACCEPTED   MANAGED CLUSTER URLS                                                        JOINED   AVAILABLE   AGE   LABELS
acmqe-clc-auto-pool-aws-b6h6t   true           https://api.acmqe-clc-auto-pool-aws-b6h6t.dev09.red-chesterfield.com:6443   True     True        10h   cloud=Amazon,cluster.open-cluster-management.io/clusterset=clc-automation-pools,clusterID=b56941a9-4711-4bb2-ae8b-d9ff7a6f9e2c,feature.open-cluster-management.io/addon-application-manager=available,feature.open-cluster-management.io/addon-cert-policy-controller=available,feature.open-cluster-management.io/addon-iam-policy-controller=available,feature.open-cluster-management.io/addon-observability-controller=available,feature.open-cluster-management.io/addon-policy-controller=available,feature.open-cluster-management.io/addon-search-collector=available,feature.open-cluster-management.io/addon-work-manager=available,name=acmqe-clc-auto-pool-awsclaim,openshiftVersion=4.9.4,region=us-east-2,vendor=OpenShift
```

we can see the current value of name label is `acmqe-clc-auto-pool-awsclaim`

then from the UI part, I delete the name label by mistake, but seems it can be added back by controller. but the value changed to the cluster name like below:
```
hchenxa@huichen-mac clc-ui-e2e % oc get managedcluster acmqe-clc-auto-pool-aws-b6h6t --show-labels
NAME                            HUB ACCEPTED   MANAGED CLUSTER URLS                                                        JOINED   AVAILABLE   AGE   LABELS
acmqe-clc-auto-pool-aws-b6h6t   true           https://api.acmqe-clc-auto-pool-aws-b6h6t.dev09.red-chesterfield.com:6443   True     True        10h   cloud=Amazon,cluster.open-cluster-management.io/clusterset=clc-automation-pools,clusterID=b56941a9-4711-4bb2-ae8b-d9ff7a6f9e2c,feature.open-cluster-management.io/addon-application-manager=available,feature.open-cluster-management.io/addon-cert-policy-controller=available,feature.open-cluster-management.io/addon-iam-policy-controller=available,feature.open-cluster-management.io/addon-observability-controller=available,feature.open-cluster-management.io/addon-policy-controller=available,feature.open-cluster-management.io/addon-search-collector=available,feature.open-cluster-management.io/addon-work-manager=available,name=acmqe-clc-auto-pool-aws-b6h6t,openshiftVersion=4.9.4,region=us-east-2,vendor=OpenShift
```

we can see the value of name label changed to `acmqe-clc-auto-pool-aws-b6h6t` now.


Release version:
2.4
Operator snapshot version:

OCP version:
4.9
Browser Info:

Steps to reproduce:
1.Create a clusterpool
2.Claim the cluster from the clusterpool
3.Check the cluster labels
4.Delete the name label
5.Recheck the cluster labels.

Actual results:
The labels was changed
Expected results:

I think the name should be the cluster name here, if we want to add clusterclaim /clusterpool info in managedcluster resources, may be we can introduce other label name here like clusterclaimref="xxxxx", clusterpoolref="xxxxx".

Additional info:

Comment 1 Hui Chen 2022-02-10 04:38:48 UTC
I have some concern in upgrade scenario.

we have one cluster claimed from cluster pool in ACM 2.3, after after upgrade the ACM hub to 2.4 version, the name label was using the clustername. 

I am not quite sure about the behavior in ACM 2.3 for the cluster labels of clusters which claimed from the cluster pool, but I think it's better to make the behavior consistent after upgrade.

Comment 2 Hui Chen 2022-02-11 07:17:51 UTC
and there have another case will be impact like:
if I have a new cluster claimed from the clusterpool, the label of name will be the clusterclaim name first, then I tried to detach the cluster and re-import the cluster, the label of name will be use the clusterdeployment name.

Comment 5 Hui Chen 2022-02-14 02:56:42 UTC
since the issue still have some problem and dev team was under discussion on this one, remark the status to Assigned

Comment 8 dhuynh 2022-04-12 21:04:15 UTC
Validated on v2.4.3RC2 and on v2.5.0-DOWNSTREAM-2022-04-03-10-21-01. I deleted the name label off a cluster claim and i can see it reconcile with the same label coming back using the managed cluster's name before and after delete label.

Comment 14 errata-xmlrpc 2022-04-20 23:47:32 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 (Moderate: Red Hat Advanced Cluster Management 2.4.3 security updates and bug fixes), 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:1476