Skip to content

Commit 9cb6360

Browse files
committed
Get rid of boolean flag, add new client config sections.
1 parent 01b1e74 commit 9cb6360

File tree

7 files changed

+228
-69
lines changed

7 files changed

+228
-69
lines changed

docs/sources/shared/configuration.md

+52-51
Original file line numberDiff line numberDiff line change
@@ -789,92 +789,92 @@ The `azure_storage_config` block configures the connection to Azure object stora
789789
```yaml
790790
# Azure Cloud environment. Supported values are: AzureGlobal, AzureChinaCloud,
791791
# AzureGermanCloud, AzureUSGovernment.
792-
# CLI flag: -<prefix>.azure.environment
792+
# CLI flag: -azure.environment
793793
[environment: <string> | default = "AzureGlobal"]
794794
795795
# Azure storage account name.
796-
# CLI flag: -<prefix>.azure.account-name
796+
# CLI flag: -azure.account-name
797797
[account_name: <string> | default = ""]
798798
799799
# Azure storage account key.
800-
# CLI flag: -<prefix>.azure.account-key
800+
# CLI flag: -azure.account-key
801801
[account_key: <string> | default = ""]
802802
803803
# If `connection-string` is set, the values of `account-name` and
804804
# `endpoint-suffix` values will not be used. Use this method over `account-key`
805805
# if you need to authenticate via a SAS token. Or if you use the Azurite
806806
# emulator.
807-
# CLI flag: -<prefix>.azure.connection-string
807+
# CLI flag: -azure.connection-string
808808
[connection_string: <string> | default = ""]
809809

810810
# Name of the storage account blob container used to store chunks. This
811811
# container must be created before running cortex.
812-
# CLI flag: -<prefix>.azure.container-name
812+
# CLI flag: -azure.container-name
813813
[container_name: <string> | default = "loki"]
814814

815815
# Azure storage endpoint suffix without schema. The storage account name will be
816816
# prefixed to this value to create the FQDN.
817-
# CLI flag: -<prefix>.azure.endpoint-suffix
817+
# CLI flag: -azure.endpoint-suffix
818818
[endpoint_suffix: <string> | default = ""]
819819

820820
# Use Managed Identity to authenticate to the Azure storage account.
821-
# CLI flag: -<prefix>.azure.use-managed-identity
821+
# CLI flag: -azure.use-managed-identity
822822
[use_managed_identity: <boolean> | default = false]
823823

824824
# Use Federated Token to authenticate to the Azure storage account.
825-
# CLI flag: -<prefix>.azure.use-federated-token
825+
# CLI flag: -azure.use-federated-token
826826
[use_federated_token: <boolean> | default = false]
827827

828828
# User assigned identity ID to authenticate to the Azure storage account.
829-
# CLI flag: -<prefix>.azure.user-assigned-id
829+
# CLI flag: -azure.user-assigned-id
830830
[user_assigned_id: <string> | default = ""]
831831

832832
# Use Service Principal to authenticate through Azure OAuth.
833-
# CLI flag: -<prefix>.azure.use-service-principal
833+
# CLI flag: -azure.use-service-principal
834834
[use_service_principal: <boolean> | default = false]
835835

836836
# Azure Service Principal ID(GUID).
837-
# CLI flag: -<prefix>.azure.client-id
837+
# CLI flag: -azure.client-id
838838
[client_id: <string> | default = ""]
839839

840840
# Azure Service Principal secret key.
841-
# CLI flag: -<prefix>.azure.client-secret
841+
# CLI flag: -azure.client-secret
842842
[client_secret: <string> | default = ""]
843843

844844
# Azure Tenant ID is used to authenticate through Azure OAuth.
845-
# CLI flag: -<prefix>.azure.tenant-id
845+
# CLI flag: -azure.tenant-id
846846
[tenant_id: <string> | default = ""]
847847

848848
# Chunk delimiter for blob ID to be used
849-
# CLI flag: -<prefix>.azure.chunk-delimiter
849+
# CLI flag: -azure.chunk-delimiter
850850
[chunk_delimiter: <string> | default = "-"]
851851

852852
# Preallocated buffer size for downloads.
853-
# CLI flag: -<prefix>.azure.download-buffer-size
853+
# CLI flag: -azure.download-buffer-size
854854
[download_buffer_size: <int> | default = 512000]
855855

856856
# Preallocated buffer size for uploads.
857-
# CLI flag: -<prefix>.azure.upload-buffer-size
857+
# CLI flag: -azure.upload-buffer-size
858858
[upload_buffer_size: <int> | default = 256000]
859859

860860
# Number of buffers used to used to upload a chunk.
861-
# CLI flag: -<prefix>.azure.download-buffer-count
861+
# CLI flag: -azure.download-buffer-count
862862
[upload_buffer_count: <int> | default = 1]
863863

864864
# Timeout for requests made against azure blob storage.
865-
# CLI flag: -<prefix>.azure.request-timeout
865+
# CLI flag: -azure.request-timeout
866866
[request_timeout: <duration> | default = 30s]
867867

868868
# Number of retries for a request which times out.
869-
# CLI flag: -<prefix>.azure.max-retries
869+
# CLI flag: -azure.max-retries
870870
[max_retries: <int> | default = 5]
871871

872872
# Minimum time to wait before retrying a request.
873-
# CLI flag: -<prefix>.azure.min-retry-delay
873+
# CLI flag: -azure.min-retry-delay
874874
[min_retry_delay: <duration> | default = 10ms]
875875

876876
# Maximum time to wait before retrying a request.
877-
# CLI flag: -<prefix>.azure.max-retry-delay
877+
# CLI flag: -azure.max-retry-delay
878878
[max_retry_delay: <duration> | default = 500ms]
879879
```
880880
@@ -2236,6 +2236,12 @@ The `frontend_worker` configures the worker - running within the Loki querier -
22362236
# CLI flag: -querier.id
22372237
[id: <string> | default = ""]
22382238
2239+
# The grpc_client block configures the gRPC client used to communicate between a
2240+
# client and server component in Loki.
2241+
# The CLI flags prefix for this block configuration is:
2242+
# querier.frontend-grpc-client
2243+
[query_frontend_grpc_client: <grpc_client>]
2244+
22392245
# Configures the gRPC client used to communicate between the querier and the
22402246
# query-frontend, and the querier and the query-scheduler. If
22412247
# 'use_separated_clients' is true, this config is only used for communicating
@@ -2246,15 +2252,9 @@ The `frontend_worker` configures the worker - running within the Loki querier -
22462252
22472253
# Configures the gRPC client used to communicate between the querier and the
22482254
# query-scheduler. If 'use_separated_clients' is false, this config is ignored.
2249-
# The CLI flags prefix for this block configuration is: querier.scheduler-client
2250-
[query_scheduler_grpc_client_config: <grpc_client>]
2251-
2252-
# If set to true, querier will use 'query_scheduler_grpc_client_config' to
2253-
# communicate with the scheduler. Otherwise,
2254-
# 'query_scheduler_grpc_client_config' is ignored and 'grpc_client_config' is
2255-
# used instead.
2256-
# CLI flag: -querier.use-separated-grpc-clients
2257-
[uses_separated_clients: <boolean> | default = false]
2255+
# The CLI flags prefix for this block configuration is:
2256+
# querier.scheduler-grpc-client
2257+
[query_scheduler_grpc_client: <grpc_client>]
22582258
```
22592259

22602260
### gcs_storage_config
@@ -2312,7 +2312,8 @@ The `grpc_client` block configures the gRPC client used to communicate between a
23122312
- `ingester.client`
23132313
- `pattern-ingester.client`
23142314
- `querier.frontend-client`
2315-
- `querier.scheduler-client`
2315+
- `querier.frontend-grpc-client`
2316+
- `querier.scheduler-grpc-client`
23162317
- `query-scheduler.grpc-client-config`
23172318
- `ruler.client`
23182319
- `tsdb.shipper.index-gateway-client.grpc`
@@ -2374,7 +2375,7 @@ backoff_config:
23742375
# TLS flag is set. If set to false, insecure connection to gRPC server will be
23752376
# used.
23762377
# CLI flag: -<prefix>.tls-enabled
2377-
[tls_enabled: <boolean> | default = false]
2378+
[tls_enabled: <boolean> | default = true]
23782379
23792380
# Path to the client certificate, which will be used for authenticating with the
23802381
# server. Also requires the key path to be configured.
@@ -5297,83 +5298,83 @@ The `swift_storage_config` block configures the connection to OpenStack Object S
52975298

52985299
```yaml
52995300
# OpenStack Swift authentication API version. 0 to autodetect.
5300-
# CLI flag: -<prefix>.swift.auth-version
5301+
# CLI flag: -swift.auth-version
53015302
[auth_version: <int> | default = 0]
53025303
53035304
# OpenStack Swift authentication URL
5304-
# CLI flag: -<prefix>.swift.auth-url
5305+
# CLI flag: -swift.auth-url
53055306
[auth_url: <string> | default = ""]
53065307
53075308
# Set this to true to use the internal OpenStack Swift endpoint URL
5308-
# CLI flag: -<prefix>.swift.internal
5309+
# CLI flag: -swift.internal
53095310
[internal: <boolean> | default = false]
53105311
53115312
# OpenStack Swift username.
5312-
# CLI flag: -<prefix>.swift.username
5313+
# CLI flag: -swift.username
53135314
[username: <string> | default = ""]
53145315
53155316
# OpenStack Swift user's domain name.
5316-
# CLI flag: -<prefix>.swift.user-domain-name
5317+
# CLI flag: -swift.user-domain-name
53175318
[user_domain_name: <string> | default = ""]
53185319
53195320
# OpenStack Swift user's domain ID.
5320-
# CLI flag: -<prefix>.swift.user-domain-id
5321+
# CLI flag: -swift.user-domain-id
53215322
[user_domain_id: <string> | default = ""]
53225323
53235324
# OpenStack Swift user ID.
5324-
# CLI flag: -<prefix>.swift.user-id
5325+
# CLI flag: -swift.user-id
53255326
[user_id: <string> | default = ""]
53265327
53275328
# OpenStack Swift API key.
5328-
# CLI flag: -<prefix>.swift.password
5329+
# CLI flag: -swift.password
53295330
[password: <string> | default = ""]
53305331
53315332
# OpenStack Swift user's domain ID.
5332-
# CLI flag: -<prefix>.swift.domain-id
5333+
# CLI flag: -swift.domain-id
53335334
[domain_id: <string> | default = ""]
53345335
53355336
# OpenStack Swift user's domain name.
5336-
# CLI flag: -<prefix>.swift.domain-name
5337+
# CLI flag: -swift.domain-name
53375338
[domain_name: <string> | default = ""]
53385339
53395340
# OpenStack Swift project ID (v2,v3 auth only).
5340-
# CLI flag: -<prefix>.swift.project-id
5341+
# CLI flag: -swift.project-id
53415342
[project_id: <string> | default = ""]
53425343
53435344
# OpenStack Swift project name (v2,v3 auth only).
5344-
# CLI flag: -<prefix>.swift.project-name
5345+
# CLI flag: -swift.project-name
53455346
[project_name: <string> | default = ""]
53465347
53475348
# ID of the OpenStack Swift project's domain (v3 auth only), only needed if it
53485349
# differs the from user domain.
5349-
# CLI flag: -<prefix>.swift.project-domain-id
5350+
# CLI flag: -swift.project-domain-id
53505351
[project_domain_id: <string> | default = ""]
53515352
53525353
# Name of the OpenStack Swift project's domain (v3 auth only), only needed if it
53535354
# differs from the user domain.
5354-
# CLI flag: -<prefix>.swift.project-domain-name
5355+
# CLI flag: -swift.project-domain-name
53555356
[project_domain_name: <string> | default = ""]
53565357
53575358
# OpenStack Swift Region to use (v2,v3 auth only).
5358-
# CLI flag: -<prefix>.swift.region-name
5359+
# CLI flag: -swift.region-name
53595360
[region_name: <string> | default = ""]
53605361
53615362
# Name of the OpenStack Swift container to put chunks in.
5362-
# CLI flag: -<prefix>.swift.container-name
5363+
# CLI flag: -swift.container-name
53635364
[container_name: <string> | default = ""]
53645365
53655366
# Max retries on requests error.
5366-
# CLI flag: -<prefix>.swift.max-retries
5367+
# CLI flag: -swift.max-retries
53675368
[max_retries: <int> | default = 3]
53685369
53695370
# Time after which a connection attempt is aborted.
5370-
# CLI flag: -<prefix>.swift.connect-timeout
5371+
# CLI flag: -swift.connect-timeout
53715372
[connect_timeout: <duration> | default = 10s]
53725373
53735374
# Time after which an idle request is aborted. The timeout watchdog is reset
53745375
# each time some data is received, so the timeout triggers after X time no data
53755376
# is received on a request.
5376-
# CLI flag: -<prefix>.swift.request-timeout
5377+
# CLI flag: -swift.request-timeout
53775378
[request_timeout: <duration> | default = 5s]
53785379
```
53795380

pkg/loki/config_wrapper.go

+23
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ func (c *ConfigWrapper) ApplyDynamicConfig() cfg.Source {
125125
applyIngesterFinalSleep(r)
126126
applyIngesterReplicationFactor(r)
127127
applyChunkRetain(r, &defaults)
128+
if err := applyCommonQuerierWorkerGRPCConfig(r, &defaults); err != nil {
129+
return err
130+
}
128131

129132
return nil
130133
}
@@ -684,3 +687,23 @@ func applyChunkRetain(cfg, defaults *ConfigWrapper) {
684687
}
685688
}
686689
}
690+
691+
func applyCommonQuerierWorkerGRPCConfig(cfg, defaults *ConfigWrapper) error {
692+
if !reflect.DeepEqual(cfg.Worker.OldQueryFrontendGRPCClientConfig, defaults.Worker.OldQueryFrontendGRPCClientConfig) {
693+
// User is using the old grpc configuration.
694+
695+
if reflect.DeepEqual(cfg.Worker.NewQueryFrontendGRPCClientConfig, defaults.Worker.NewQueryFrontendGRPCClientConfig) {
696+
// User is using the old grpc configuration only, we can just copy it to the new grpc client struct.
697+
cfg.Worker.NewQueryFrontendGRPCClientConfig = cfg.Worker.OldQueryFrontendGRPCClientConfig
698+
} else {
699+
// User is using both, old and new way of configuring the grpc client, so we throw an error.
700+
return fmt.Errorf("both `grpc_client_config` and `query_frontend_grpc_client` are set at the same time. Please use only one of them.")
701+
}
702+
703+
if reflect.DeepEqual(cfg.Worker.QuerySchedulerGRPCClientConfig, defaults.Worker.QuerySchedulerGRPCClientConfig) {
704+
// Since the scheduler grpc client is not set, we can just copy the old query frontend grpc client to the scheduler grpc client.
705+
cfg.Worker.QuerySchedulerGRPCClientConfig = cfg.Worker.OldQueryFrontendGRPCClientConfig
706+
}
707+
}
708+
return nil
709+
}

0 commit comments

Comments
 (0)