mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-10-29 22:03:22 -02:30
Fix macvlan gateway interface detection for names with dots or dashes (#13642)
The [[:alnum:]]* capture truncates interface names at the first character that is not a letter or digit: eth0.100 (VLAN) becomes eth0, br-9a93... becomes br, bond0.200 becomes bond0. The result feeds node_default_gateway_interface, which the macvlan MASQUERADE rules use as the -o match (RedHat post-up/post-down and the Flatcar NAT service under enable_nat_default_gateway), so pod traffic egressing the default gateway loses NAT because the rule references a wrong or nonexistent interface. Capture the whole whitespace-delimited token after ' dev ' instead. The leading space also keeps the greedy match from latching onto names that themselves end in 'dev' (e.g. lan-dev).
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
|
||||
- name: Macvlan | Retrieve default gateway network interface
|
||||
become: false
|
||||
raw: ip -4 route list 0/0 | sed 's/.*dev \([[:alnum:]]*\).*/\1/'
|
||||
raw: ip -4 route list 0/0 | sed -E 's/.* dev ([^ ]+).*/\1/'
|
||||
changed_when: false
|
||||
register: node_default_gateway_interface_cmd
|
||||
|
||||
|
||||
Reference in New Issue
Block a user