Skip to content
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

HBO: Make GetPortAddresses return portMAC even if portIP is nil #2395

Merged
merged 1 commit into from Aug 3, 2021

Conversation

tssurya
Copy link
Member

@tssurya tssurya commented Aug 3, 2021

- What this PR does and why is it needed

In GetPortAddresses, we check if we have both PortMAC and IP for
the port. If not we return nil for both values. While this works
for normal ports, for the HBO ports which don't have IPs for
the int-<node> interface, we will always hit this condition and
return an empty PortMAC which in turn triggers the lsp-add even
if the portMAC already exists.

When we have an external entity updating the node object, the
watcher triggers handleOverlayPort and we keep hitting this
condition.

Let's remove the len(addresses)<2 check since its not needed
for HBO and in normal pod port case, pods.getPortAddresses already
handles the case for empty podMac or podIPs. This way when portMAC
is set but not the IPs, we will still return the portMAC and the
respective code paths handle it as needed.

Signed-off-by: Surya Seetharaman suryaseetharaman.9@gmail.com

- How to verify it
Spin up a KIND cluster. Before the PR we could see lots of:

I0803 09:04:26.498592      51 master.go:231] Creating / updating node ovn-control-plane hybrid overlay port with mac 0a:58:0a:f4:01:03
I0803 09:04:36.540287      51 master.go:231] Creating / updating node ovn-worker2 hybrid overlay port with mac 0a:58:0a:f4:00:03
I0803 09:04:36.540746      51 master.go:231] Creating / updating node ovn-worker hybrid overlay port with mac 0a:58:0a:f4:02:03
I0803 09:09:28.379210      51 master.go:231] Creating / updating node ovn-control-plane hybrid overlay port with mac 0a:58:0a:f4:01:03
I0803 09:09:38.413117      51 master.go:231] Creating / updating node ovn-worker2 hybrid overlay port with mac 0a:58:0a:f4:00:03
I0803 09:09:38.415934      51 master.go:231] Creating / updating node ovn-worker hybrid overlay port with mac 0a:58:0a:f4:02:03
I0803 09:14:30.025162      51 master.go:231] Creating / updating node ovn-control-plane hybrid overlay port with mac 0a:58:0a:f4:01:03
I0803 09:14:40.066693      51 master.go:231] Creating / updating node ovn-worker hybrid overlay port with mac 0a:58:0a:f4:02:03
I0803 09:14:40.068880      51 master.go:231] Creating / updating node ovn-worker2 hybrid overlay port with mac 0a:58:0a:f4:00:03
I0803 09:19:31.382330      51 master.go:231] Creating / updating node ovn-control-plane hybrid overlay port with mac 0a:58:0a:f4:01:03
I0803 09:19:41.438269      51 master.go:231] Creating / updating node ovn-worker hybrid overlay port with mac 0a:58:0a:f4:02:03
I0803 09:19:41.441319      51 master.go:231] Creating / updating node ovn-worker2 hybrid overlay port with mac 0a:58:0a:f4:00:03
I0803 09:24:32.765837      51 master.go:231] Creating / updating node ovn-control-plane hybrid overlay port with mac 0a:58:0a:f4:01:03
I0803 09:24:42.806418      51 master.go:231] Creating / updating node ovn-worker2 hybrid overlay port with mac 0a:58:0a:f4:00:03
I0803 09:24:42.810539      51 master.go:231] Creating / updating node ovn-worker hybrid overlay port with mac 0a:58:0a:f4:02:03
I0803 09:29:34.326222      51 master.go:231] Creating / updating node ovn-control-plane hybrid overlay port with mac 0a:58:0a:f4:01:03
I0803 09:29:44.396047      51 master.go:231] Creating / updating node ovn-worker hybrid overlay port with mac 0a:58:0a:f4:02:03
I0803 09:29:44.397670      51 master.go:231] Creating / updating node ovn-worker2 hybrid overlay port with mac 0a:58:0a:f4:00:03
I0803 09:34:35.842705      51 master.go:231] Creating / updating node ovn-control-plane hybrid overlay port with mac 0a:58:0a:f4:01:03
I0803 09:34:45.878037      51 master.go:231] Creating / updating node ovn-worker2 hybrid overlay port with mac 0a:58:0a:f4:00:03
I0803 09:34:45.881372      51 master.go:231] Creating / updating node ovn-worker hybrid overlay port with mac 0a:58:0a:f4:02:03
I0803 09:39:36.971651      51 master.go:231] Creating / updating node ovn-control-plane hybrid overlay port with mac 0a:58:0a:f4:01:03
I0803 09:39:47.023406      51 master.go:231] Creating / updating node ovn-worker2 hybrid overlay port with mac 0a:58:0a:f4:00:03
I0803 09:39:47.023452      51 master.go:231] Creating / updating node ovn-worker hybrid overlay port with mac 0a:58:0a:f4:02:03

With the PR, we handle this better for node updates since now GetPortAddresses will return the portMAC even if portIPs are nil.

I0803 09:52:38.487000      50 master.go:259] Processing add event for node ovn-control-plane
I0803 09:52:38.487011      50 master.go:259] Processing add event for node ovn-worker
I0803 09:52:38.487015      50 master.go:259] Processing add event for node ovn-worker2
I0803 09:52:38.487043      50 master.go:199] Allocating MAC 0a:58:0a:f4:01:03 to node ovn-control-plane
I0803 09:52:38.487047      50 master.go:199] Allocating MAC 0a:58:0a:f4:00:03 to node ovn-worker
I0803 09:52:38.487054      50 master.go:224] Creating / updating node ovn-control-plane hybrid overlay port with mac 0a:58:0a:f4:01:03
I0803 09:52:38.487060      50 master.go:224] Creating / updating node ovn-worker hybrid overlay port with mac 0a:58:0a:f4:00:03
I0803 09:52:38.487092      50 master.go:199] Allocating MAC 0a:58:0a:f4:02:03 to node ovn-worker2
I0803 09:52:38.487108      50 master.go:224] Creating / updating node ovn-worker2 hybrid overlay port with mac 0a:58:0a:f4:02:03

In GetPortAddresses, we check if we have both PortMAC and IP for
the port. If not we return nil for both values. While this works
for normal ports, for the HBO ports which don't have IPs for
the int-<node> interface, we will always hit this condition and
return an empty PortMAC which in turn triggers the lsp-add even
if the portMAC already exists.

When we have an external entity updating the node object, the
watcher triggers handleOverlayPort and we keep hitting this
condition.

Let's remove the "len(addresses)<2" check since its not needed
for HBO and in normal pod port case, pods.getPortAddresses already
handles the case for empty podMac or podIPs. This way when portMAC
is set but not the IPs, we will still return the portMAC and the
respective code paths handle it as needed.

Signed-off-by: Surya Seetharaman <suryaseetharaman.9@gmail.com>
@tssurya
Copy link
Member Author

tssurya commented Aug 3, 2021

/assign @dcbw

@tssurya tssurya changed the title HBO: Make GetPortAddresses to return portMAC even if portIP is nil HBO: Make GetPortAddresses return portMAC even if portIP is nil Aug 3, 2021
@fedepaol
Copy link
Collaborator

fedepaol commented Aug 3, 2021

/lgtm

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 52.651% when pulling 1a6f9c9 on tssurya:fix-get-pod-addresses-hbo into a96572f on ovn-org:master.

@dcbw dcbw merged commit e3bb7ca into ovn-org:master Aug 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants