Azure / azure-container-networking

Azure Container Networking Solutions for Linux and Windows Containers
MIT License
378 stars 241 forks source link

Fix: Add default route on delegatedNIC interface #3109

Closed paulyufan2 closed 1 week ago

paulyufan2 commented 1 week ago

Reason for Change:

This PR is to fix one issue in swiftv2 Windows scenario: When a pod is created, the default route is added on infra vnet: root@swiftv2-pod-3:/# ip route default via 10.244.2.1 dev eth0 metric 1 It leads to ping a VM IP in the same VNET that cannot work.

There are two issues:: 1.CNS does not provide the default route to CNI; 2.CNI should only add the default route to secondary interface customer vnet; on Swiftv2 scenario, skipDefaultRoutes is set to true for infraNIC interface and false for a secondary interface; so if !info.skipDefaultRoutes, then add default route.

Add dummy default route and pass to CNI as a workaround;

After this fix after a pod creation is done, the route table shows: root@swiftv2-pod-1:/# ip route default via 10.241.0.1 dev eth1 10.241.0.0/16 dev eth1 proto kernel scope link src 10.241.0.55 10.244.0.0/16 dev eth0 proto kernel scope link src 10.244.1.103

Issue Fixed:

Requirements:

Notes:

paulyufan2 commented 1 week ago

/azp run Azure Container Networking PR

azure-pipelines[bot] commented 1 week ago
Azure Pipelines successfully started running 1 pipeline(s).
paulyufan2 commented 1 week ago

/azp run Azure Container Networking PR

azure-pipelines[bot] commented 1 week ago
Azure Pipelines successfully started running 1 pipeline(s).
paulyufan2 commented 1 week ago

/azp run Azure Container Networking PR

azure-pipelines[bot] commented 1 week ago
Azure Pipelines successfully started running 1 pipeline(s).
paulyufan2 commented 1 week ago

/azp run Azure Container Networking PR

azure-pipelines[bot] commented 1 week ago
Azure Pipelines successfully started running 1 pipeline(s).
paulyufan2 commented 1 week ago

/azp run Azure Container Networking PR

azure-pipelines[bot] commented 1 week ago
Azure Pipelines successfully started running 1 pipeline(s).