Commit 741f895
authored
fix(charts): filter default-route discovery helpers to IPv4 family (#145)
* test(charts): pin IPv4-only contract on default-route discovery helpers
Add two failing tests covering the dual-stack regression:
- TestDefaultGatewayIsIPv4OnDualStack: helper-level assertion that
talm.discovered.default_gateway returns the IPv4 default-route gateway
on a node with both IPv4 and IPv6 default routes (IPv6 ordered first
in discovery, mirroring real Hetzner-style nodes).
- TestCozystackChartRendersIPv4GatewayOnDualStack: end-to-end assertion
on the cozystack v1.12 multi-doc chart output. Both LinkConfig.routes
gateway and LinkConfig.addresses must use the IPv4 default-route data
even when an IPv6 default route also exists.
Both fail today: default_gateway and default_addresses_by_gateway both
iterate routes and break at the first default route without filtering
by family, so an IPv6-first discovery yields:
- gateway: fe80::1 paired with an implicit IPv4 destination, which
Talos rejects as a malformed route (the headline VIP-not-addressable
symptom users hit).
- addresses: empty, because the IPv6 family selected by the first
default route filters out the node's IPv4 addresses, leaving the
primary NIC unconfigured.
Add a dualStackNicLookup() fixture next to simpleNicLookup() so the
chart-rendering test path can exercise dual-stack discovery without
disturbing the existing IPv4-only fixtures the rest of the suite
depends on.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
* fix(charts): filter default-route discovery helpers to IPv4 family
talm.discovered.default_gateway and talm.discovered.default_addresses_by_gateway
now skip routes whose family is not inet4. The chart consumers (cozystack
and generic) pair the returned gateway with a hardcoded IPv4 destination
(network: 0.0.0.0/0 on the legacy schema, or no network field on the typed
RouteConfig schema where Talos defaults to IPv4), and the addresses helper
filters per-link addresses by the route's family.
Without the filter, a node with both IPv4 and IPv6 default routes (the
typical Hetzner / dual-stack setup) ends up with:
- gateway: <ipv6 link-local> in a route block whose destination is
IPv4 — Talos rejects the malformed entry and dependent features
(Layer2 VIP, default routing through the rendered chart config)
silently break.
- addresses: empty in the rendered LinkConfig because the helper
inherits the IPv6 family from the first iterated default route and
the address filter then drops every IPv4 entry on the link.
The IPv4-only filter is symmetric with gateway_by_link, which already
documents "IPv4-only by convention to avoid family/address mismatch on
dual-stack nodes". Doc comments updated to spell out the chain so a
future maintainer who adds an IPv6-aware variant for new typed routes
does not silently widen the existing helpers and re-introduce the
regression.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
---------
Signed-off-by: Aleksei Sviridkin <f@lex.la>1 parent 892c543 commit 741f895
4 files changed
Lines changed: 429 additions & 22 deletions
File tree
- charts
- cozystack
- generic
- talm/templates
- pkg/engine
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | | - | |
| 34 | + | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
66 | 68 | | |
67 | 69 | | |
68 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
| 22 | + | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
54 | 56 | | |
55 | 57 | | |
56 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
94 | 102 | | |
95 | 103 | | |
96 | 104 | | |
97 | 105 | | |
98 | | - | |
| 106 | + | |
99 | 107 | | |
100 | 108 | | |
101 | 109 | | |
| |||
134 | 142 | | |
135 | 143 | | |
136 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
137 | 156 | | |
138 | 157 | | |
139 | | - | |
| 158 | + | |
140 | 159 | | |
141 | 160 | | |
142 | 161 | | |
| |||
145 | 164 | | |
146 | 165 | | |
147 | 166 | | |
148 | | - | |
| 167 | + | |
149 | 168 | | |
150 | 169 | | |
151 | 170 | | |
| |||
154 | 173 | | |
155 | 174 | | |
156 | 175 | | |
157 | | - | |
| 176 | + | |
158 | 177 | | |
159 | 178 | | |
160 | 179 | | |
| |||
163 | 182 | | |
164 | 183 | | |
165 | 184 | | |
166 | | - | |
| 185 | + | |
167 | 186 | | |
168 | 187 | | |
169 | 188 | | |
| |||
176 | 195 | | |
177 | 196 | | |
178 | 197 | | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
179 | 209 | | |
180 | 210 | | |
181 | | - | |
| 211 | + | |
182 | 212 | | |
183 | 213 | | |
184 | 214 | | |
| |||
0 commit comments