-
Notifications
You must be signed in to change notification settings - Fork 364
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
Move GetNodeAddr function to k8s util package #2191
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2191 +/- ##
==========================================
- Coverage 61.30% 61.19% -0.11%
==========================================
Files 273 274 +1
Lines 20646 20646
==========================================
- Hits 12656 12635 -21
- Misses 6688 6699 +11
- Partials 1302 1312 +10
Flags with carried forward coverage won't be shown. Click here to find out more.
|
/test-all |
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 wonder if k8s
should be kept as a top-level package, or should be moved to pkg/util/k8s
LGTM
pkg/k8s/node.go
Outdated
// Note: Although K8s supports dual-stack, there is only a single Internal address per Node because of issue ( | ||
// kubernetes/kubernetes#91940 ). The Node might have multiple addresses after the issue is fixed, and one per address |
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 notice that this issue (kubernetes/kubernetes#91940) has been fixed upstream, so maybe we should open an issue to address this and update GetNodeAddr
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.
While I was about to open an issue, I found I was not sure what change we need to make here. I see current usages of this function expects a Node IP so they can use it to create tunnel, identify network interface, or connect to the server. So it seems fine if there are two internal addresses or two external addresses, except the returned address family is not determinate. What’s the required change on your mind?
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 may be wrong, but don't we need to get both an IPv4 address and an IPv6 address for the Node if we want to support dual-stack in noEncap mode? So this function should be able to return both addresses?
Right now we use the one Node IP to install both routes in noEncap mode, but that seems wrong to me. I don't think we have tested noEncap for dual-stack clusters and my expectation is that it may not work:
antrea/pkg/agent/controller/noderoute/node_route_controller.go
Lines 485 to 490 in fa54190
for peerPodCIDR, peerGatewayIP := range peerConfig { | |
if err := c.routeClient.AddRoutes(peerPodCIDR, nodeName, peerNodeIP, peerGatewayIP); err != nil { | |
return err | |
} | |
peerGatewayIPs = append(peerGatewayIPs, peerGatewayIP) | |
} |
Adding @lzhecheng as this may be related to #136 (comment)
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 see, you mean we need to setup one IPv4 route and one IPv6 route for dual-stack clusters. Since #136 is still open, maybe we could just use that issue to track.
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.
That works for me. Thanks for updating the issue (I mean leaving a comment there).
@antoninbas thanks for the review.
Moving to |
The function is consumed by antctl and several places in antrea-agent. Importing it from "pkg/agent/controller/noderoute" is weird and complicate the module dependency. This patch moves it to k8s util package which contains K8s specific helper functions. With it, antctl binary size is reduced about 8KB. Besides, it moves pkg/k8s to pkg/util/k8s. Signed-off-by: Quan Tian <[email protected]>
/test-all |
/test-conformance |
/test-e2e |
The function is consumed by antctl and several places in antrea-agent. Importing it from "pkg/agent/controller/noderoute" is weird and complicate the module dependency. This patch moves it to k8s util package which contains K8s specific helper functions. With it, antctl binary size is reduced about 8KB.
Besides, it moves pkg/k8s to pkg/util/k8s.
Signed-off-by: Quan Tian [email protected]