From c5b0192337e7ee10d20c43f785702a434fa6a09f Mon Sep 17 00:00:00 2001 From: Goutham Veeramachaneni Date: Mon, 11 Jan 2021 19:25:47 +0100 Subject: [PATCH] Add option to customise the configmap name Signed-off-by: Goutham Veeramachaneni --- CHANGELOG.md | 1 + cortex/config.libsonnet | 4 +++- cortex/distributor.libsonnet | 2 +- cortex/flusher-job-blocks.libsonnet | 2 +- cortex/flusher-job.libsonnet | 2 +- cortex/ingester.libsonnet | 4 ++-- cortex/overrides-exporter.libsonnet | 2 +- cortex/querier.libsonnet | 2 +- cortex/query-frontend.libsonnet | 2 +- cortex/ruler.libsonnet | 2 +- cortex/tsdb.libsonnet | 4 ++-- 11 files changed, 15 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3645f804..8738522e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * [ENHANCEMENT] Improved blocks storage observability: #237 - Cortex / Queries: added bucket index load operations and latency (available only when bucket index is enabled) - Alerts: added "CortexBucketIndexNotUpdated" (bucket index only) and "CortexTenantHasPartialBlocks" +* [ENHANCEMENT] The name of the overrides configmap is now customisable via `$._config.overrides_configmap`. #244 * [BUGFIX] Honor configured `per_instance_label` in all panels. #239 * [BUGFIX] `CortexRequestLatency` alert now ignores long-running requests on query-scheduler. #242 diff --git a/cortex/config.libsonnet b/cortex/config.libsonnet index 5550077f..6a20ddfe 100644 --- a/cortex/config.libsonnet +++ b/cortex/config.libsonnet @@ -290,6 +290,8 @@ // These are the defaults. limits: $._config.overrides.extra_small_user, + overrides_configmap: 'overrides', + overrides: { extra_small_user:: { max_series_per_user: 0, // Disabled in favour of the max global limit @@ -415,7 +417,7 @@ local configMap = $.core.v1.configMap, overrides_config: - configMap.new('overrides') + + configMap.new($._config.overrides_configmap) + configMap.withData({ 'overrides.yaml': $.util.manifestYaml( { diff --git a/cortex/distributor.libsonnet b/cortex/distributor.libsonnet index 8d0e33ca..19f66d8f 100644 --- a/cortex/distributor.libsonnet +++ b/cortex/distributor.libsonnet @@ -60,7 +60,7 @@ distributor_deployment: deployment.new('distributor', 3, [$.distributor_container], $.distributor_deployment_labels) + $.util.antiAffinity + - $.util.configVolumeMount('overrides', '/etc/cortex'), + $.util.configVolumeMount($._config.overrides_configmap, '/etc/cortex'), local service = $.core.v1.service, diff --git a/cortex/flusher-job-blocks.libsonnet b/cortex/flusher-job-blocks.libsonnet index 7a99b005..1e6266ca 100644 --- a/cortex/flusher-job-blocks.libsonnet +++ b/cortex/flusher-job-blocks.libsonnet @@ -44,6 +44,6 @@ job.mixin.spec.template.metadata.withLabels({ name: 'flusher' }) + job.mixin.spec.template.spec.securityContext.withRunAsUser(0) + job.mixin.spec.template.spec.withTerminationGracePeriodSeconds(300) + - $.util.configVolumeMount('overrides', '/etc/cortex') + + $.util.configVolumeMount($._config.overrides_configmap, '/etc/cortex') + $.util.podPriority('high'), } diff --git a/cortex/flusher-job.libsonnet b/cortex/flusher-job.libsonnet index 78eadeb7..4d9a5762 100644 --- a/cortex/flusher-job.libsonnet +++ b/cortex/flusher-job.libsonnet @@ -46,6 +46,6 @@ job.mixin.spec.template.metadata.withLabels({ name: 'flusher' }) + job.mixin.spec.template.spec.securityContext.withRunAsUser(0) + job.mixin.spec.template.spec.withTerminationGracePeriodSeconds(300) + - $.util.configVolumeMount('overrides', '/etc/cortex') + + $.util.configVolumeMount($._config.overrides_configmap, '/etc/cortex') + $.util.podPriority('high'), } diff --git a/cortex/ingester.libsonnet b/cortex/ingester.libsonnet index 161fe38a..a0b6ac7d 100644 --- a/cortex/ingester.libsonnet +++ b/cortex/ingester.libsonnet @@ -106,7 +106,7 @@ statefulSet.mixin.spec.template.spec.withTerminationGracePeriodSeconds(4800) + statefulSet.mixin.spec.updateStrategy.withType('RollingUpdate') + $.statefulset_storage_config_mixin + - $.util.configVolumeMount('overrides', '/etc/cortex') + + $.util.configVolumeMount($._config.overrides_configmap, '/etc/cortex') + $.util.podPriority('high') + $.util.antiAffinityStatefulSet else null, @@ -117,7 +117,7 @@ if $._config.ingester_deployment_without_wal then deployment.new(name, 3, [$.ingester_container], $.ingester_deployment_labels) + $.util.antiAffinity + - $.util.configVolumeMount('overrides', '/etc/cortex') + + $.util.configVolumeMount($._config.overrides_configmap, '/etc/cortex') + deployment.mixin.metadata.withLabels({ name: name }) + deployment.mixin.spec.withMinReadySeconds(60) + deployment.mixin.spec.strategy.rollingUpdate.withMaxSurge(0) + diff --git a/cortex/overrides-exporter.libsonnet b/cortex/overrides-exporter.libsonnet index 671d5d26..d8eb411a 100644 --- a/cortex/overrides-exporter.libsonnet +++ b/cortex/overrides-exporter.libsonnet @@ -58,7 +58,7 @@ local deployment = $.apps.v1.deployment, overrides_exporter_deployment: deployment.new(name, 1, [$.overrides_exporter_container], { name: name }) + - $.util.configVolumeMount('overrides', '/etc/cortex') + + $.util.configVolumeMount($._config.overrides_configmap, '/etc/cortex') + $.util.configVolumeMount('overrides-presets', '/etc/cortex_presets') + deployment.mixin.metadata.withLabels({ name: name }), diff --git a/cortex/querier.libsonnet b/cortex/querier.libsonnet index fceee38a..0f92b803 100644 --- a/cortex/querier.libsonnet +++ b/cortex/querier.libsonnet @@ -56,7 +56,7 @@ querier_deployment: deployment.new('querier', $._config.querier.replicas, [$.querier_container], $.querier_deployment_labels) + $.util.antiAffinity + - $.util.configVolumeMount('overrides', '/etc/cortex') + + $.util.configVolumeMount($._config.overrides_configmap, '/etc/cortex') + $.storage_config_mixin, local service = $.core.v1.service, diff --git a/cortex/query-frontend.libsonnet b/cortex/query-frontend.libsonnet index b306b23d..3386a312 100644 --- a/cortex/query-frontend.libsonnet +++ b/cortex/query-frontend.libsonnet @@ -70,7 +70,7 @@ query_frontend_deployment: deployment.new('query-frontend', $._config.queryFrontend.replicas, [$.query_frontend_container]) + - $.util.configVolumeMount('overrides', '/etc/cortex') + + $.util.configVolumeMount($._config.overrides_configmap, '/etc/cortex') + $.util.antiAffinity + // inject storage schema in order to know what/how to shard if $._config.queryFrontend.sharded_queries_enabled then diff --git a/cortex/ruler.libsonnet b/cortex/ruler.libsonnet index c342586f..81412899 100644 --- a/cortex/ruler.libsonnet +++ b/cortex/ruler.libsonnet @@ -45,7 +45,7 @@ deployment.mixin.spec.strategy.rollingUpdate.withMaxUnavailable(1) + deployment.mixin.spec.template.spec.withTerminationGracePeriodSeconds(600) + $.util.antiAffinity + - $.util.configVolumeMount('overrides', '/etc/cortex') + + $.util.configVolumeMount($._config.overrides_configmap, '/etc/cortex') + $.storage_config_mixin else {}, diff --git a/cortex/tsdb.libsonnet b/cortex/tsdb.libsonnet index 054a30e5..eb43f885 100644 --- a/cortex/tsdb.libsonnet +++ b/cortex/tsdb.libsonnet @@ -99,7 +99,7 @@ // For this reason, we grant an high termination period (80 minutes). statefulSet.mixin.spec.template.spec.withTerminationGracePeriodSeconds(4800) + statefulSet.mixin.spec.updateStrategy.withType('RollingUpdate') + - $.util.configVolumeMount('overrides', '/etc/cortex') + + $.util.configVolumeMount($._config.overrides_configmap, '/etc/cortex') + $.util.podPriority('high') + $.util.antiAffinity + // Parallelly scale up/down ingester instances instead of starting them @@ -218,7 +218,7 @@ // rolled out one by one (the next pod will be rolled out once the previous is // ready). statefulSet.mixin.spec.withPodManagementPolicy('Parallel') + - $.util.configVolumeMount('overrides', '/etc/cortex'), + $.util.configVolumeMount($._config.overrides_configmap, '/etc/cortex'), store_gateway_service: $.util.serviceFor($.store_gateway_statefulset),