Skip to content

test: add PrivateLink cloudtest with Toxiproxy simulation#36162

Draft
jubrad wants to merge 2 commits intoMaterializeInc:mainfrom
jubrad:jubrad/kafka-privatelink-cloudtest
Draft

test: add PrivateLink cloudtest with Toxiproxy simulation#36162
jubrad wants to merge 2 commits 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 and others added 2 commits April 21, 2026 22:12
Introduces two new SQL constructs for Kafka PrivateLink connections:

- `BOOTSTRAP BROKER 'addr' USING AWS PRIVATELINK conn (...)` — provides
  the initial bootstrap address with an explicit PrivateLink tunnel. The
  bootstrap address is used as `bootstrap.servers` and the real hostname
  is preserved for correct TLS SNI.

- `MATCHING 'pattern' USING AWS PRIVATELINK conn (...)` inside `BROKERS`
  — pattern-based routing rules for dynamically discovered brokers.
  After the initial metadata fetch, Kafka returns broker addresses that
  may differ from the bootstrap address (e.g., AZ-specific hostnames).
  MATCHING rules route these through the correct PrivateLink endpoint.

This replaces the `AWS PRIVATELINKS` syntax which used exact-match
patterns for dual-purpose bootstrap/routing and a separate `TO` keyword
inconsistent with the existing `USING AWS PRIVATELINK` syntax.

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

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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 c34f80c to 9abc2ec Compare April 22, 2026 03:54
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.

1 participant