-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
🌱 Set the FieldOwner when updating objects #4428
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @bboreham. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
Is there any side effects in setting the field owners? If we go down this path, and also update the patch helper code, we probably want to make sure we don't break any behaviors. |
/ok-to-test |
Good point - for an existing object, changing the manager from I haven't actually seen this happen in practice, but then most of my testing consists of deleting everything before a run. Oh dear. |
@bboreham https://kubernetes.io/docs/reference/using-api/server-side-apply/#using-server-side-apply-in-a-controller
Maybe that helps. Although I don't recall how to force overwrite in this cases |
You have to explicitly tell the patch call the type of patch it is, so you should see the patch command specify |
We're definitely not using server side apply. Controller runtime has tiny bit of support for it, although it's not super straightforward, so we opted to keep doing what we've been doing so far. |
This lets us put a meaningful name for 'manager' in the 'managedFields' of objects
I have re-done this using a (If this technique gains acceptance, the wrapper should go upstream in controller-runtime) |
So we get a meaningful name for 'manager' in the 'managedFields' of objects
/hold I'm not sure if this is something we want to do for all calls. For example, this would set the field owner also for non owned objects. MachineHealthCheck for example patches Machines if they need remediation, that would set the owner for the conditions field to be MHC controller. The other side effect is that it seems we're forcing ownership regardless if the objects are CAPI or not. |
Each write gets an entry in The "force" semantics to change ownership seem to cover the case where the same field is updated by one controller then another. And I don't get your point about "forcing ownership regardless if the objects are CAPI or not". What's an example of a non-CAPI object where you want a different owner? |
So without knowing much about the apis here, I would argue this is at least not worse than always putting the binary name in there :) And there is no upstream concept for ownership of "shared fields" like a conditions slice, i.e. one has to own all of it or none of it? |
IIRC, each field owner is at the field level, so yes, it's going to own all of it.
Totally agree. @alvaroaleman I wonder if instead of having a shim in Cluster API, should we have something in Controller Runtime instead? |
Yeah, I think that would make a lot of sense |
@bboreham Would you be open in submitting the change to controller runtime? |
Sure; any thoughts where it could go? In |
kubernetes-sigs/controller-runtime#1474 (haven't updated this PR to use it yet) |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-contributor-experience at kubernetes/community. |
@bboreham: PR needs rebase. 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. |
Closing this given that there has been no updates w.r.t. setting field owners in our calls and its possible implications. /close |
@vincepri: Closed this PR. 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. |
What this PR does / why we need it:
This means the controller name will show up as the
manager
in themanagedFields
of each object.This is what I was trying to achieve in #4257, but better since we get separate identities for all the different controllers that live in one binary.
In a couple of places I extracted an existing string out to a constant so I could re-use it.I have not donePatch()
yet as it will involve changingPatchHelper
, so I thought I would get some reaction to this before continuing.I didn't change
clusterctl
as the default is to use the binary name which works well in that case.