Skip to content

Query: Support per endpoint TLS configuration - #8594

Merged
GiedriusS merged 38 commits into
thanos-io:mainfrom
Naman-B-Parlecha:NamanParlecha/PerEndpointTLS
May 4, 2026
Merged

GiedriusS merged 38 commits into
thanos-io:mainfrom
Naman-B-Parlecha:NamanParlecha/PerEndpointTLS

Conversation

@Naman-B-Parlecha

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

Copy link
Copy Markdown
Contributor

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

@ringerc ringerc left a comment •

Copy link
Copy Markdown
Contributor

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
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:))

@GiedriusS GiedriusS left a comment

Copy link
Copy Markdown
Member

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

ringerc commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

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

@ringerc

ringerc commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

@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

@GiedriusS
GiedriusS enabled auto-merge May 4, 2026 11:03
@GiedriusS
GiedriusS merged commit 200c475 into thanos-io:main May 4, 2026
36 of 38 checks passed
@ringerc

ringerc commented May 5, 2026

Copy link
Copy Markdown
Contributor

Thanks very much @GiedriusS

saswatamcode pushed a commit that referenced this pull request Jun 15, 2026
This commit changes the log verbosity from info to debug for TLS client
configuration setup.

Running a Thanos Query on the main branch with
`--endpoint.sd-config-file` instead of the legacy `--grpc-client*`
arguments, log messages are emitted every 5 seconds (the interval at
which the list of endpoints is refreshed):

```
ts=2026-06-15T14:47:46.913935863Z caller=client.go:147 level=info msg="enabling client to server TLS"
ts=2026-06-15T14:47:46.9141221Z caller=options.go:145 level=info msg="TLS client using provided certificate pool"
ts=2026-06-15T14:47:46.914143614Z caller=options.go:165 level=info msg="setting minimum TLS version to 1.3"
ts=2026-06-15T14:47:46.91415433Z caller=options.go:191 level=info msg="TLS client authentication enabled"
ts=2026-06-15T14:47:51.914025066Z caller=client.go:147 level=info msg="enabling client to server TLS"
ts=2026-06-15T14:47:51.914294263Z caller=options.go:145 level=info msg="TLS client using provided certificate pool"
ts=2026-06-15T14:47:51.91431529Z caller=options.go:165 level=info msg="setting minimum TLS version to 1.3"
ts=2026-06-15T14:47:51.914326314Z caller=options.go:191 level=info msg="TLS client authentication enabled"
ts=2026-06-15T14:47:56.913622829Z caller=client.go:147 level=info msg="enabling client to server TLS"
ts=2026-06-15T14:47:56.913977311Z caller=options.go:145 level=info msg="TLS client using provided certificate pool"
ts=2026-06-15T14:47:56.913995512Z caller=options.go:165 level=info msg="setting minimum TLS version to 1.3"
ts=2026-06-15T14:47:56.914006135Z caller=options.go:191 level=info msg="TLS client authentication enabled"
```

I think that it was introduced in #8594.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
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