Skip to content

Query: Support per endpoint TLS configuration#8594

Open
Naman-B-Parlecha wants to merge 38 commits intothanos-io:mainfrom
Naman-B-Parlecha:NamanParlecha/PerEndpointTLS
Open

Query: Support per endpoint TLS configuration#8594
Naman-B-Parlecha wants to merge 38 commits intothanos-io:mainfrom
Naman-B-Parlecha:NamanParlecha/PerEndpointTLS

Conversation

@Naman-B-Parlecha
Copy link
Copy Markdown
Contributor

@Naman-B-Parlecha Naman-B-Parlecha commented Dec 9, 2025

I m still working on this have some edge case and tests to add. Will update description soon.

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

Add per-endpoint and default TLS configuration for the Query component via endpoint.sd-config.

  • Each endpoint can now specify its own client_config with TLS settings, server name, and compression
  • A default_client_config can be set in the YAML config to apply TLS settings to all endpoints that don't specify their own
  • The existing --grpc-client-tls-* CLI flags are deprecated (hidden from --help) and will be removed after v0.43.0
  • A deprecation warning is logged when deprecated CLI flags are used

Precedence order

  1. Per-endpoint client_config (highest)
  2. default_client_config from YAML
  3. --grpc-client-tls-* CLI flags (deprecated, lowest)

Example config

default_client_config:
  tls_config:
    enabled: true
    insecure_skip_verify: true
    cert_file: "/path/to/client.crt" 
    key_file: "/path/to/client.key"    
    ca_file: "/path/to/ca.crt"    
    min_version: "1.3"
  compression: "snappy"         
                                           
endpoints:                              
  - address: "store1:10901"
    client_config:                                                                                                                      
      tls_config:
        enabled: true                                                                                                                   
        cert_file: "/path/to/client.crt"                                                                                              
        key_file: "/path/to/client.key"                                                                                               
        ca_file: "/path/to/ca.crt"                                                                                                      
      server_name: "store"
      compression: "snappy"                                                                                                             

More documentation

Verification

Added debug logs to check if switching between global and per endpoint configuration works as intended

./thanos query --log.level=debug --endpoint.sd-config-file=test_per_endpoint.yml

ts=2025-12-20T17:21:32.579477401Z caller=endpointset.go:429 level=debug msg="configured endpoint" addr=localhost:10901 tls=global compression=none
ts=2025-12-20T17:21:32.579526715Z caller=endpointset.go:429 level=debug msg="configured endpoint" addr=localhost:10902 tls="global (fallback)" compression=none
ts=2025-12-20T17:21:32.57954552Z caller=endpointset.go:429 level=debug msg="configured endpoint" addr=localhost:10903 tls="global (fallback)" compression=none
ts=2025-12-20T17:21:32.579550379Z caller=endpointset.go:429 level=debug msg="configured endpoint" addr=localhost:10904 tls=global compression=none
ts=2025-12-20T17:21:32.579554076Z caller=endpointset.go:429 level=debug msg="configured endpoint" addr=localhost:10905 tls=global compression=none
ts=2025-12-20T17:21:32.590883522Z caller=endpointset.go:429 level=debug msg="configured endpoint" addr=localhost:10906 tls=per-endpoint compression=none

Signed-off-by: Naman-B-Parlecha <naman.parlecha@finalroundai.com>
@Naman-B-Parlecha Naman-B-Parlecha marked this pull request as draft December 9, 2025 21:11
Naman-B-Parlecha and others added 3 commits December 10, 2025 02:47
Signed-off-by: Naman-B-Parlecha <namanparlecha@gmail.com>
Signed-off-by: Naman-B-Parlecha <naman.parlecha@finalroundai.com>
@pull-request-size pull-request-size Bot added size/L and removed size/M labels Dec 10, 2025
Signed-off-by: Naman-B-Parlecha <naman.parlecha@finalroundai.com>
Signed-off-by: Naman-B-Parlecha <naman.parlecha@finalroundai.com>
Signed-off-by: Naman-B-Parlecha <naman.parlecha@finalroundai.com>
Signed-off-by: Naman-B-Parlecha <naman.parlecha@finalroundai.com>
@Naman-B-Parlecha Naman-B-Parlecha force-pushed the NamanParlecha/PerEndpointTLS branch from 205dc0a to fddb1b4 Compare December 20, 2025 17:08
Signed-off-by: Naman-B-Parlecha <naman.parlecha@finalroundai.com>
@Naman-B-Parlecha Naman-B-Parlecha marked this pull request as ready for review December 20, 2025 17:34
Comment thread cmd/thanos/endpointset.go Outdated
Signed-off-by: Naman-B-Parlecha <namanparlecha@gmail.com>
@Naman-B-Parlecha
Copy link
Copy Markdown
Contributor Author

@MichaHoffmann i have refactored to client_config PTAL!!

@Naman-B-Parlecha Naman-B-Parlecha changed the title WIP: Query: Support per endpoint TLS configuration Query: Support per endpoint TLS configuration Dec 20, 2025
Copy link
Copy Markdown
Contributor

@ringerc ringerc left a comment

Choose a reason for hiding this comment

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

Thanks for this. While I'm not a proper project member, I hope this initial review is helpful. I'll see if I can also test out the change as this is functionality I happen to need.

I note that there is a test failure from CI below, but it appears to be unrelated to this change.

Comment thread cmd/thanos/endpointset.go
Comment thread cmd/thanos/endpointset.go Outdated
Comment thread cmd/thanos/endpointset.go Outdated
Comment thread docs/components/query.md
Comment thread docs/components/query.md Outdated
@Naman-B-Parlecha
Copy link
Copy Markdown
Contributor Author

Hey @ringerc! Thanks for the review, comment completely make sense i will try and refactor based on your suggestions

…port

Signed-off-by: Naman-B-Parlecha <namanparlecha@gmail.com>
@Naman-B-Parlecha Naman-B-Parlecha force-pushed the NamanParlecha/PerEndpointTLS branch from 54fd19b to bf8c193 Compare February 4, 2026 19:45
@Naman-B-Parlecha
Copy link
Copy Markdown
Contributor Author

@ringerc can u signoff your commits for the DCO to pass

@Naman-B-Parlecha Naman-B-Parlecha force-pushed the NamanParlecha/PerEndpointTLS branch from cafe60f to 1536749 Compare March 4, 2026 10:10
ringerc added 4 commits March 5, 2026 11:30
Add flag `--remote-write.client-tls-min-version` to set the minimum gRPC
client version in Thanos Receive.

While an option `--grpc-client-tls-min-version` exists in the shared
config logic, it is only enabled and supported by Thanos Query.

For historical reasons, Thanos Receive does not use the seemingly-global
configuration for the gRPC client in `cmd/thanos/config.go` (options
prefixed `--grpc-client-`); it has its own `--remote-write.client-`
options instead. Only Query actually uses the global client options.

So the new flag is added alongside the existing Thanos Receive gRPC
client flags for consistency.

Signed-off-by: Craig Ringer <craig.ringer@enterprisedb.com>
Signed-off-by: Craig Ringer <craig.ringer@enterprisedb.com>
Add tls_config.min_version in Redis TLS client config,
so a specific TLS version can be forced in gRPC requests
to Redis.

Signed-off-by: Craig Ringer <craig.ringer@enterprisedb.com>
Signed-off-by: Craig Ringer <craig.ringer@enterprisedb.com>
@ringerc
Copy link
Copy Markdown
Contributor

ringerc commented Mar 4, 2026

@Naman-B-Parlecha Done and pushed the amended commits to https://github.com/ringerc/thanos-patches/tree/NamanParlecha/PerEndpointTLS

Sorry I forgot to add the sign-off tag.

You can

git remote add ringerc	https://github.com/ringerc/thanos-patches
git fetch ringerc
git reset --hard remotes/ringerc/NamanParlecha/PerEndpointTLS

to replace your current tree entirely with mine; I've only changed the sign-offs and added one commit to fix a docs checker complaint. Otherwise, you can git rebase -i rebase away my 4 patches from your tree, then git am these replacements. (Github is such a pain for working on collaborative PRs.)

You'll need to git commit --amend -s your top commit too, to add the sign-off.

Signed-off-by: Craig Ringer <craig.ringer@enterprisedb.com>
@Naman-B-Parlecha Naman-B-Parlecha force-pushed the NamanParlecha/PerEndpointTLS branch 2 times, most recently from 66a0cd0 to 8b790a6 Compare March 9, 2026 19:00
Signed-off-by: Naman-B-Parlecha <namanparlecha@gmail.com>
Comment thread cmd/thanos/config.go
Comment thread cmd/thanos/endpointset.go Outdated
Comment thread cmd/thanos/endpointset_test.go Outdated
Comment thread cmd/thanos/endpointset.go
@GiedriusS
Copy link
Copy Markdown
Member

Updated to 1.26 here #8717 so we can remove lots of boilerplate.

Signed-off-by: Naman-B-Parlecha <namanparlecha@gmail.com>
Signed-off-by: Naman-B-Parlecha <namanparlecha@gmail.com>
@Naman-B-Parlecha
Copy link
Copy Markdown
Contributor Author

@GiedriusS refactored all changed requested PLAT!! thanks:))

Copy link
Copy Markdown
Member

@GiedriusS GiedriusS left a comment

Choose a reason for hiding this comment

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

Could we mark --endpoint and other parameters as deprecated in cmd/thanos/query.go in this same PR? In other words, let's only support using files for setting endpoints. In next_version+1 we can remove them entirely.

@Naman-B-Parlecha
Copy link
Copy Markdown
Contributor Author

Could we mark --endpoint and other parameters as deprecated in cmd/thanos/query.go in this same PR? In other words, let's only support using files for setting endpoints. In next_version+1 we can remove them entirely.

yes read the slack thread regarding this
will refactor!!

thanks

Comment thread pkg/tls/options.go Outdated
@ringerc
Copy link
Copy Markdown
Contributor

ringerc commented Apr 20, 2026

This is still waiting. What can we do to progress this to merge?

@ringerc
Copy link
Copy Markdown
Contributor

ringerc commented Apr 29, 2026

@Naman-B-Parlecha This now needs rebase. Sorry it's taking so long, I'm trying to encourage this to get through final review.

Co-authored-by: Copilot <copilot@github.com>
@Naman-B-Parlecha
Copy link
Copy Markdown
Contributor Author

The docs and unit test failures are not related to pr

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants