-
Notifications
You must be signed in to change notification settings - Fork 220
PUT instead of PATCH used for UpdateControl.patchResourceAndStatus(resource) #1757
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
Comments
Hi @codepitbull , yep that is probably wrong implementation or wrong naming. However just few remarks, and clarifications:
So patching (without optimistic locking) is preferred really when there needs to be a metadata change, and for that use case this should be fixed. If remember correctly the original thinking was that update is more general since it covers (2.) but even if it fails, it will be retried and eventually work. But again I agree that naming is misleading, I guess best way is to fix this behavior for next minor release, and also a and |
In my case I am applying an annotation from inside the reconcile-loop.
The annotation is used because SRE should be able to reenable everything without going into the CR itself but rely on a well known annotation. So, no spec-change involved, just metadata :) |
you mean changing the spec? Just one other aspect I forgot to mention (will update the docs regarding to this). There is another reason while the default behavior is update with optimistic locking. In this case the framework can guarantee that the update will be present in the next reconciliation. If it's without optimistic locking it's not. So it can happen that you won't see the update in the next reconiliation in the metadata. Therefore we made this decision. Since usually even if its in metadata you implement logic based on this - if understand correctly, in this case the scale down logic. |
So if your reconciliation logic depends on those labels, you are probably doing it right now. The method name is still misleading though. |
@codepitbull preparing an update for this. But we can also take a look closer to your use case more in detail, even in a call if you like. |
For now created a PR, that makes the API more clear. |
Bug Report
I wanted to patch both status and resource returning UpdateControl.patchResourceAndStatus(resource) from the reconcile.
My tests became flaky with an occasional the object has been modified; please apply your changes to the latest version and try again..
What did you do?
Use UpdateControl.patchResourceAndStatus(resource) to get both, status and resource patched.
What did you expect to see?
Patch should be sued for status und resource
What did you see instead? Under which circumstances?
This is either a bug or the method-name implies a wrong operation being used.
In ReconciliationDeispatcher.reconcileExecution updateResource is used, which ignores the provided patch-flag.
So only the status gets patched, not the resource.
Environment
All k8s-versions.
Possible Solution
If the intention of the method is to only patch the status and to use put for the resource it should be reflected in the method name.
If not then I guess I found a bug ;)
The text was updated successfully, but these errors were encountered: