-
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
Extend MachineStatus to add ProviderID #565
Extend MachineStatus to add ProviderID #565
Conversation
@vikaschoudhary16: GitHub didn't allow me to request PR reviews from the following users: hardikdr, enxebre. Note that only kubernetes-sigs members and repo collaborators can review this PR, and authors cannot review their own PRs. 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. |
|
||
// ProviderID is the identification ID of the machine provided by the provider | ||
// +optional | ||
ProviderID *string `json:"providerID,omitempty"` |
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.
Please update this comment to make it clear that this field must match the provider ID as seen on the node object corresponding to this machine.
My 2C to this:
|
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.
I agree with @alvaroaleman .
I support adding ProviderID
field in the MachineStatus but only for the reason mentioned above.
I can recall autoscaler-integration requires it, probably for mapping the node object with machine-object, and in turn machine-deployment object. But this should rather settle at the KEP opened for the same.
As, I mentioned during today's sig meeting as well, keeping the |
7614808
to
64d4639
Compare
@sidharthsurana
|
@vikaschoudhary16 - Is it always observed? Or does that depend on the provider? I think the question comes down to whether we think that it should be possible to use the provider id to match a machine with an existing infrastructure resource via this field (which is how @sidharthsurana is using it) by saying that through some means, the caller knows a priori what it should be set to. The precedent here is the service IP (for k8s services) where you can ask for a specific one by setting the value in the spec, but if you leave it blank the service controller chooses one and fills it in for you. It may not be the best precedent to follow, but it seems to work pretty well in that case. |
@roberthbailey thanks!! sounds logical to me. |
9ffb881
to
4b38736
Compare
Is there any blocker yet for merging this PR? |
@hardikdr none to my knowledge, thanks!!! |
@vikaschoudhary16 @hardikdr The point i was trying to make is as follows: Say a user is using the I hope the above explanation helps. |
@sidharthsurana But wouldn't then the better solution be to copy over the |
I would second with the idea of also migrating the Status while pivoting.
@alvaroaleman @sidharthsurana thoughts ? We could conclude on Spec for now and move to Status incase we see a need? or vice versa ? @vikaschoudhary16 seems to have already migrated the |
Yes, but if you are using kubectl to create the object, the |
Here is my take, if the |
In general I am okay with adding this field, my only concern is about where we add it. Since I am not a 100% sure of the underlying use cases thus the questions. |
Yes, I think so.
Okay but if that is the only reason to move that field to
Hm. I would view it more as: If this is immutable and will never be changed once populated, it belongs into |
Make sense, I see this a consequence of an arbitrary process (pivoting) followed in some cases for coming up with a cluster, so I think the tooling driving it should be responsible for ensuring its expectations. But I think we should not choose object spec/object status based on it.
The difference I can see with the node object being in the spec is that a machine could be backing a different node during time. E.g if the external state is changed i.e an instance is manually deleted, eventually the machine controller should try to reconcile desired state and create a new instance based on the existing machine object. |
Now i think it makes more sense to add it in
I am feeling to revert it back to initial change i.e ProviderID in @sidharthsurana @alvaroaleman @enxebre @hardikdr @roberthbailey thoughts? |
I agree that the tooling should handle the case of making the status and spec in sync. However, keep in mind, even if the tooling tries to handle that, it would not be an atomic operation rather it would be a 2 step operation. That means, that the controller/actuator running on the target cluster will get notified of the changes to the object twice and the actuator then needs to handle this case gracefully.
Although I get the motivation of making the spec immutable, but IMHO that is kind of subjective. I like that idea of spec being immutable too, but in general there may be cases which may demand that the spec might be treated as mutable as well. For instance, right now if you want to upgrade the kubelet version, what do one do? well we update the spec to the new kubelet version and the actuator needs to handle that situation. Another case could be of vertical scaling. What if I just want to increase say the cpu/memory of a worker. One way is create a brand new machine with the new size and delete the old one. However, a better approach might be that if the underlying provider supports hot-add of CPU/Memory then simply reconfigure the instance. Thus for this later to happen, one might have to update the spec to reflect the new intent. Regarding the specific scenario @alvaroaleman you are referring to, in general is the simple scenario of given a machine object how does the actuator figure out that the underlying actual instance exist. In general there are 3 options to resolve this.
Here our case is scenario 1, so where do we put that metadata inside the Machine object, does it matter? For the case where someone accidentally deletes the backend instance, then the next reconciliation loop when the actuator tries to look up the backend instance by that ID it would not be able to find that, and that is a clear indication that it needs to re-create it + once it has created update the ID back in the same location (regardless of where it is Spec/Status) with 100% confidence. |
We discussed this quite a bit during the meeting today. Some takeaways:
|
This is the route I chose for the autoscaler / cluster-api implementation I have been working on here: openshift/kubernetes-autoscaler#14 |
We can almost do most of the things with annotations instead using concrete apis. In my opinion, annotations should be used for experimentation where we are not sure if this api will ever be needed or not. Here i think most of us are agree that this information is required, therefore making it api makes more sense to me. APIs provides greater confidence to build something upon as compared to annotations. Different implementations, different annotation name, more confusion. |
Ping. |
I think |
As alluded to by @dlipovetsky above, we discussed this during the meeting today. We agreed that we wanted the field and that it should go into the spec. We also agreed that when making this sort of change we need to be updating our documentation (both inline and in the gitbook). @hardikdr volunteered to pick this change up if you aren't able to make those changes are part of getting it merged. |
Hey guys thanks a lot for discussing this. I could not attend cluster-api meeting because of TZ problem. I am ready to take up whatever it takes to get this merged. |
Thanks! |
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.
Minor comment
|
||
// ProviderID is the identification ID of the machine provided by the provider. | ||
// This field must match the provider ID as seen on the node object corresponding to this machine. | ||
// +optional |
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.
Could we add some use cases and a more detailed description for this field? We should also make sure to communicate to users when the field should be set and when it could be consumed.
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.
done!
4b38736
to
f85676d
Compare
/retest |
@vikaschoudhary16 Can you rebase on master? /approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: vikaschoudhary16, vincepri The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
f85676d
to
b06a950
Compare
@vincepri rebased! |
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.
Minor nit on removal of a newline, otherwise lgtm
@@ -153,7 +166,6 @@ type MachineStatus struct { | |||
// serialized/deserialized from this field. | |||
// +optional | |||
ProviderStatus *runtime.RawExtension `json:"providerStatus,omitempty"` | |||
|
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.
Since ProviderStatus and Addresses are not directly related it would be nice to keep this newline here to more easily differentiate.
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.
Done, thanks!
b06a950
to
b9ba5d0
Compare
b9ba5d0
to
dd2d3e5
Compare
/lgtm |
A new field,
ProviderID
, is being proposed to add in machine objectSpec
. This field is required by higher level consumers of cluster-api such as autoscaler for the machines v/s nodes reconciliation logic. With cluster-api as a generic out-of-tree provider for autoscaler, this field is required by autoscaler to be able to have a provider view of list of machines.This field will be set by actuators and consumed by higher level entities who will be interfacing with cluster-api as generic provider.
/cc @roberthbailey @hardikdr @enxebre @derekwaynecarr