Skip to content

test: add PrivateLink cloudtest with Toxiproxy simulation#36162

Open
jubrad wants to merge 1 commit intoMaterializeInc:mainfrom
jubrad:jubrad/kafka-privatelink-cloudtest
Open

test: add PrivateLink cloudtest with Toxiproxy simulation#36162
jubrad wants to merge 1 commit intoMaterializeInc:mainfrom
jubrad:jubrad/kafka-privatelink-cloudtest

Conversation

@jubrad
Copy link
Copy Markdown
Contributor

@jubrad jubrad commented Apr 20, 2026

Summary

Depends on #36161. Merge that first.

  • Adds Toxiproxy k8s deployment/service infrastructure for simulating PrivateLink network paths in cloudtest
  • Adds test_privatelink_e2e_connectivity: validates connectivity through simulated PrivateLink, failure detection when proxy is disabled, and recovery
  • Adds test_privatelink_pattern_matching: patches Redpanda with AZ-specific advertised address, then proves MATCHING rules route post-metadata traffic through the correct AZ-specific proxy by disabling the default proxy after bootstrap
  • Adds doc/developer/testing-confluent-privatelink.md: step-by-step guide for manual testing against Confluent Cloud PrivateLink using a scratch VM with dnsmasq DNS overrides

Test plan

  • Run ./pytest --dev -k test_privatelink_e2e_connectivity
  • Run ./pytest --dev -k test_privatelink_pattern_matching
  • Verify pattern matching test fails if MATCHING rules are removed

🤖 Generated with Claude Code

@jubrad jubrad force-pushed the jubrad/kafka-privatelink-cloudtest branch 3 times, most recently from aba16f6 to c34f80c Compare April 21, 2026 01:56
@jubrad jubrad force-pushed the jubrad/kafka-privatelink-cloudtest branch from c34f80c to 9abc2ec Compare April 22, 2026 03:54
jubrad added a commit that referenced this pull request Apr 27, 2026
## Follow up of #35455

## Summary

- Adds `BOOTSTRAP BROKER 'addr' USING AWS PRIVATELINK conn (...)` — new
top-level option that provides the initial bootstrap address with an
explicit PrivateLink tunnel, preserving the real hostname for correct
TLS SNI
- Adds `MATCHING 'pattern' USING AWS PRIVATELINK conn (...)` inside
`BROKERS (...)` — pattern-based routing rules for dynamically discovered
brokers returned in Kafka metadata
- Replaces the `AWS PRIVATELINKS` syntax which used a `TO` keyword
inconsistent with the existing `USING AWS PRIVATELINK` syntax and
overloaded exact-match patterns as implicit bootstrap addresses
- Updates parser, planner, and storage layer to support the new
constructs

### Example
```sql
CREATE CONNECTION kafka TO KAFKA (
    BROKERS (
        'lkc-825730.endpoint.cloud:9092' USING AWS PRIVATELINK pl_conn,
        MATCHING '*use1-az1*' USING AWS PRIVATELINK pl_conn (AVAILABILITY ZONE 'use1-az1'),
        MATCHING '*use1-az4*' USING AWS PRIVATELINK pl_conn (AVAILABILITY ZONE 'use1-az4'),
        MATCHING '*use1-az6*' USING AWS PRIVATELINK pl_conn (AVAILABILITY ZONE 'use1-az6')
    ),
    SASL MECHANISMS 'PLAIN',
    SASL USERNAME 'key',
    SASL PASSWORD SECRET secret,
    SECURITY PROTOCOL 'SASL_SSL'
);
```

## Test plan
- [x] Parser tests updated (roundtrip, error cases)
- [x] Testdrive updated (connection-create-drop, connection-alter)
- [x] `cargo check` passes
- [x] Cloudtest validation ([see follow-up
PR](#36162))
- [ ] Manual testing against Confluent Cloud PrivateLink

## Docs
- [ ] #36163


🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jubrad jubrad force-pushed the jubrad/kafka-privatelink-cloudtest branch 2 times, most recently from d0c780a to e9b44a8 Compare April 28, 2026 16:37
@jubrad jubrad requested a review from def- April 28, 2026 20:51
Adds cloudtest infrastructure for testing Kafka PrivateLink connections
using Toxiproxy as a network proxy to simulate VPC endpoint routing.

Includes two tests:

- `test_privatelink_e2e_connectivity`: validates basic connectivity
  through a simulated PrivateLink path, tests failure detection when
  the proxy is disabled, and recovery when re-enabled.

- `test_privatelink_pattern_matching`: patches Redpanda to advertise
  an AZ-specific broker address, then verifies that MATCHING rules
  route post-metadata traffic through the AZ-specific proxy. The
  default proxy is disabled after bootstrap to prove pattern matching
  works.

Also adds `doc/developer/testing-confluent-privatelink.md` with a
step-by-step guide for manual testing against Confluent Cloud
PrivateLink using a scratch VM with dnsmasq DNS overrides.

Fixes the cloudtest `reset` script to clean up configmaps and
vpcendpoints.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jubrad jubrad force-pushed the jubrad/kafka-privatelink-cloudtest branch from e9b44a8 to 2398f5a Compare April 28, 2026 20:54
@jubrad jubrad marked this pull request as ready for review April 28, 2026 20:54
@jubrad jubrad requested review from a team as code owners April 28, 2026 20:54
@jubrad jubrad requested a review from doy-materialize April 28, 2026 20:54
Copy link
Copy Markdown
Contributor

@def- def- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! Did you run it in CI to verify?

@jubrad
Copy link
Copy Markdown
Contributor Author

jubrad commented Apr 29, 2026

Very nice! Did you run it in CI to verify?

Ah no, I have run locally. I'll do that now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants