Skip to content

Conversation

@ryanzhang-oss
Copy link
Contributor

Description of your changes

Block user from specifying the same resource in the resource select section in the CRP.

I have:

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

How has this code been tested

UT/E2E

Special notes for your reviewer

@ryanzhang-oss ryanzhang-oss requested a review from Copilot April 15, 2025 21:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.

Files not reviewed (1)
  • Makefile: Language not supported
Comments suppressed due to low confidence (2)

pkg/controllers/clusterresourceplacement/resource_selector.go:142

  • [nitpick] Verify that the descending sort order based on the namespace/name string comparison is intentional. If an ascending order is preferred, consider reversing the comparison condition.
return strings.Compare(fmt.Sprintf("%s/%s", obj1.GetNamespace(), obj1.GetName()), fmt.Sprintf("%s/%s", obj2.GetNamespace(), obj2.GetName())) > 0

pkg/controllers/clusterresourceplacement/resource_selector.go:116

  • The error message for a duplicate resource is generic. Consider enhancing it with additional context to help users identify and resolve the duplicate resource selection.
if _, exist := resourceMap[ri]; exist {

}, eventuallyDuration, eventuallyInterval).Should(Succeed(), "Failed to update resourceOverride %s with non-existent label key", roName)

By("Verify the CRP status should have one cluster failed to override while the rest stuck in rollout")
// TODO: need to construct the expected status
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does crpStatusWithOverrideUpdatedFailedActual work here, like line 1054?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not really, crpStatusWithOverrideUpdatedFailedActual failed everywhere while this one only failed at one cluster and the rest of the rollout is stuck (to prevent the wipe out of all the copies)

Ryan Zhang added 3 commits April 17, 2025 11:37
Signed-off-by: Ryan Zhang <zhangryan@microsoft.com>
Signed-off-by: Ryan Zhang <zhangryan@microsoft.com>
Signed-off-by: Ryan Zhang <zhangryan@microsoft.com>
@ryanzhang-oss ryanzhang-oss force-pushed the block-dupRes-select branch 2 times, most recently from 1c026f5 to a0836a3 Compare April 17, 2025 20:01
Signed-off-by: Ryan Zhang <zhangryan@microsoft.com>
@ryanzhang-oss ryanzhang-oss merged commit 0dad88b into kubefleet-dev:main Apr 18, 2025
16 checks passed
@jwtty jwtty mentioned this pull request May 1, 2025
1 task
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