Skip to content

wip: dynamic_modules: let runtime cluster hosts carry logical hostnames#46388

Draft
dio wants to merge 2 commits into
envoyproxy:mainfrom
dio:dio/dynamic-module-runtime-hostnames-base
Draft

wip: dynamic_modules: let runtime cluster hosts carry logical hostnames#46388
dio wants to merge 2 commits into
envoyproxy:mainfrom
dio:dio/dynamic-module-runtime-hostnames-base

Conversation

@dio

@dio dio commented Jul 26, 2026

Copy link
Copy Markdown
Member

Commit Message:

dynamic_modules: let runtime cluster hosts carry logical hostnames

Additional Description:

Add an opt-in C ABI callback and Rust SDK methods that let dynamic-module clusters set a logical hostname separately from the connection address. This enables existing features such as auto_host_sni and automatic SAN validation.

The existing callback and its behavior remain unchanged. Effective-SNI-scoped TLS session caching was handled in #45982; distinct logical hosts sharing one address can be considered separately.

AI assistance was used to help implement this change. I reviewed and understand the submitted code and take responsibility for it.

Risk Level:

Medium. This adds an opt-in extension ABI and SDK surface.

API Considerations:

Adds an opt-in C ABI callback and Rust SDK methods. Existing callbacks and behavior remain unchanged.

Testing:

  • //test/extensions/clusters/dynamic_modules:cluster_test
  • Envoy CI

Docs Changes:

Added C ABI and Rust SDK API documentation.

Release Notes:

Added a dynamic-modules release note.

Fixes #46387
Refs #45962

Dynamic module cluster hosts currently derive their hostnames from the
cluster name and socket address.

Add a hostname-aware callback that lets modules supply the logical
hostname stored on each runtime host. Preserve the existing callback,
its synthesized hostname, and address-based deduplication.

Expose the callback through the Rust SDK.

Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
@repokitteh-read-only

Copy link
Copy Markdown

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #46388 was opened by dio.

see: more, trace.

@dio dio changed the title dynamic_modules: let runtime cluster hosts carry logical hostnames wip: dynamic_modules: let runtime cluster hosts carry logical hostnames Jul 26, 2026
Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
@dio

dio commented Jul 26, 2026

Copy link
Copy Markdown
Member Author

Reviewer note on the Go reproducer and SDK boundary:

The default scenario in https://github.com/dio/auto-sni-choose-host is a working Go-based e2e demonstration of this PR. The module supplies a concrete address and logical hostname for each runtime host, retains the returned host handles, and returns the selected handle from ChooseHost based on x-target-host. Envoy then uses the selected host hostname with one shared UpstreamTlsContext configured with auto_host_sni and auto_sni_san_validation. The README provides the runnable commands (make run, make request-example, and make request-iana) and downloadable patched Envoy binaries.

The demo imports Envoy SDK package paths, but its go.mod temporarily replaces the module with https://github.com/dio/envoy/tree/dio/dynamic-module-go-cluster-sdk-hostnames. Upstream currently has no Go dynamic-module cluster API, so that branch supplies the Go lifecycle/ABI bridge; the bridge is compiled into the Go shared module, while the downloaded Envoy binary contains only this PR’s C++ ABI change. The Rust changes in this PR are smaller because they extend the existing upstream Rust cluster SDK.

I have deliberately kept the greenfield Go cluster SDK out of this PR. If an upstream Go cluster SDK is desirable, I can propose the prepared implementation as a separate follow-up; otherwise the C ABI added here remains language-neutral and Go modules can provide their own bridge. Reviewer guidance on whether that separate Go SDK surface is wanted would be helpful.

The demo also documents an optional shared-address scenario, but that uses a separate stacked Envoy patch and is not evidence or scope for this PR.

@dio

dio commented Jul 26, 2026

Copy link
Copy Markdown
Member Author

/retest

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.

dynamic_modules: let runtime cluster hosts carry logical hostnames

1 participant