Commit 03d1726
gateway-api: migrate net.IP usage to net/netip
Convert the remaining net.IP usage in the Gateway API operator to
netip.Addr, as part of the tree-wide migration tracked in cilium#24246.
In setAddressStatus, the NodePort branch now parses node addresses
with netip.ParseAddr and sorts them with netip.Addr.Compare. Nodes
whose first status address is not an IP address (e.g. a Hostname
entry) are now skipped instead of being appended as a nil net.IP,
which previously rendered as a bogus "<nil>" address in the Gateway
status. Parsed addresses are Unmap()-ed so IPv4-mapped IPv6 inputs
keep rendering in dotted-quad form as before. Note that mixed IPv4
and IPv6 addresses now sort IPv4-first instead of interleaving the
IPv4-mapped form within the IPv6 space; the sort only exists to keep
the assigned addresses deterministic, which is preserved.
In verifyGatewayStaticAddresses, netip.ParseAddr replaces the
net.ParseIP nil check. Parsing semantics are unchanged for valid
IPv4/IPv6 literals; zoned IPv6 literals are additionally accepted.
The nodeport testdata gains a node whose only status address is a
Hostname entry, locking in the new skip behavior.
Related: cilium#24246
Signed-off-by: Dean Chen <862469039@qq.com>1 parent 3c27bc4 commit 03d1726
2 files changed
Lines changed: 26 additions & 10 deletions
File tree
- operator/pkg/gateway-api
- testdata/gateway/gatewayclassconfig-nodeport/input
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
12 | | - | |
13 | | - | |
| 11 | + | |
| 12 | + | |
14 | 13 | | |
15 | 14 | | |
16 | 15 | | |
| |||
1116 | 1115 | | |
1117 | 1116 | | |
1118 | 1117 | | |
1119 | | - | |
| 1118 | + | |
1120 | 1119 | | |
1121 | 1120 | | |
1122 | 1121 | | |
1123 | 1122 | | |
1124 | 1123 | | |
1125 | | - | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
1126 | 1131 | | |
1127 | 1132 | | |
1128 | 1133 | | |
1129 | | - | |
1130 | | - | |
1131 | | - | |
| 1134 | + | |
1132 | 1135 | | |
1133 | 1136 | | |
1134 | 1137 | | |
| |||
1560 | 1563 | | |
1561 | 1564 | | |
1562 | 1565 | | |
1563 | | - | |
1564 | | - | |
| 1566 | + | |
1565 | 1567 | | |
1566 | 1568 | | |
1567 | 1569 | | |
| |||
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
0 commit comments