Skip to content

Commit b2d59f8

Browse files
joe-elliottmapno
andauthored
Configure S3's credential chain based on config (#2889) (#2925)
* Configure S3's credential chain based on config * Changelog * Update docs (cherry picked from commit 957f160) Co-authored-by: Mario <[email protected]>
1 parent 5998bef commit b2d59f8

File tree

4 files changed

+84
-28
lines changed

4 files changed

+84
-28
lines changed

CHANGELOG.md

+41
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,47 @@
77
* [ENHANCEMENT] Update /api/metrics/summary to correctly handle missing attributes and improve performance of TraceQL `select()` queries. [#2765](https://github.com/grafana/tempo/pull/2765) (@mdisibio)
88
* [ENHANCEMENT] Add `TempoUserConfigurableOverridesReloadFailing` alert [#2784](https://github.com/grafana/tempo/pull/2784) (@kvrhdn)
99
* [BUGFIX] Fix panic in metrics summary api [#2738](https://github.com/grafana/tempo/pull/2738) (@mdisibio)
10+
* [BUGFIX] Only search ingester blocks that fall within the request time range. [#2783](https://github.com/grafana/tempo/pull/2783) (@joe-elliott)
11+
* [BUGFIX] Align tempo_query_frontend_queries_total and tempo_query_frontend_queries_within_slo_total. [#2840](https://github.com/grafana/tempo/pull/2840) (@joe-elliott)
12+
* [BUGFIX] To support blob storage in Azure Stack Hub as backend. [#2853](https://github.com/grafana/tempo/pull/2853) (@chlislb)
13+
This query will now correctly tell you %age of requests that are within SLO:
14+
```
15+
sum(rate(tempo_query_frontend_queries_within_slo_total{}[1m])) by (op)
16+
/
17+
sum(rate(tempo_query_frontend_queries_total{}[1m])) by (op)
18+
```
19+
**BREAKING CHANGE** Removed: tempo_query_frontend_queries_total{op="searchtags|metrics"}.
20+
* [BUGFIX] Fix S3 credentials providers configuration [#2889](https://github.com/grafana/tempo/pull/2889) (@mapno)
21+
* [CHANGE] Overrides module refactor [#2688](https://github.com/grafana/tempo/pull/2688) (@mapno)
22+
Added new `defaults` block to the overrides' module. Overrides change to indented syntax.
23+
Old config:
24+
```
25+
overrides:
26+
ingestion_rate_strategy: local
27+
ingestion_rate_limit_bytes: 12345
28+
ingestion_burst_size_bytes: 67890
29+
max_search_duration: 17s
30+
forwarders: ['foo']
31+
metrics_generator_processors: [service-graphs, span-metrics]
32+
```
33+
New config:
34+
```
35+
overrides:
36+
defaults:
37+
ingestion:
38+
rate_strategy: local
39+
rate_limit_bytes: 12345
40+
burst_size_bytes: 67890
41+
read:
42+
max_search_duration: 17s
43+
forwarders: ['foo']
44+
metrics_generator:
45+
processors: [service-graphs, span-metrics]
46+
```
47+
* [BUGFIX] Moved empty root span substitution from `querier` to `query-frontend`. [#2671](https://github.com/grafana/tempo/issues/2671) (@galalen)
48+
49+
# v2.2.2 / 2023-08-30
50+
1051
* [BUGFIX] Fix node role auth IDMSv1 [#2760](https://github.com/grafana/tempo/pull/2760) (@coufalja)
1152
* [BUGFIX] Only search ingester blocks that fall within the request time range. [#2783](https://github.com/grafana/tempo/pull/2783) (@joe-elliott)
1253
* [BUGFIX] Fix incorrect metrics for index failures [#2781](https://github.com/grafana/tempo/pull/2781) (@zalegrala)

docs/sources/tempo/configuration/_index.md

+4
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,10 @@ storage:
790790
# See the [S3 documentation on object tagging](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-tagging.html) for more detail.
791791
[tags: <map[string]string>]
792792

793+
# If enabled, it will use the default authentication methods of
794+
# the AWS SDK for go based on known environment variables and known AWS config files.
795+
[native_aws_auth_enabled: <boolean> | default = false]
796+
793797
# azure configuration. Will be used only if value of backend is "azure"
794798
# EXPERIMENTAL
795799
azure:

tempodb/backend/s3/config.go

+7-6
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@ type Config struct {
2222
HedgeRequestsAt time.Duration `yaml:"hedge_requests_at"`
2323
HedgeRequestsUpTo int `yaml:"hedge_requests_up_to"`
2424
// SignatureV2 configures the object storage to use V2 signing instead of V4
25-
SignatureV2 bool `yaml:"signature_v2"`
26-
ForcePathStyle bool `yaml:"forcepathstyle"`
27-
BucketLookupType int `yaml:"bucket_lookup_type"`
28-
Tags map[string]string `yaml:"tags"`
29-
StorageClass string `yaml:"storage_class"`
30-
Metadata map[string]string `yaml:"metadata"`
25+
SignatureV2 bool `yaml:"signature_v2"`
26+
ForcePathStyle bool `yaml:"forcepathstyle"`
27+
BucketLookupType int `yaml:"bucket_lookup_type"`
28+
Tags map[string]string `yaml:"tags"`
29+
StorageClass string `yaml:"storage_class"`
30+
Metadata map[string]string `yaml:"metadata"`
31+
NativeAWSAuthEnabled bool `yaml:"native_aws_auth_enabled"`
3132
}
3233

3334
func (c *Config) PathMatches(other *Config) bool {

tempodb/backend/s3/s3.go

+32-22
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ import (
1515
"github.com/cristalhq/hedgedhttp"
1616
gkLog "github.com/go-kit/log"
1717
"github.com/go-kit/log/level"
18-
minio "github.com/minio/minio-go/v7"
18+
"github.com/minio/minio-go/v7"
1919
"github.com/minio/minio-go/v7/pkg/credentials"
20-
opentracing "github.com/opentracing/opentracing-go"
20+
"github.com/opentracing/opentracing-go"
2121
"github.com/pkg/errors"
2222

2323
tempo_io "github.com/grafana/tempo/pkg/io"
@@ -355,25 +355,35 @@ func createCore(cfg *Config, hedge bool) (*minio.Core, error) {
355355
return p
356356
}
357357

358-
creds := credentials.NewChainCredentials([]credentials.Provider{
359-
wrapCredentialsProvider(NewAWSSDKAuth(cfg.Region)),
360-
wrapCredentialsProvider(&credentials.EnvAWS{}),
361-
wrapCredentialsProvider(&credentials.Static{
362-
Value: credentials.Value{
363-
AccessKeyID: cfg.AccessKey,
364-
SecretAccessKey: cfg.SecretKey.String(),
365-
SessionToken: cfg.SessionToken.String(),
366-
},
367-
}),
368-
wrapCredentialsProvider(&credentials.EnvMinio{}),
369-
wrapCredentialsProvider(&credentials.FileAWSCredentials{}),
370-
wrapCredentialsProvider(&credentials.FileMinioClient{}),
371-
wrapCredentialsProvider(&credentials.IAM{
372-
Client: &http.Client{
373-
Transport: http.DefaultTransport,
374-
},
375-
}),
376-
})
358+
var chain []credentials.Provider
359+
360+
if cfg.NativeAWSAuthEnabled {
361+
chain = []credentials.Provider{
362+
wrapCredentialsProvider(NewAWSSDKAuth(cfg.Region)),
363+
}
364+
} else if cfg.AccessKey != "" {
365+
chain = []credentials.Provider{
366+
wrapCredentialsProvider(&credentials.Static{
367+
Value: credentials.Value{
368+
AccessKeyID: cfg.AccessKey,
369+
SecretAccessKey: cfg.SecretKey.String(),
370+
SessionToken: cfg.SessionToken.String(),
371+
},
372+
}),
373+
}
374+
} else {
375+
chain = []credentials.Provider{
376+
wrapCredentialsProvider(&credentials.EnvAWS{}),
377+
wrapCredentialsProvider(&credentials.EnvMinio{}),
378+
wrapCredentialsProvider(&credentials.FileAWSCredentials{}),
379+
wrapCredentialsProvider(&credentials.FileMinioClient{}),
380+
wrapCredentialsProvider(&credentials.IAM{
381+
Client: &http.Client{
382+
Transport: http.DefaultTransport,
383+
},
384+
}),
385+
}
386+
}
377387

378388
customTransport, err := minio.DefaultTransport(!cfg.Insecure)
379389
if err != nil {
@@ -404,7 +414,7 @@ func createCore(cfg *Config, hedge bool) (*minio.Core, error) {
404414
opts := &minio.Options{
405415
Region: cfg.Region,
406416
Secure: !cfg.Insecure,
407-
Creds: creds,
417+
Creds: credentials.NewChainCredentials(chain),
408418
Transport: transport,
409419
}
410420

0 commit comments

Comments
 (0)