-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
CreateOrUpdate falsely claiming its updating resources #847
Comments
I think that makes sense, off the top of my head. I'm assuming the previous semantics were "did I submit an update", not "did an update actually occur" though. Anyone else have thoughts? cc @alexeldeib who touched that code last. /kind feature |
The reason I prefer it not to be just "did I submit an update" is that I use the result to determine if the Owned resource I am updating has been modified. If so, end the reconciliation early and let the update of the Owned object trigger a rereconcile and progress further into the reconcile logic. If this is not intended behavior thats understandable |
Seems reasonable. Currently if an object was found remotely (i.e., it's an update) but there is no difference, we no-op locally and return controller-runtime/pkg/controller/controllerutil/controllerutil.go Lines 216 to 218 in edf7177
I think this change makes our behavior consistent so that OperationResultNone + no error means "the object you submitted and the object in the API server were the same". Right now we have an edge case where we tell the user that the blackbox create or update succeeded, but they have to go diff the objects themselves to figure out what happened. I personally think the important semantic is that something changed -- depending on using CreateOrUpdate to submit no-ops to the API server seems like something I'd discourage anyway. |
@mcristina422 can you clarify your use case slightly? You have a controller on e.g. the parent objects and when the parent tries to CreateOrUpdate a child object, you want to use the OperationResultUpdated to let the child re-trigger the parent to reconcile? Without depending on OperationResult here, you should be able to do this by having the parent CreateOrUpdate the child, and then check for a status field on the child object. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Rotten issues close after 30d of inactivity. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
@fejta-bot: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
While using
CreateOrUpdate
with resources that get defaulted it can returnOperationResultUpdated
despite there being no updates. I'm not concerned that the call toUpdate
is happening, the same values get defaulted. But I think returningOperationResultUpdated
is wrong since nothing was actually updated. I think thatOperationResultUpdated
should only be returned when theResourceVersion
is not equal to the original.https://github.com/kubernetes-sigs/controller-runtime/compare/master...mcristina422:cmpResourseVersion?expand=1#diff-4c146d38c03cf55e321de9ad53af4452R220-R238
I originally came across this issue setting ports on
Service
similar to #464 (comment)I recreated the issue in a
Deployment
with my proposed fix in https://github.com/kubernetes-sigs/controller-runtime/compare/master...mcristina422:cmpResourseVersion?expand=1@DirectXMan12 do you think my proposal makes sense
The text was updated successfully, but these errors were encountered: