Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit 9287d33

Browse files
authored
Merge pull request #87 from grafana/switch-cortex-blocks-storage-queriers-back-to-deployments
Make store-gateway mandatory for blocks storage and switch queriers back to deployments
2 parents 44abead + 327beb5 commit 9287d33

File tree

2 files changed

+4
-55
lines changed

2 files changed

+4
-55
lines changed

cortex/config.libsonnet

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
// to switch to tsdb storage.
6060
storage_engine: 'chunks',
6161
storage_tsdb_bucket_name: error 'must specify GCS bucket name to store TSDB blocks',
62-
store_gateway_enabled: false,
6362

6463
// TSDB storage engine doesn't require the table manager.
6564
table_manager_enabled: $._config.storage_engine != 'tsdb',
@@ -139,10 +138,7 @@
139138
'experimental.tsdb.ship-interval': '1m',
140139
'experimental.tsdb.backend': 'gcs',
141140
'experimental.tsdb.gcs.bucket-name': $._config.storage_tsdb_bucket_name,
142-
'experimental.tsdb.store-gateway-enabled': $._config.store_gateway_enabled,
143-
}
144-
) + (
145-
if $._config.storage_engine != 'tsdb' || !$._config.store_gateway_enabled then {} else {
141+
'experimental.tsdb.store-gateway-enabled': true,
146142
'experimental.store-gateway.sharding-enabled': true,
147143
'experimental.store-gateway.sharding-ring.store': 'consul',
148144
'experimental.store-gateway.sharding-ring.consul.hostname': 'consul.%s.svc.cluster.local:8500' % $._config.namespace,

cortex/tsdb.libsonnet

Lines changed: 3 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010
storage_backend: 'none',
1111
storage_engine: 'tsdb',
1212

13-
// Allow to configure the querier disk.
14-
cortex_querier_data_disk_size: '10Gi',
15-
cortex_querier_data_disk_class: 'standard',
16-
1713
// Allow to configure the store-gateway disk.
1814
cortex_store_gateway_data_disk_size: '50Gi',
1915
cortex_store_gateway_data_disk_class: 'standard',
@@ -57,50 +53,7 @@
5753
'experimental.tsdb.bucket-store.metadata-cache.memcached.max-get-multi-batch-size': '100',
5854
} else {},
5955

60-
// The querier should run on a dedicated volume used to sync TSDB
61-
// indexes, in order to not negatively affect the node performances
62-
// in case of sustained I/O or utilization. For this reason we:
63-
// 1. Remove default querier deployment
64-
// 2. Run querier as statefulset with PVC
65-
// 3. Replace the service switching it to the statefulset
66-
local querier_data_pvc =
67-
pvc.new() +
68-
pvc.mixin.spec.resources.withRequests({ storage: $._config.cortex_querier_data_disk_size }) +
69-
pvc.mixin.spec.withAccessModes(['ReadWriteOnce']) +
70-
pvc.mixin.spec.withStorageClassName($._config.cortex_querier_data_disk_class) +
71-
pvc.mixin.metadata.withName('querier-data'),
72-
73-
querier_args+:: {
74-
// Reduce the number of blocks synched simultaneously, in order to
75-
// keep the memory utilization under control when the index header
76-
// is generated
77-
'experimental.tsdb.bucket-store.tenant-sync-concurrency': 2,
78-
'experimental.tsdb.bucket-store.block-sync-concurrency': 5,
79-
} + $.blocks_metadata_caching_config + (if !$._config.store_gateway_enabled then $.blocks_chunks_caching_config else {}),
80-
81-
querier_container+::
82-
container.withVolumeMountsMixin([
83-
volumeMount.new('querier-data', '/data'),
84-
]),
85-
86-
querier_deployment: {},
87-
88-
querier_statefulset:
89-
statefulSet.new('querier', 3, [$.querier_container], querier_data_pvc)
90-
.withServiceName('querier') +
91-
statefulSet.mixin.metadata.withNamespace($._config.namespace) +
92-
statefulSet.mixin.metadata.withLabels({ name: 'querier' }) +
93-
statefulSet.mixin.spec.template.metadata.withLabels({ name: 'querier' } + $.querier_deployment_labels) +
94-
statefulSet.mixin.spec.selector.withMatchLabels({ name: 'querier' }) +
95-
statefulSet.mixin.spec.template.spec.securityContext.withRunAsUser(0) +
96-
statefulSet.mixin.spec.template.spec.withTerminationGracePeriodSeconds(60) +
97-
statefulSet.mixin.spec.updateStrategy.withType('RollingUpdate') +
98-
$.util.configVolumeMount('overrides', '/etc/cortex') +
99-
$.util.antiAffinity,
100-
101-
querier_service:
102-
$.util.serviceFor($.querier_statefulset, $.querier_service_ignored_labels) +
103-
service.mixin.spec.withSelector({ name: 'query-frontend' }),
56+
querier_args+:: $.blocks_metadata_caching_config,
10457

10558
// The ingesters should persist TSDB blocks and WAL on a persistent
10659
// volume in order to be crash resilient.
@@ -218,7 +171,7 @@
218171
$.util.readinessProbe +
219172
$.jaeger_mixin,
220173

221-
store_gateway_statefulset: if !$._config.store_gateway_enabled then {} else
174+
store_gateway_statefulset:
222175
statefulSet.new('store-gateway', 3, [$.store_gateway_container], store_gateway_data_pvc)
223176
.withServiceName('store-gateway') +
224177
statefulSet.mixin.metadata.withNamespace($._config.namespace) +
@@ -229,6 +182,6 @@
229182
statefulSet.mixin.spec.updateStrategy.withType('RollingUpdate') +
230183
statefulSet.mixin.spec.template.spec.withTerminationGracePeriodSeconds(120),
231184

232-
store_gateway_service: if !$._config.store_gateway_enabled then {} else
185+
store_gateway_service:
233186
$.util.serviceFor($.store_gateway_statefulset),
234187
}

0 commit comments

Comments
 (0)