Skip to content

Commit 96905c3

Browse files
committed
Allow use of non-dualstack endpoints for S3 blocks storage
Signed-off-by: Sam McBroom <sam.mcbroom@appian.com>
1 parent 72dfec3 commit 96905c3

File tree

7 files changed

+38
-8
lines changed

7 files changed

+38
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
* [ENHANCEMENT] Distributor: Added `cortex_distributor_received_samples_per_labelset_total` metric to calculate ingestion rate per label set. #6443
6262
* [ENHANCEMENT] Added metric name in limiter per-metric exceeded errors. #6416
6363
* [ENHANCEMENT] StoreGateway: Added `cortex_bucket_store_indexheader_load_duration_seconds` and `cortex_bucket_store_indexheader_download_duration_seconds` metrics for time of downloading and loading index header files. #6445
64+
* [ENHANCEMENT] Blocks Storage: Allow use of non-dualstack endpoints for S3 blocks storage via `-blocks-storage.s3.disable-dualstack`. #6522
6465
* [BUGFIX] Runtime-config: Handle absolute file paths when working directory is not / #6224
6566
* [BUGFIX] Ruler: Allow rule evaluation to complete during shutdown. #6326
6667
* [BUGFIX] Ring: update ring with new ip address when instance is lost, rejoins, but heartbeat is disabled. #6271

docs/blocks-storage/querier.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,10 @@ blocks_storage:
286286
# CLI flag: -blocks-storage.s3.bucket-name
287287
[bucket_name: <string> | default = ""]
288288
289+
# If enabled, S3 endpoint will use the non-dualstack variant.
290+
# CLI flag: -blocks-storage.s3.disable-dualstack
291+
[disable_dualstack: <boolean> | default = false]
292+
289293
# S3 secret access key
290294
# CLI flag: -blocks-storage.s3.secret-access-key
291295
[secret_access_key: <string> | default = ""]

docs/blocks-storage/store-gateway.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,10 @@ blocks_storage:
390390
# CLI flag: -blocks-storage.s3.bucket-name
391391
[bucket_name: <string> | default = ""]
392392
393+
# If enabled, S3 endpoint will use the non-dualstack variant.
394+
# CLI flag: -blocks-storage.s3.disable-dualstack
395+
[disable_dualstack: <boolean> | default = false]
396+
393397
# S3 secret access key
394398
# CLI flag: -blocks-storage.s3.secret-access-key
395399
[secret_access_key: <string> | default = ""]

docs/configuration/config-file-reference.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,10 @@ s3:
541541
# CLI flag: -alertmanager-storage.s3.bucket-name
542542
[bucket_name: <string> | default = ""]
543543
544+
# If enabled, S3 endpoint will use the non-dualstack variant.
545+
# CLI flag: -alertmanager-storage.s3.disable-dualstack
546+
[disable_dualstack: <boolean> | default = false]
547+
544548
# S3 secret access key
545549
# CLI flag: -alertmanager-storage.s3.secret-access-key
546550
[secret_access_key: <string> | default = ""]
@@ -836,6 +840,10 @@ s3:
836840
# CLI flag: -blocks-storage.s3.bucket-name
837841
[bucket_name: <string> | default = ""]
838842
843+
# If enabled, S3 endpoint will use the non-dualstack variant.
844+
# CLI flag: -blocks-storage.s3.disable-dualstack
845+
[disable_dualstack: <boolean> | default = false]
846+
839847
# S3 secret access key
840848
# CLI flag: -blocks-storage.s3.secret-access-key
841849
[secret_access_key: <string> | default = ""]
@@ -4771,6 +4779,10 @@ s3:
47714779
# CLI flag: -ruler-storage.s3.bucket-name
47724780
[bucket_name: <string> | default = ""]
47734781
4782+
# If enabled, S3 endpoint will use the non-dualstack variant.
4783+
# CLI flag: -ruler-storage.s3.disable-dualstack
4784+
[disable_dualstack: <boolean> | default = false]
4785+
47744786
# S3 secret access key
47754787
# CLI flag: -ruler-storage.s3.secret-access-key
47764788
[secret_access_key: <string> | default = ""]
@@ -5074,6 +5086,10 @@ s3:
50745086
# CLI flag: -runtime-config.s3.bucket-name
50755087
[bucket_name: <string> | default = ""]
50765088
5089+
# If enabled, S3 endpoint will use the non-dualstack variant.
5090+
# CLI flag: -runtime-config.s3.disable-dualstack
5091+
[disable_dualstack: <boolean> | default = false]
5092+
50775093
# S3 secret access key
50785094
# CLI flag: -runtime-config.s3.secret-access-key
50795095
[secret_access_key: <string> | default = ""]

pkg/storage/bucket/s3/bucket_client.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,15 @@ func newS3Config(cfg Config) (s3.Config, error) {
8383
}
8484

8585
return s3.Config{
86-
Bucket: cfg.BucketName,
87-
Endpoint: cfg.Endpoint,
88-
Region: cfg.Region,
89-
AccessKey: cfg.AccessKeyID,
90-
SecretKey: cfg.SecretAccessKey.Value,
91-
Insecure: cfg.Insecure,
92-
SSEConfig: sseCfg,
93-
SendContentMd5: cfg.SendContentMd5,
86+
Bucket: cfg.BucketName,
87+
Endpoint: cfg.Endpoint,
88+
Region: cfg.Region,
89+
DisableDualstack: cfg.DisableDualstack,
90+
AccessKey: cfg.AccessKeyID,
91+
SecretKey: cfg.SecretAccessKey.Value,
92+
Insecure: cfg.Insecure,
93+
SSEConfig: sseCfg,
94+
SendContentMd5: cfg.SendContentMd5,
9495
HTTPConfig: s3.HTTPConfig{
9596
IdleConnTimeout: model.Duration(cfg.HTTP.IdleConnTimeout),
9697
ResponseHeaderTimeout: model.Duration(cfg.HTTP.ResponseHeaderTimeout),

pkg/storage/bucket/s3/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ type Config struct {
6666
Endpoint string `yaml:"endpoint"`
6767
Region string `yaml:"region"`
6868
BucketName string `yaml:"bucket_name"`
69+
DisableDualstack bool `yaml:"disable_dualstack"`
6970
SecretAccessKey flagext.Secret `yaml:"secret_access_key"`
7071
AccessKeyID string `yaml:"access_key_id"`
7172
Insecure bool `yaml:"insecure"`
@@ -89,6 +90,7 @@ func (cfg *Config) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet) {
8990
f.Var(&cfg.SecretAccessKey, prefix+"s3.secret-access-key", "S3 secret access key")
9091
f.StringVar(&cfg.BucketName, prefix+"s3.bucket-name", "", "S3 bucket name")
9192
f.StringVar(&cfg.Region, prefix+"s3.region", "", "S3 region. If unset, the client will issue a S3 GetBucketLocation API call to autodetect it.")
93+
f.BoolVar(&cfg.DisableDualstack, prefix+"s3.disable-dualstack", false, "If enabled, S3 endpoint will use the non-dualstack variant.")
9294
f.StringVar(&cfg.Endpoint, prefix+"s3.endpoint", "", "The S3 bucket endpoint. It could be an AWS S3 endpoint listed at https://docs.aws.amazon.com/general/latest/gr/s3.html or the address of an S3-compatible service in hostname:port format.")
9395
f.BoolVar(&cfg.Insecure, prefix+"s3.insecure", false, "If enabled, use http:// for the S3 endpoint instead of https://. This could be useful in local dev/test environments while using an S3-compatible backend storage, like Minio.")
9496
f.StringVar(&cfg.SignatureVersion, prefix+"s3.signature-version", SignatureVersionV4, fmt.Sprintf("The signature version to use for authenticating against S3. Supported values are: %s.", strings.Join(supportedSignatureVersions, ", ")))

pkg/storage/bucket/s3/config_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ func TestConfig(t *testing.T) {
5151
endpoint: test-endpoint
5252
region: test-region
5353
bucket_name: test-bucket-name
54+
disable_dualstack: true
5455
secret_access_key: test-secret-access-key
5556
access_key_id: test-access-key-id
5657
insecure: true
@@ -74,6 +75,7 @@ http:
7475
Endpoint: "test-endpoint",
7576
Region: "test-region",
7677
BucketName: "test-bucket-name",
78+
DisableDualstack: true,
7779
SecretAccessKey: flagext.Secret{Value: "test-secret-access-key"},
7880
AccessKeyID: "test-access-key-id",
7981
Insecure: true,

0 commit comments

Comments
 (0)