fix(azure): default endpoint_suffix to blob.core.windows.net#7687
fix(azure): default endpoint_suffix to blob.core.windows.net#7687pujitha24 wants to merge 3 commits into
Conversation
Motivation: After commit da2ad99 switched Cortex's Azure bucket client to Thanos' objstore, block-storage-dependent components (alertmanager, ruler, store-gateway, compactor, etc.) hang on startup when `endpoint_suffix` is left empty, failing with DNS errors and no clear message, e.g.: Get "https://<account>./<container>?restype=container": dial tcp: lookup <account>. on 192.168.5.3:53: no such host Root cause: Cortex builds the Thanos `azure.Config` struct directly in pkg/storage/bucket/azure/bucket_client.go and calls `NewBucketWithConfig`, which bypasses Thanos' `parseConfig`/`DefaultConfig` that would otherwise seed `Endpoint` with "blob.core.windows.net". Because Cortex's own `azure.endpoint-suffix` flag defaulted to "", the resulting FQDN was `<account>.`, which is invalid. Approach: Default the `azure.endpoint-suffix` flag to "blob.core.windows.net", matching Thanos' `DefaultConfig`. This restores the pre-da2ad99 out-of-the-box behavior for Azure public cloud while still allowing the value to be overridden for sovereign/government clouds. The connection-string / Azurite path is unaffected because Thanos never reads `Endpoint` when a connection string is set. Test config default and generated config docs are updated to match. Validation: go build ./... go test -tags "netgo slicelabels" ./pkg/storage/bucket/... make doc BUILD_IN_CONTAINER=false # regenerated config docs All passed. Fixes cortexproject#5449 Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes a regression in Cortex’s Azure object storage configuration by defaulting endpoint_suffix to the Azure public cloud value (blob.core.windows.net). This prevents Cortex from constructing an invalid FQDN (<account>.) when Cortex directly instantiates Thanos’ azure.Config and bypasses Thanos’ internal defaulting logic.
Changes:
- Default
azure.endpoint-suffixflag toblob.core.windows.net. - Update the Azure config default test to match the new flag default.
- Update generated configuration docs and add a changelog entry documenting the behavior change.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/storage/bucket/azure/config.go | Changes the CLI flag default for Azure endpoint-suffix to a valid public cloud suffix. |
| pkg/storage/bucket/azure/config_test.go | Updates the default-config assertion to include the new Endpoint default. |
| docs/configuration/config-file-reference.md | Updates the documented default for endpoint_suffix across relevant Azure config blocks. |
| docs/blocks-storage/store-gateway.md | Updates the documented default for endpoint_suffix in store-gateway config docs. |
| docs/blocks-storage/querier.md | Updates the documented default for endpoint_suffix in querier config docs. |
| CHANGELOG.md | Documents the Azure defaulting bugfix and its impact. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| f.Var(&cfg.StorageConnectionString, prefix+"azure.connection-string", "The values of `account-name` and `endpoint-suffix` values will not be ignored if `connection-string` is set. Use this method over `account-key` if you need to authenticate via a SAS token or if you use the Azurite emulator.") | ||
| f.StringVar(&cfg.ContainerName, prefix+"azure.container-name", "", "Azure storage container name") | ||
| f.StringVar(&cfg.Endpoint, prefix+"azure.endpoint-suffix", "", "Azure storage endpoint suffix without schema. The account name will be prefixed to this value to create the FQDN") | ||
| f.StringVar(&cfg.Endpoint, prefix+"azure.endpoint-suffix", "blob.core.windows.net", "Azure storage endpoint suffix without schema. The account name will be prefixed to this value to create the FQDN") |
| # Azure storage endpoint suffix without schema. The account name will be | ||
| # prefixed to this value to create the FQDN | ||
| # CLI flag: -alertmanager-storage.azure.endpoint-suffix | ||
| [endpoint_suffix: <string> | default = ""] | ||
| [endpoint_suffix: <string> | default = "blob.core.windows.net"] |
|
@pujitha24 modified cortex-config-schema.json should be included in the PR |
Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
|
@friedrichg good catch — I'd missed regenerating the schema. I ran On the Copilot note about the |
Signed-off-by: Friedrich Gonzalez <1517449+friedrichg@users.noreply.github.com>
Motivation:
After commit da2ad99 switched Cortex's Azure bucket client to Thanos'
objstore, block-storage-dependent components (alertmanager, ruler,
store-gateway, compactor, etc.) hang on startup when
endpoint_suffixis left empty, failing with DNS errors and no clear message, e.g.:
Root cause: Cortex builds the Thanos
azure.Configstruct directly inpkg/storage/bucket/azure/bucket_client.go and calls
NewBucketWithConfig, which bypasses Thanos'parseConfig/DefaultConfigthat would otherwise seed
Endpointwith "blob.core.windows.net". BecauseCortex's own
azure.endpoint-suffixflag defaulted to "", the resultingFQDN was
<account>., which is invalid.Approach:
Default the
azure.endpoint-suffixflag to "blob.core.windows.net",matching Thanos'
DefaultConfig. This restores the pre-da2ad99out-of-the-box behavior for Azure public cloud while still allowing the
value to be overridden for sovereign/government clouds. The
connection-string / Azurite path is unaffected because Thanos never reads
Endpointwhen a connection string is set.Test config default and generated config docs are updated to match.
Validation:
go build ./...
go test -tags "netgo slicelabels" ./pkg/storage/bucket/...
make doc BUILD_IN_CONTAINER=false # regenerated config docs
All passed.
Fixes #5449
Signed-off-by: Pujitha Paladugu 10557236+pujitha24@users.noreply.github.com