Skip to content

Conversation

@giulianopz
Copy link
Contributor

Fix as suggested by @mac-chaffee in issue #1639.

@fedepaol
Copy link
Member

Hi @giulianopz , thanks for the PR!

I have a couple of asks:

@giulianopz
Copy link
Contributor Author

Hi @fedepaol,
I added a unit test just as the one in config_controller_test.go, but the test fails when I run invoke test:

W1104 00:20:23.634880   69068 warnings.go:70] metallb.io v1beta1 AddressPool is deprecated, consider using IPAddressPool
W1104 00:20:23.635792   69068 warnings.go:70] metallb.io v1beta1 AddressPool is deprecated, consider using IPAddressPool
--- FAIL: TestNodeReconciler_SetupWithManager (6.90s)
    node_controller_test.go:138: 
        Expected
            <*fmt.wrapError | 0xc0002937a0>: {
                msg: "error listening on :8080: listen tcp :8080: bind: address already in use",
                err: <*net.OpError | 0xc000533ae0>{
                    Op: "listen",
                    Net: "tcp",
                    Source: nil,
                    Addr: <*net.TCPAddr | 0xc000c3e630>{IP: nil, Port: 8080, Zone: ""},
                    Err: <*os.SyscallError | 0xc000293780>{
                        Syscall: "bind",
                        Err: <syscall.Errno>0x62,
                    },
                },
            }
        to be nil
FAIL
FAIL    go.universe.tf/metallb/internal/k8s/controllers 19.415s

It seems a conflict between the two unit tests, but I cannot understand where in the code the port 8080 is selected.
Can you help me? Did I miss some configuration to run the unit tests locally?

@fedepaol
Copy link
Member

Hi, sorry about the delay. I found the problem, which is about the controller metrics listener (don't know why, since every test stops the testEnv.

In any case, the fix is to not listen for the metrics (in both the old and the new test, I guess):

m, err := manager.New(cfg, manager.Options{MetricsBindAddress: "0"})

@giulianopz giulianopz requested review from fedepaol and removed request for gclawes, johananl, oribon, rata and russellb November 12, 2022 23:43
This change applies a filter to the node reconciler
(similarly as the one used for the config reconciler)
to skip processing unnecessary node events
other than node updates involving a change in its labels,
since these labels are checked by the bgp controller.

It will help reducing noise in the logs and
avoid frequent reloads causing CPU usage spikes
which seem to occasionally trigger failing probes and
pod restarts.

Signed-off-by: giuliano <panzironi.giuliano@gmail.com>
Signed-off-by: giuliano <panzironi.giuliano@gmail.com>
@giulianopz giulianopz requested a review from fedepaol November 16, 2022 11:32
return node.Name == r.NodeName
})

return newNodeObj.Name == newNodeObj.Name
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will always be true? Can you use the function you added here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, totally missed it. Ok, I will reuse the new function.

Complete(r)
}

func (r *NodeReconciler) filter(obj client.Object) bool {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit (just becauwe you need to change the code anyway), let's call this "filterOtherNodes"

@giulianopz giulianopz requested a review from fedepaol November 22, 2022 22:20
@fedepaol
Copy link
Member

LGTM, thanks! Let's wait for CI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants