Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add options to disable anti-affinity #418

Merged
merged 1 commit into from
Nov 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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