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

Support configurable interfaces for Pod traffic across Node #2370

Merged
merged 1 commit into from
Jul 29, 2021

Conversation

wenyingd
Copy link
Contributor

@wenyingd wenyingd commented Jul 9, 2021

  1. SNAT is performed by Windows host for Pod-to-external traffic, not by OVS
  2. Antrea Agent uses the configurable interface for Pod traffic. The interface
    which is configured with Node IP is chosen, if user doesn't configure the
    in-band traffic interface.

Signed-off-by: wenyingd wenyingd@vmware.com

Fixes #2344

@codecov-commenter
Copy link

codecov-commenter commented Jul 9, 2021

Codecov Report

Merging #2370 (7db77e1) into main (b8bc15c) will increase coverage by 5.02%.
The diff coverage is 46.98%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2370      +/-   ##
==========================================
+ Coverage   59.86%   64.88%   +5.02%     
==========================================
  Files         284      284              
  Lines       22178    25457    +3279     
==========================================
+ Hits        13277    16518    +3241     
+ Misses       7480     7384      -96     
- Partials     1421     1555     +134     
Flag Coverage Δ
e2e-tests 55.91% <28.91%> (?)
kind-e2e-tests 46.97% <42.85%> (-0.11%) ⬇️
unit-tests 42.01% <39.18%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/agent/agent_linux.go 80.00% <0.00%> (-20.00%) ⬇️
pkg/agent/openflow/pipeline_other.go 75.00% <ø> (+15.00%) ⬆️
pkg/agent/util/net.go 52.94% <0.00%> (+1.65%) ⬆️
...gent/controller/noderoute/node_route_controller.go 62.16% <27.77%> (+15.08%) ⬆️
pkg/agent/agent.go 58.55% <62.50%> (+8.21%) ⬆️
pkg/agent/route/route_linux.go 50.11% <66.66%> (+5.43%) ⬆️
pkg/agent/config/node_config.go 100.00% <100.00%> (ø)
pkg/agent/openflow/client.go 69.82% <100.00%> (+11.94%) ⬆️
pkg/agent/openflow/pipeline.go 82.22% <100.00%> (+9.25%) ⬆️
pkg/controller/egress/ipallocator/allocator.go 67.82% <0.00%> (-15.16%) ⬇️
... and 277 more

@wenyingd wenyingd force-pushed the issue_2337 branch 3 times, most recently from fc73f8f to a652c83 Compare July 12, 2021 05:02
@wenyingd
Copy link
Contributor Author

/test-windows-all
/test-ipv6-all
/test-ipv6-only-all

@wenyingd
Copy link
Contributor Author

/test-windows-conformance
/test-windows-networkpolicy
/test-windows-e2e

@wenyingd wenyingd force-pushed the issue_2337 branch 4 times, most recently from 92298e6 to c2ea073 Compare July 15, 2021 09:46
@wenyingd wenyingd changed the title [WIP] [Windows] Support configurable interfaces for Pod traffic across Node [Windows] Support configurable interfaces for Pod traffic across Node Jul 15, 2021
Copy link
Contributor

@jianjuns jianjuns left a comment

Choose a reason for hiding this comment

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

In the commit message: "SNAT is performing by" -> "SNAT is performed by".

build/yamls/base/conf/antrea-agent.conf Outdated Show resolved Hide resolved
build/yamls/base/conf/antrea-agent.conf Outdated Show resolved Hide resolved
build/yamls/base/conf/antrea-agent.conf Outdated Show resolved Hide resolved
pkg/agent/controller/noderoute/node_route_controller.go Outdated Show resolved Hide resolved
pkg/agent/agent_windows.go Show resolved Hide resolved
pkg/agent/agent.go Outdated Show resolved Hide resolved
@wenyingd wenyingd force-pushed the issue_2337 branch 6 times, most recently from 44745b2 to d27871e Compare July 19, 2021 05:43
docs/design/windows-design.md Outdated Show resolved Hide resolved
docs/design/windows-design.md Outdated Show resolved Hide resolved
docs/design/windows-design.md Show resolved Hide resolved
docs/design/windows-design.md Outdated Show resolved Hide resolved
pkg/agent/agent.go Outdated Show resolved Hide resolved
pkg/agent/openflow/pipeline_windows.go Show resolved Hide resolved
pkg/agent/util/net.go Outdated Show resolved Hide resolved

// GetVirtualInterfaceByName is not implemented. An error returned when this function is called, which means the required
// interface is not found.
func GetVirtualInterfaceByName(ifaceName, ovsBridgeName string) (*net.Interface, error) {
Copy link
Member

Choose a reason for hiding this comment

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

I understand this cause compiliation issue on MAC but this is not the only missing function, can we rename net_linux to net_other instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In my mind, some dependent libraries in current net_linux (possibly is netlink) is not supported by MAC, that's why we used to rename it from net_other to net_linux.

pkg/agent/util/net_windows.go Outdated Show resolved Hide resolved
func CreateNetNatOnHost(subnetCIDR *net.IPNet) error {
netNatName := "antrea-nat"
cmd := fmt.Sprintf(`Remove-NetNat -Name %s -Confirm:$false`, netNatName)
if _, err := ps.RunCommand(cmd); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

Can we do "create if not found" instead of "remove and create" to be less disruptive?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, I assumed the PodCIDR is possibly changed on the Windows host, that's why I use "remove and create". But if this assumption doesn't exist, I would change.

Copy link
Member

Choose a reason for hiding this comment

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

To be safe, it can compare whether the value is expected first, then decide whether to remove and create.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Get-NetNat doesn't support using "InternalIPInterfaceAddressPrefix" as filter. I would try to compare with the result fields

@jayunit100
Copy link
Contributor

jayunit100 commented Jul 20, 2021

hi @wenyingd how are you compiling the executable here? when I ran this antrea-agent.exe, I got a "not a valid windows executable" error message.

To test:

  1. I tried to run make windows-bin for me worked, but I couldn't run the antrea-agent.exe.

  2. ... It was 73.1 MB in size, I assume that is correct ?

  3. ... The url to it is here : https://storage.googleapis.com/jayunit100/antrea-agent-if-ps-fixes-2.exe ... is there anything wrong with it ?

@wenyingd
Copy link
Contributor Author

wenyingd commented Jul 21, 2021

hi @wenyingd how are you compiling the executable here? when I ran this antrea-agent.exe, I got a "not a valid windows executable" error message.

To test:

  1. I tried to run make windows-bin for me worked, but I couldn't run the antrea-agent.exe.
  2. ... It was 73.1 MB in size, I assume that is correct ?
  3. ... The url to it is here : https://storage.googleapis.com/jayunit100/antrea-agent-if-ps-fixes-2.exe ... is there anything wrong with it ?

I usually compile the binary on Windows host. I have installed cygwin on Windows host, and run make windows-bin in cygwin shell.

@wenyingd wenyingd force-pushed the issue_2337 branch 4 times, most recently from e995e7f to 40fb21f Compare July 21, 2021 09:32
@lzhecheng
Copy link
Contributor

/test-windows-networkpolicy

2 similar comments
@wenyingd
Copy link
Contributor Author

/test-windows-networkpolicy

@wenyingd
Copy link
Contributor Author

/test-windows-networkpolicy

@jianjuns
Copy link
Contributor

@tnqn @jianjuns Any other comments on this PR?

I do not have extra comments.

pkg/agent/agent.go Outdated Show resolved Hide resolved
pkg/agent/agent_test.go Show resolved Hide resolved
@tnqn
Copy link
Member

tnqn commented Jul 27, 2021

I assume this works for Linux too. Could you remove [Windows] from the title and mentions the configuration works for both platforms in commit message? #2473 is asking similar feature on Linux but I found the PR's title is misleading when I pointed it to that issue.

@wenyingd wenyingd changed the title [Windows] Support configurable interfaces for Pod traffic across Node Support configurable interfaces for Pod traffic across Node Jul 27, 2021
@wenyingd
Copy link
Contributor Author

/test-all

# The name of the interface on Node which is used for tunneling or routing the traffic across Nodes.
# If there are multiple IP addresses configured on the interface, the first one is used.
# The interface configured with Node IP is used if this parameter is not set.
#transportInterface:
Copy link
Member

Choose a reason for hiding this comment

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

Sometimes there have different interface name on each node, which will be used to inter-host communication.
Maybe need to use special cidr range for inter-host communication, such as antrea-agent --iface-cidr 172.16.100.0/24, could we add a param transportCIDRRange for this scenarios? @wenyingd @tnqn

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you mean on each Node, we look up the interface by IP which should fall into the transportCIDRRange?

But it is also possible Nodes' interfaces are in different CIDRs. I feel not easy to cover all cases, but do you already have a use case that Nodes use different interfaces?

@wenyingd
Copy link
Contributor Author

/test-integration
/test-all

@wenyingd
Copy link
Contributor Author

/test-integration
/test-conformance
/test-networkpolicy
/test-e2e
/test-ipv6-all
/test-ipv6-only-all

@lzhecheng
Copy link
Contributor

/test-integration

Copy link
Member

@tnqn tnqn left a comment

Choose a reason for hiding this comment

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

LGTM. two minor comments left

pkg/agent/agent.go Outdated Show resolved Hide resolved
pkg/agent/agent_test.go Outdated Show resolved Hide resolved
1. SNAT is performed by Windows host for Pod-to-external traffic, not by OVS
2. Antrea Agent uses the configurable interface for Pod traffic. The interface
   which is configured with Node IP is chosen, if user doesn't configure the
   in-band traffic interface.

Signed-off-by: wenyingd <wenyingd@vmware.com>
Co-authored-by: Quan Tian <qtian@vmware.com>
@wenyingd
Copy link
Contributor Author

/test-all
/test-ipv6-all
/test-ipv6-only-all

@wenyingd wenyingd requested a review from tnqn July 29, 2021 01:49
Copy link
Member

@tnqn tnqn left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

@tnqn
Copy link
Member

tnqn commented Jul 29, 2021

/test-windows-conformance
/test-windows-networkpolicy
/test-ipv6-only-networkpolicy

All comments have been addressed except #2370 (comment), which we are tracking in #2473. I will merge it after the remaining tests pass.

@tnqn
Copy link
Member

tnqn commented Jul 29, 2021

@wenyingd could you check if the failures of jenkins-windows-conformance and jenkins-windows-networkpolicy are related?

@wenyingd
Copy link
Contributor Author

wenyingd commented Jul 29, 2021

@wenyingd could you check if the failures of jenkins-windows-conformance and jenkins-windows-networkpolicy are related?

No, it is CI testbed issue. I have passed Windows conformance and networkpolicy tests in my setup many times.

@tnqn tnqn merged commit da17b5d into antrea-io:main Jul 29, 2021
@jayunit100
Copy link
Contributor

hi folks, cool, do we have any releases that has this fix ?

@antoninbas
Copy link
Contributor

Hi @jayunit100 - this was just merged last week. It is not a bug fix and will not be backported. It will be included in Antrea v1.3 (end of August).

@jayunit100
Copy link
Contributor

thanks ! anyone have an antrea.exe binary aroujnd i can use?
for some reason, when i compile it locally using the make target for antrea (windows) its flagged as "not a valid windows executable"

@lzhecheng
Copy link
Contributor

@jayunit100 hello, currently there's no place to download an exe with this patch but you can compile yourself.

How did you do it? From my side, I usually make windows-bin on a Linux machine and exe files (antrea-agent.exe, antrea-cni.exe) will be under bin/.

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.

Decouple kubelet node-ip from the Antrea default Gateway uplink
8 participants