-
Notifications
You must be signed in to change notification settings - Fork 647
[occm] Get IP addresses of neutron subports v2 #2270
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
Conversation
Hi @jingczhang. Thanks for your PR. I'm waiting for a kubernetes 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. |
/ok-to-test |
Hi @mdbooth, what is the minimum occm release version for getAttachedPorts() to work? 1.27? |
/retest |
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.
/approve
ping @mdbooth as you assigned this to yourself
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 don't understand why we need to fetch ports again when they should already contain trunk details, which also means we should not require an additional configuration option.
Can you explain why trunk details are not included?
docs/openstack-cloud-controller-manager/using-openstack-cloud-controller-manager.md
Outdated
Show resolved
Hide resolved
/retest |
2 similar comments
/retest |
/retest |
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.
This looks on the right lines to me. I still have major reservations about the maintainability of this version, though, but unlike the previous patches I think they're easily fixable. Nice work!
pkg/openstack/instances.go
Outdated
} | ||
|
||
klog.V(5).Infof("Node %s has %d interfaces '%v'", serverID, len(interfaces), interfaces) | ||
return interfaces, nil |
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.
Looking at how they're used above, I wonder if we should return the return signature of this method to:
func getAttachedPorts(client *gophercloud.ServiceClient, serverID string) (attachedPorts []ports.Port, subPorts []ports.Ports, err error)
And we return direct attached and subports separately. This would mean we wouldn't need the extremely confusing and error prone length conditional above. We could rename addExtraNodeAddresses
to addSubPortNodeAddresses
and call it unconditionally with the returned subports. If they're empty or nil it just wouldn't do anything.
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.
Hmm, since the caller of getAttachedPorts does not care the additional level of details I am not sure changing its signature is needed (right thing to do), I can for sure change addExtraNodeAddresses to addSubPortNodeAddresses, for code clarity.
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.
The critical difference is that we subsequently treat subports differently to directly attached ports because the former are not included in server addresses but the latter are. By returning them as a single un-differentiated slice we're making our lives more complicated later when we have to determine which is which.
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.
An alternative might be to not fetch subports here at all and just return directly attached ports. We could scan for subports later when we unconditionally call addSubPortNodeAddresses
. That would require changing the return signature of this function to return []portWithTrunkDetails
.
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.
The alternative sounds reasonable, will check and update.
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.
The alternative seems a better idea, and it results in the same code structure as in the older releases, PR is updated.
/hold |
/retest This looks great to me, are we waiting for anything else here? |
@jingczhang: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. I understand the commands that are listed here. |
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.
This still isn't there. We need to avoid the second ports query.
pkg/openstack/instances.go
Outdated
@@ -633,6 +635,34 @@ func nodeAddresses(srv *servers.Server, ports []ports.Port, networkingOpts Netwo | |||
return nil, err | |||
} | |||
|
|||
// Add the addresses assigned on subports via trunk | |||
// This exposes the vlan networks to which subports are attached | |||
if client != nil { |
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.
It would be a programming error for this to be nil. The only place I can see that passes nil here are the tests. We should fix that.
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.
yes, this checking is added so unit test would not fail
pkg/openstack/instances.go
Outdated
// Add the addresses assigned on subports via trunk | ||
// This exposes the vlan networks to which subports are attached | ||
if client != nil { | ||
subports, err := getSubports(client, srv.ID) |
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.
Note that we're calling getSubports unconditionally for everybody here, but we're not passing in the list of ports that we already fetched, which already contains the subports.
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.
yes, you are right, will take care of this.
pkg/openstack/instances.go
Outdated
allPages, err := ports.List(client, listOpts).AllPages() | ||
if err != nil { | ||
return subports, err | ||
} |
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.
We can't do this: it's adding the second port list for everybody. We've already done this query. We need to re-use the existing ports query.
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.
ok, same as above, rebase results in a new PR, will take care of the comments in the new PR:
#2306
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. |
Sorry for the late response, I was on vacation, I will take care of the release and new comment soon. |
6b23f13
to
8a0e73f
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: zetaab 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 |
Vlan-aware VMs are commonly used in telecom.
Those VMs are plugged into flat networks and use neutron trunk:
https://docs.openstack.org/neutron/latest/admin/config-trunking.html
Currenlty, getAttachedPorts() only returns neutron ports directly attached to VM. For vlan-aware VMs, IP addresses are assigned on neutron subports. Subports are attached to the trunk; they are not attached to the VM directly. This pull request changes getAttachedPorts() to return IP addresses of neutron subports when they exist. Without this change, Kubernetes is unable to IP addresses of vlan-aware VMs. This change is transparent to VMs not using neutron trunk.
Special notes for reviewers:
This is a rebase of the following PR:
#2228
Release note: