Skip to content

Conversation

@zhiying-lin
Copy link
Contributor

Description of your changes

  • watch override snapshots in the rollout controller

Fixes #

I have:

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

How has this code been tested

added e2e tests

Special notes for your reviewer

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 3 out of 3 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

pkg/controllers/rollout/controller.go:713

  • The error message should mention 'label' instead of 'annotation' for consistency.
klog.ErrorS(controller.NewUnexpectedBehaviorError(fmt.Errorf("invalid annotation value %s : %w", fleetv1beta1.IsLatestSnapshotLabel, err)),


// handleClusterResourceOverrideSnapshot parse the clusterResourceOverrideSnapshot label and enqueue the CRP name associated
// with the clusterResourceOverrideSnapshot if set.
func handleClusterResourceOverrideSnapshot(o client.Object, q workqueue.RateLimitingInterface) {
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a way to combine these two functions? We will have RP and CRP co exist all over the place soon.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we could, but need to rely on the if else condition to handle some cases based on the type, including logging, which hurts our readability.

For the current case, prefer to do the copy & paste.

Copy link
Contributor

Choose a reason for hiding this comment

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

is there a way to use generic templating?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it may be workable, either using https://google.github.io/styleguide/go/decisions#generics or interface.

@zhiying-lin zhiying-lin force-pushed the override-trigger-rollout branch from bd5a1b5 to 9dc98fe Compare December 17, 2024 03:36
@zhiying-lin zhiying-lin merged commit 0fc34ff into Azure:main Dec 17, 2024
12 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.

2 participants