-
Notifications
You must be signed in to change notification settings - Fork 2
ROX-31829: Implement aggressive conflict resolution #64
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
base: main
Are you sure you want to change the base?
Conversation
270ea6f to
542ad8a
Compare
porridge
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks OK in general, some comments inline.
Also, the custom predicates bit should probably be a separate PR for ease of upstreaming later?
|
The |
updater tests and use Ginkgo assertions instead of production error handling.
542ad8a to
cc60c7d
Compare
|
@porridge Hope I have addressed everything. Thank you! |
porridge
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some questions and comments inline.
pkg/reconciler/reconciler.go
Outdated
| // This is a safety measure to ensure that the chart is fully uninstalled before the CR is deleted. | ||
| if obj.GetDeletionTimestamp() == nil && !controllerutil.ContainsFinalizer(obj, uninstallFinalizer) { | ||
| log.V(1).Info("Adding uninstall finalizer.") | ||
| patch := client.MergeFrom(obj.DeepCopy()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the doc for MergeFrom, it seems like we want to use strategic merge patch for the list that finalizers is, no? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Agreed, there was a race, thanks for noticing.
- StrategicMergePatch() unfortunately doesn't fix it. I think this has to do with the fact that the
finalizerslist has no merge strategy associated. It would still just replace -- I tested this with a test using an interceptor to modify an object during aGet()call while still returning the old one. - I think a JSON merge patch might do the trick here, but thinking about this again, I think we can refrain from complicating this piece of code for two reasons:
3a. The reconciler code as it is now is not expecting any other finalizers to be in the picture, it's deliberately replacing them withSetFinalizers()anyway.
3b. Even if there was a conflict here, I think this is one of the few situations where we could keep failing with a conflict error, because it happens right at the beginning of the reconciliation, before any heave Helm work is being done. And also because this is not something that should happen frequently -- it is, as far as I can tell, not expected that users fiddle around with the finalizers of a helm-operator-managed CR.
In any case, modifying this behavior seems to be independent of this specific feature.
Hence, I have reverted this change so that we have the old behavior.
Implements a conflict resolution strategy for use in rhacs-operator.
Can be reviewed commit by commit.