Skip to content

Commit

Permalink
fix: the node IP for kubelet shouldn't change if nothing matches
Browse files Browse the repository at this point in the history
This was a fix some time ago, but it was incorrect (missing `continue`),
which was failing the unit-tests.

Also fix a data race in another unit-test (which is unit-test only, not
affecting production).

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
(cherry picked from commit 10ed130)
  • Loading branch information
smira committed Oct 17, 2023
1 parent 8f83925 commit 124c2ff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions internal/app/machined/pkg/controllers/k8s/nodeip.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ func (ctrl *NodeIPController) Run(ctx context.Context, r controller.Runtime, log

if len(ips) == 0 {
logger.Warn("no suitable node IP found, please make sure .machine.kubelet.nodeIP filters and pod/service subnets are set up correctly")

continue
}

// filter down to make sure only one IPv4 and one IPv6 address stays
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,19 @@ func (suite *KmsgLogDeliverySuite) SetupTest() {
suite.srv2, err = logreceiver.NewServer(logger, suite.listener2, suite.handler2.HandleLog)
suite.Require().NoError(err)

suite.wg.Add(1)

go func() {
defer suite.wg.Done()

suite.srv1.Serve() //nolint:errcheck
}()

suite.wg.Add(1)

go func() {
defer suite.wg.Done()

suite.srv2.Serve() //nolint:errcheck
}()

Expand Down

0 comments on commit 124c2ff

Please sign in to comment.