Skip to content

Adopt the new k8s-sigs about-api project's ClusterProperty API #838

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

Open
qiujian16 opened this issue Feb 17, 2025 · 9 comments
Open

Adopt the new k8s-sigs about-api project's ClusterProperty API #838

qiujian16 opened this issue Feb 17, 2025 · 9 comments
Assignees
Labels
enhancement New feature or request

Comments

@qiujian16
Copy link
Member

Describe the enhancement

There is a new API over at k8s-sigs call the ClusterProperty API: https://github.com/kubernetes-sigs/about-api
It's for defining arbitrary properties about a cluster which is similar to our current usage of ClusterClaim API.

We should consider migrating from ClusterClaim to ClusterProperty to better follow k8s community standard.

original issue here open-cluster-management-io/community#156

@qiujian16
Copy link
Member Author

/assign @zhujian7

@gnana997
Copy link

Hi @qiujian16 , Can I try to work on this ?
Thanks

@qiujian16
Copy link
Member Author

sure thing and thanks!, something to note:

  1. we already have clusterclaim, and we cannot directly replace clusterclaim by clusterproperty. It is more like a merge and clusterproperty take the precedence if the name of the two are the same.
  2. this should be gated by a feature gate.

cc @zhujian7
/assign @gnana997

@gnana997
Copy link

Hi @qiujian16 , So Basically I should keep the support for ClusterClaim but I need to create support for ClusterProperty which will take precedence on ClusterClaim. So Basically If ClusterProperty is not found it will try to find by ClusterClaim.
Like for example in the below mentioned test:
func (c *ClusterSelector) Matches(clusterlabels, clusterclaims map[string]string) bool { // match with label selector if ok := c.labelSelector.Matches(labels.Set(clusterlabels)); !ok { return false } // match with claim selector if ok := c.claimSelector.Matches(labels.Set(clusterclaims)); !ok { return false } return true }

If label selector matches and if cluster property selector does not match then I need to go for cluster claim matcher also right?

I know I have simplified it a lot. However just want to confirm the logic before I proceed with the implementation.

@qiujian16
Copy link
Member Author

I do not think we do need to update managedcluster API, the clusterproperty will still be reflected as status.clusterclaims in the managedCluster, so we do not need to change the cluster selector part.

What i meant is how the registration agent collect both clusterclaims and clusterproperty on the spoke and update the status.clusterClaims on the managedcluster CR.

@qiujian16
Copy link
Member Author

this is the draft code main...qiujian16:ocm:about-api I did before.

@gnana997
Copy link

Thanks for the context above, @qiujian16 . I think I have a better understanding now. I’ll need to fetch the cluster properties during registration. I’m going to start working on this and will reach out if I have any questions.

@gnana997
Copy link

Hi @qiujian16 , I have raised a draft pr to confirm the changes. I am still working on the test cases and also adding more vendor sigs.k8s.io/about-api files as needed.
Also I wanted to confirm I did not try upgrading the go version to 1.23 as it is being handled through another issue So I am working with 1.22.5 only.

Can you let me know if you find something that I am missing?

Thanks

@gnana997
Copy link

Hi @qiujian16 , Also wanted to confirm should add PR Type as Non-Breaking or tag it Release. I got confused as this is assigned to a parent release.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In Progress
Development

No branches or pull requests

3 participants