Skip to content

Conversation

@zhiying-lin
Copy link
Contributor

Description of your changes

add rollout controller skeleton

I have:

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

How has this code been tested

Will add the integration test to validate Reconcile func in a separate PR.

@zhiying-lin zhiying-lin force-pushed the new-rollout-controller branch from 4b249f3 to 9106e7f Compare June 6, 2023 10:16
ResourceSnapshotName string `json:"resourceSnapshotName"`

// PolicySnapshotName is the name of the policy snapshot that this resource binding & resource snapshot points to.
// It is required to decide whether the binding needs to be deleted or not without talking to API server.
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I remember that ResourceSnapshot has a reference to PolicySnapshot, correct?

Additionally, since we cannot tell whether a PolicySnapshot is the latest from looking at the name, we have to talk to the API server (or actually, cache) any way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, but we only store the resourceSnapshot name here, but not include the policySnapshot name. :(

We will get the latest policySnapshot name by calling API server.
This field is to quickly figure out which policySnapshot the resourceSnapsht of the binding points to.
otherwise, we need to call API server by GET resourceSnapshot.

Copy link
Contributor

@michaelawyu michaelawyu Jun 7, 2023

Choose a reason for hiding this comment

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

Ah, but the client in use will query the cache for the GET ResourceSnapshot call, right? It will never reach API server. Besides, doesn't the rollout controller have to retrieve ResourceSnapshot any way?

Copy link
Contributor

Choose a reason for hiding this comment

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

Does the controller needs to get the ResourceSnapshot? If so, then I am not sure we need this field as the policySnapshotName is in the ResourceSnapshot.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nope, it does not need to query the resourceSnapshot for each binding.

The PolicySnapshotName will be used in two places:

  1. use to check if the current binding is old or not and then delete the old bindings for the ReCreate rollout strategy, in line 144, https://github.com/zhiying-lin/fleet/blob/rollout-controller/pkg/controllers/clusterresourcerollout/clusterresourcerollout_controller.go#L144
  2. use to check if the the current binding is using latest policy, then update the resource of the bindings, in line 160 https://github.com/zhiying-lin/fleet/blob/rollout-controller/pkg/controllers/clusterresourcerollout/clusterresourcerollout_controller.go#L160

Copy link
Contributor

Choose a reason for hiding this comment

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

Please see the message in chat. We don't need this field for saving trips to API server (the trip will not happen because of caches), but we do need it for a different reason.

@zhiying-lin
Copy link
Contributor Author

The rollout controller is no longer needed. Closing this PR

@zhiying-lin zhiying-lin deleted the new-rollout-controller branch June 12, 2023 08:50
weng271190436 pushed a commit that referenced this pull request Jan 6, 2026
Signed-off-by: Zhiying Lin <zhiyingl456@gmail.com>
@britaniar britaniar mentioned this pull request Jan 12, 2026
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