Skip to content

Commit

Permalink
Add options to disable anti-affinity
Browse files Browse the repository at this point in the history
Signed-off-by: Marco Pracucci <[email protected]>
  • Loading branch information
pracucci committed Nov 17, 2021
1 parent 248eb8c commit 7af10f1
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@
* [ENHANCEMENT] Use alertmanager jobname for alertmanager dashboard panels #411
* [ENHANCEMENT] Added `CortexDistributorReachingInflightPushRequestLimit` alert. #408
* [ENHANCEMENT] Define Azure object storage ruler args. #416
* [ENHANCEMENT] Added the following config options to allow to schedule multiple replicas of the same service on the same node: #418
* `cortex_distributor_allow_multiple_replicas_on_same_node`
* `cortex_ruler_allow_multiple_replicas_on_same_node`
* `cortex_querier_allow_multiple_replicas_on_same_node`
* `cortex_query_frontend_allow_multiple_replicas_on_same_node`
* [BUGFIX] Fixed `CortexIngesterHasNotShippedBlocks` alert false positive in case an ingester instance had ingested samples in the past, then no traffic was received for a long period and then it started receiving samples again. #308
* [BUGFIX] Alertmanager: fixed `--alertmanager.cluster.peers` CLI flag passed to alertmanager when HA is enabled. #329
* [BUGFIX] Fixed `CortexInconsistentRuntimeConfig` metric. #335
Expand Down
6 changes: 6 additions & 0 deletions cortex/config.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
// 2. Ensure ingester ID is preserved during rollouts
unregister_ingesters_on_shutdown: true,

// Controls whether multiple pods for the same service can be scheduled on the same node.
cortex_distributor_allow_multiple_replicas_on_same_node: false,
cortex_ruler_allow_multiple_replicas_on_same_node: false,
cortex_querier_allow_multiple_replicas_on_same_node: false,
cortex_query_frontend_allow_multiple_replicas_on_same_node: false,

// schema is used to generate the storage schema yaml file used by
// the Cortex chunks storage:
// - More information: https://github.com/cortexproject/cortex/pull/1072
Expand Down
2 changes: 1 addition & 1 deletion cortex/distributor.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

distributor_deployment:
deployment.new('distributor', 3, [$.distributor_container], $.distributor_deployment_labels) +
$.util.antiAffinity +
(if $._config.cortex_distributor_allow_multiple_replicas_on_same_node then {} else $.util.antiAffinity) +
$.util.configVolumeMount($._config.overrides_configmap, '/etc/cortex'),

local service = $.core.v1.service,
Expand Down
2 changes: 1 addition & 1 deletion cortex/querier.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

newQuerierDeployment(name, container)::
deployment.new(name, $._config.querier.replicas, [container], $.querier_deployment_labels) +
$.util.antiAffinity +
(if $._config.cortex_querier_allow_multiple_replicas_on_same_node then {} else $.util.antiAffinity) +
$.util.configVolumeMount($._config.overrides_configmap, '/etc/cortex') +
$.storage_config_mixin,

Expand Down
2 changes: 1 addition & 1 deletion cortex/query-frontend.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
newQueryFrontendDeployment(name, container)::
deployment.new(name, $._config.queryFrontend.replicas, [container]) +
$.util.configVolumeMount($._config.overrides_configmap, '/etc/cortex') +
$.util.antiAffinity,
(if $._config.cortex_query_frontend_allow_multiple_replicas_on_same_node then {} else $.util.antiAffinity),

query_frontend_deployment: self.newQueryFrontendDeployment('query-frontend', $.query_frontend_container),

Expand Down
2 changes: 1 addition & 1 deletion cortex/ruler.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
deployment.mixin.spec.strategy.rollingUpdate.withMaxSurge(0) +
deployment.mixin.spec.strategy.rollingUpdate.withMaxUnavailable(1) +
deployment.mixin.spec.template.spec.withTerminationGracePeriodSeconds(600) +
$.util.antiAffinity +
(if $._config.cortex_ruler_allow_multiple_replicas_on_same_node then {} else $.util.antiAffinity) +
$.util.configVolumeMount($._config.overrides_configmap, '/etc/cortex') +
$.storage_config_mixin
else {},
Expand Down

0 comments on commit 7af10f1

Please sign in to comment.