Skip to content

Commit 9f20422

Browse files
authored
add support for msi in bucket client (#4818)
* add support for msi in bucket client Signed-off-by: Noam Dishon <[email protected]> * update changelog Signed-off-by: Noam Dishon <[email protected]>
1 parent 96d1d7c commit 9f20422

File tree

7 files changed

+56
-0
lines changed

7 files changed

+56
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* [ENHANCEMENT] Ring: DoBatch prioritize 4xx errors when failing. #4783
66
* [FEATURE] Compactor: Added `-compactor.block-files-concurrency` allowing to configure number of go routines for download/upload block files during compaction. #4784
77
* [FEATURE] Compactor: Added -compactor.blocks-fetch-concurrency` allowing to configure number of go routines for blocks during compaction. #4787
8+
* [FEATURE] Compactor: Added configurations for Azure MSI in blocks-storage, ruler-storage and alertmanager-storage. #4818
89
* [BUGFIX] Memberlist: Add join with no retrying when starting service. #4804
910

1011

docs/blocks-storage/querier.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,15 @@ blocks_storage:
348348
# CLI flag: -blocks-storage.azure.max-retries
349349
[max_retries: <int> | default = 20]
350350
351+
# Azure storage MSI resource. Either this or account key must be set.
352+
# CLI flag: -blocks-storage.azure.msi-resource
353+
[msi_resource: <string> | default = ""]
354+
355+
# Azure storage MSI resource managed identity client Id. If not supplied
356+
# system assigned identity is used
357+
# CLI flag: -blocks-storage.azure.user-assigned-id
358+
[user_assigned_id: <string> | default = ""]
359+
351360
http:
352361
# The time an idle connection will remain idle before closing.
353362
# CLI flag: -blocks-storage.azure.http.idle-conn-timeout

docs/blocks-storage/store-gateway.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,15 @@ blocks_storage:
404404
# CLI flag: -blocks-storage.azure.max-retries
405405
[max_retries: <int> | default = 20]
406406
407+
# Azure storage MSI resource. Either this or account key must be set.
408+
# CLI flag: -blocks-storage.azure.msi-resource
409+
[msi_resource: <string> | default = ""]
410+
411+
# Azure storage MSI resource managed identity client Id. If not supplied
412+
# system assigned identity is used
413+
# CLI flag: -blocks-storage.azure.user-assigned-id
414+
[user_assigned_id: <string> | default = ""]
415+
407416
http:
408417
# The time an idle connection will remain idle before closing.
409418
# CLI flag: -blocks-storage.azure.http.idle-conn-timeout

docs/configuration/config-file-reference.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,6 +1791,15 @@ azure:
17911791
# CLI flag: -ruler-storage.azure.max-retries
17921792
[max_retries: <int> | default = 20]
17931793
1794+
# Azure storage MSI resource. Either this or account key must be set.
1795+
# CLI flag: -ruler-storage.azure.msi-resource
1796+
[msi_resource: <string> | default = ""]
1797+
1798+
# Azure storage MSI resource managed identity client Id. If not supplied
1799+
# system assigned identity is used
1800+
# CLI flag: -ruler-storage.azure.user-assigned-id
1801+
[user_assigned_id: <string> | default = ""]
1802+
17941803
http:
17951804
# The time an idle connection will remain idle before closing.
17961805
# CLI flag: -ruler-storage.azure.http.idle-conn-timeout
@@ -2373,6 +2382,15 @@ azure:
23732382
# CLI flag: -alertmanager-storage.azure.max-retries
23742383
[max_retries: <int> | default = 20]
23752384
2385+
# Azure storage MSI resource. Either this or account key must be set.
2386+
# CLI flag: -alertmanager-storage.azure.msi-resource
2387+
[msi_resource: <string> | default = ""]
2388+
2389+
# Azure storage MSI resource managed identity client Id. If not supplied
2390+
# system assigned identity is used
2391+
# CLI flag: -alertmanager-storage.azure.user-assigned-id
2392+
[user_assigned_id: <string> | default = ""]
2393+
23762394
http:
23772395
# The time an idle connection will remain idle before closing.
23782396
# CLI flag: -alertmanager-storage.azure.http.idle-conn-timeout
@@ -4724,6 +4742,15 @@ azure:
47244742
# CLI flag: -blocks-storage.azure.max-retries
47254743
[max_retries: <int> | default = 20]
47264744
4745+
# Azure storage MSI resource. Either this or account key must be set.
4746+
# CLI flag: -blocks-storage.azure.msi-resource
4747+
[msi_resource: <string> | default = ""]
4748+
4749+
# Azure storage MSI resource managed identity client Id. If not supplied
4750+
# system assigned identity is used
4751+
# CLI flag: -blocks-storage.azure.user-assigned-id
4752+
[user_assigned_id: <string> | default = ""]
4753+
47274754
http:
47284755
# The time an idle connection will remain idle before closing.
47294756
# CLI flag: -blocks-storage.azure.http.idle-conn-timeout

pkg/storage/bucket/azure/bucket_client.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ func NewBucketClient(cfg Config, name string, logger log.Logger) (objstore.Bucke
1515
ContainerName: cfg.ContainerName,
1616
Endpoint: cfg.Endpoint,
1717
MaxRetries: cfg.MaxRetries,
18+
MSIResource: cfg.MSIResource,
19+
UserAssignedID: cfg.UserAssignedID,
1820
HTTPConfig: azure.HTTPConfig{
1921
IdleConnTimeout: model.Duration(cfg.IdleConnTimeout),
2022
ResponseHeaderTimeout: model.Duration(cfg.ResponseHeaderTimeout),

pkg/storage/bucket/azure/config.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ type Config struct {
1414
ContainerName string `yaml:"container_name"`
1515
Endpoint string `yaml:"endpoint_suffix"`
1616
MaxRetries int `yaml:"max_retries"`
17+
MSIResource string `yaml:"msi_resource"`
18+
UserAssignedID string `yaml:"user_assigned_id"`
1719

1820
http.Config `yaml:"http"`
1921
}
@@ -30,5 +32,7 @@ func (cfg *Config) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet) {
3032
f.StringVar(&cfg.ContainerName, prefix+"azure.container-name", "", "Azure storage container name")
3133
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")
3234
f.IntVar(&cfg.MaxRetries, prefix+"azure.max-retries", 20, "Number of retries for recoverable errors")
35+
f.StringVar(&cfg.MSIResource, prefix+"azure.msi-resource", "", "Azure storage MSI resource. Either this or account key must be set.")
36+
f.StringVar(&cfg.UserAssignedID, prefix+"azure.user-assigned-id", "", "Azure storage MSI resource managed identity client Id. If not supplied system assigned identity is used")
3337
cfg.Config.RegisterFlagsWithPrefix(prefix+"azure.", f)
3438
}

pkg/storage/bucket/azure/config_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ account_name: test-account-name
4545
account_key: test-account-key
4646
container_name: test-container-name
4747
endpoint_suffix: test-endpoint-suffix
48+
msi_resource: test-msi-resource
49+
user_assigned_id: test-user-assigned-id
4850
max_retries: 1
4951
http:
5052
idle_conn_timeout: 2s
@@ -61,6 +63,8 @@ http:
6163
StorageAccountKey: flagext.Secret{Value: "test-account-key"},
6264
ContainerName: "test-container-name",
6365
Endpoint: "test-endpoint-suffix",
66+
MSIResource: "test-msi-resource",
67+
UserAssignedID: "test-user-assigned-id",
6468
MaxRetries: 1,
6569
Config: http.Config{
6670
IdleConnTimeout: 2 * time.Second,

0 commit comments

Comments
 (0)