-
Notifications
You must be signed in to change notification settings - Fork 33
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
Add functionality to get instance id from node name by regexp #55
Conversation
Signed-off-by: Marcin Franczyk <[email protected]>
[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 |
yes I saw the issue, but this PR is not about load balancers and network traffic. It's about node initialization stage, once kubelet creates a node object the cloud provider has to find the node's instance (Virtual Machine), so based on the node name there is an attempt to fetch a VM. Currently there is an assumption in the code
that works well with Gardener but not with other kubernetes providers like Kubermatic and probably could break at some point with Hypershift too. For Kubermatic, a node name is equal to virtual machine name so I introduced this regexp field to offer some flexibility in terms of matching a node with virtual machine if other providers has a different VM naming pattern (other than node name = vm name). |
@rmohr speaking about the issue with LB, I think we will have to write another controller that watches endpoints on a tenant cluster and updates labels accordingly on infra cluster to route the traffic correctly. Although this probably should be discussed on some meeting with you, however, I am currently preparing a PoC. |
I think I kind of understand the issue. Could you add examples of the node-name and vm name correlation? If possible for both, gardener and kubermatic. I still wonder if there would be a better way, e.g. based on labels to find correlating objects. |
yes, I will provide examples |
/cc @nirarg Adding Nir, he spent more time on the repo than I did :) |
you're right, seems like there will be a better way than regexp to identify a node. Based on labels it could work. One potential solution could be that k8s providers (once they start kubelet) could pass a label |
After investigating the issue more deeply i discovered that cloud provider kubevirt implements Instances interface (that is for in-tree cloud providers). Because of that we have some methods that are never called like CurrentNodeName (kubelet calls this only for in-tree). I was wrong by proposing a regexp for node parsing. Generally speaking by default kubelet registers nodes with name equal to the OS hostname or takes the value from Considering the above statement, I think we should follow the checks below:
@rmohr @nirarg do you have any concerns about things I wrote above? If not I will close this PR and start implementing |
This PR allows to fetch instance id (VM name) from node name by regexp.
It eliminates the hardcoded assumption https://github.com/kubevirt/cloud-provider-kubevirt/compare/main...mfranczy:instance-regexp?expand=1#diff-f1870dea0d991df0bf3f60c36b21ec968cfbc5a0e77a6e55e17c587dfaf16811L236