Commit 257e2e6
authored
Check what ports gateways are listening on and filter based on that (#58131)
* Check what ports gateways are listening on and filter based on that
TestTraffic tests are failing when we run them in ambient multi-network
environment. Looking through the failure details it seems that we
overlooked interoperability between ambient and sidecar.
Specifically, when in the same namespace we have both pods/services using
ambient dataplane and pods/services using sidecar at the same time. In
multi-network scenario, what can happen is that sidecars will see
ambient E/W gateways, because pilot generates EDS endpoints for those,
but at the moment sidecars cannot talke to ambient E/W gateways because
those expect double-HBONE.
We want to ultimately allow sidecars to talk to ambient E/W gateways
using double-HBONE (or add support for mTLS to ambient E/W gateways),
but it's a bigger project.
So for now I'm trying to filter gateways that expect double-HBONE from
sidecar endpoints. There are a few options to achieve that that I
considered:
1. [not exactly a fix] Use istio.test.ambient.everywhere flag for
tests - it avoids the issue, but it also defeats one of the reasons
for running those tests in the first place
2. [non invasive] check if gw has a non-zero HBONE port and if so
exclude it from gws used by sidecar - this solves the problem and is
probably the least risky change
3. [proper, I think] When generating gateways check what ports they
are actually listening on and when generating EDS endpoints account
for that (similarly to how we would take into account HBONE port in
the option 2 above).
I ultimately decided to go for the last option. Option 1 is not exactly
a solution, so I discarded it for that reason. Option 2 works, but it
introduces an assumption that a GW is either ambient and listens on
HBONE port or a mTLS, but not both - this is true now (and probably long
into the future), but it does not have to be. Another thing to mention
is that it creates a bit of assymetry between how HBONE port and mTLS
port are treated in the code - I personally don't like that.
And the last item in favor of the option 3 is that there is a TODO in
the code that suggests that we should at least consider checking what
ports the gw service is actually listening on. Going for option 3,
assuming we don't find any downsides, is that we can close that TODO
as well.
So this change adds a check to the code that generates gateways from
services to confirm that the service actually listens on the port we
intend to use. If the service does not listen on the port, I mark it as
0, so upstream code can check for that.
Then in the EDS endpoint generation code I check if we are generating
for a sidecar and if so, I ignore gateways that don't listen on mTLS
port (by checking if it's 0 or not).
Signed-off-by: Mikhail Krinkin <[email protected]>
* Fix the relevant tests
Signed-off-by: Mikhail Krinkin <[email protected]>
* Fix formatting
Signed-off-by: Mikhail Krinkin <[email protected]>
* Add a release note for the fix
Signed-off-by: Mikhail Krinkin <[email protected]>
---------
Signed-off-by: Mikhail Krinkin <[email protected]>1 parent e4acd9f commit 257e2e6
File tree
5 files changed
+57
-12
lines changed- pilot/pkg
- serviceregistry/kube/controller
- xds
- endpoints
- releasenotes/notes
5 files changed
+57
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
312 | 312 | | |
313 | 313 | | |
314 | 314 | | |
315 | | - | |
316 | | - | |
317 | 315 | | |
318 | 316 | | |
319 | 317 | | |
320 | 318 | | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | 319 | | |
326 | 320 | | |
327 | 321 | | |
328 | 322 | | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
329 | 326 | | |
330 | | - | |
331 | | - | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
332 | 333 | | |
333 | | - | |
334 | | - | |
335 | 334 | | |
336 | | - | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
337 | 352 | | |
338 | 353 | | |
339 | 354 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
927 | 927 | | |
928 | 928 | | |
929 | 929 | | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
291 | 305 | | |
292 | 306 | | |
293 | 307 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
| 194 | + | |
194 | 195 | | |
195 | 196 | | |
196 | 197 | | |
| |||
574 | 575 | | |
575 | 576 | | |
576 | 577 | | |
577 | | - | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
578 | 582 | | |
579 | 583 | | |
580 | 584 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
0 commit comments