Skip to content

Conversation

@ryanzhang-oss
Copy link
Contributor

@ryanzhang-oss ryanzhang-oss commented Nov 6, 2025

Description of your changes

Add k8s version and cluster api-server to the clusterProfile status by fetching them from the member agent side.
This is to implement kep5339

Fixes #

I have:

  • Run make reviewable to ensure this PR is ready for review.

How has this code been tested

Special notes for your reviewer

@ryanzhang-oss ryanzhang-oss force-pushed the add-clusterprofile-status branch 2 times, most recently from 8248438 to 1230ba6 Compare November 6, 2025 03:31
@ryanzhang-oss ryanzhang-oss changed the title Add clusterProfile status feat: add clusterProfile status fields Nov 6, 2025
@ryanzhang-oss ryanzhang-oss force-pushed the add-clusterprofile-status branch 4 times, most recently from b870cf4 to 1985d16 Compare November 11, 2025 05:11
Copy link
Collaborator

@michaelawyu michaelawyu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few minor comments, otherwise LGTM.

@michaelawyu
Copy link
Collaborator

The work applier IT failure is kind of interesting... The issue is that the system finds an unexpected diff in the .spec.template.metadata.creationTimestamp field ->

This happens because

a) with 0.34 API the creationTimestamp field in the object metadata now has the omitzero field, so in the test code when an object is marshaled in JSON the data won't have this field at all
b) but the K8s environment simulated by envtest uses K8s 1.30, and this version of the API server does not have the omitzero tag enabled for the creationTimestamp field, so when getting an object it will return data that has this field

and as a result when we do the comparison the system will find an extra field and complain about the diff accordingly

@ryanzhang-oss ryanzhang-oss force-pushed the add-clusterprofile-status branch 3 times, most recently from 6c434f3 to 2a32a1a Compare November 15, 2025 21:15
@ryanzhang-oss ryanzhang-oss force-pushed the add-clusterprofile-status branch 2 times, most recently from 4a0f79b to 3452558 Compare November 20, 2025 23:26
Signed-off-by: Ryan Zhang <yangzhangrice@hotmail.com>
Signed-off-by: Ryan Zhang <yangzhangrice@hotmail.com>
@ryanzhang-oss ryanzhang-oss force-pushed the add-clusterprofile-status branch from 3452558 to 70cf9e3 Compare November 20, 2025 23:29
cp.Status.AccessProviders[0].Cluster.Server = clusterEntry.Value
}
// Get the CA Data
certificateAuthorityData, exists := mc.Status.Properties[propertyprovider.ClusterCertificateAuthorityProperty]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we storing/exposing the CAauthority here?
what makes this necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to implement kep5339

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the hub CA data is not a secret, right?

Signed-off-by: Ryan Zhang <yangzhangrice@hotmail.com>
Signed-off-by: Ryan Zhang <yangzhangrice@hotmail.com>
Signed-off-by: Ryan Zhang <yangzhangrice@hotmail.com>
@codecov
Copy link

codecov bot commented Nov 23, 2025

Codecov Report

❌ Patch coverage is 65.78947% with 26 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...lers/clusterinventory/clusterprofile/controller.go 47.61% 7 Missing and 4 partials ⚠️
pkg/propertyprovider/azure/provider.go 76.08% 9 Missing and 2 partials ⚠️
pkg/controllers/placement/controller.go 33.33% 0 Missing and 4 partials ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Collaborator

@michaelawyu michaelawyu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some minor comments, PTAL.

} else {
// throw an alert
_ = controller.NewUnexpectedBehaviorError(fmt.Errorf("cluster certificate authority data not found in member cluster %s status", mc.Name))
cp.Status.AccessProviders[0].Cluster.InsecureSkipTLSVerify = true
Copy link
Collaborator

@michaelawyu michaelawyu Nov 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Ryan! Maybe this should be controlled by another property (or flag) instead of falling back to the no TLS option (as it might not be available)?

Copy link
Collaborator

@michaelawyu michaelawyu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ;)

@ryanzhang-oss ryanzhang-oss merged commit 2ca743d into kubefleet-dev:main Nov 25, 2025
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants