Skip to content
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

rollouts: check entire spec when patching remotesync #3871

Merged
merged 2 commits into from
Mar 10, 2023

Conversation

natasha41575
Copy link
Contributor

@natasha41575 natasha41575 commented Mar 10, 2023

Fixes #3846

IMO the most robust way to check if the RemoteSync object needs to be updated is to create a new RemoteSync struct based on the current rollout spec and compare it to the existing RemoteSync object in the cluster. This will be able to withstand changes in the Rollouts/RemoteSync APIs.

@natasha41575 natasha41575 marked this pull request as ready for review March 10, 2023 03:15
@natasha41575 natasha41575 requested a review from a team as a code owner March 10, 2023 03:15
@natasha41575 natasha41575 requested a review from droot March 10, 2023 03:15
// if the spec of the new RemoteSync object is not identical to the existing one, then an update is necessary
if !equality.Semantic.DeepEqual(oldRS.Spec, newRS.Spec) {
oldRS.Spec = newRS.Spec
return oldRS, true
Copy link
Contributor

@droot droot Mar 10, 2023

Choose a reason for hiding this comment

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

Yes, this seems to be more robust. Infact, it is almost equivalent to (without the roundtrip to server):

newRS := newRemoteSync(...)
// apply newRS using server-side apply where apply is only applicable if there are differences.
client.Apply(newRS)

rollouts/controllers/rollout_controller.go Outdated Show resolved Hide resolved
rollouts/controllers/rollout_controller.go Outdated Show resolved Hide resolved
@natasha41575 natasha41575 changed the title rollouts: check entire spec when patching rootsync rollouts: check entire spec when patching remotesync Mar 10, 2023
@natasha41575 natasha41575 merged commit aa549fe into kptdev:main Mar 10, 2023
@natasha41575 natasha41575 deleted the rollouts/remotesyncupdate branch March 10, 2023 19:34
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.

rollouts: update comparison should check more than just git revision
2 participants