Skip to content

Commit 7dee08a

Browse files
poyzannurpaul1r
andauthored
chore: add flag to disable pod constraints to querier configs (#14875)
Co-authored-by: Paul Rogers <129207811+paul1r@users.noreply.github.com>
1 parent b646861 commit 7dee08a

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

‎production/ksonnet/loki/config.libsonnet

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@
5252
// cores and will result in scheduling delays.
5353
concurrency: 4,
5454

55+
// use_no_constraints is false by default allowing either TopologySpreadConstraints or pod antiAffinity to be configured.
56+
// If no_schedule_constraints is set to true, neither of the pod constraints will be applied.
57+
no_schedule_constraints: false,
58+
5559
// If use_topology_spread is true, queriers can run on nodes already running queriers but will be
5660
// spread through the available nodes using a TopologySpreadConstraints with a max skew
5761
// of topology_spread_max_skew.

‎production/ksonnet/loki/querier.libsonnet

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ local k = import 'ksonnet-util/kausal.libsonnet';
2929
local topologySpreadConstraints = k.core.v1.topologySpreadConstraint,
3030

3131
querier_deployment: if !$._config.stateful_queriers then
32+
assert !($._config.querier.no_schedule_constraints && $._config.querier.use_topology_spread) : 'Must configure either no_schedule_constraints or TopologySpreadConstraints, but not both';
3233
deployment.new('querier', 3, [$.querier_container]) +
3334
$.config_hash_mixin +
3435
k.util.configVolumeMount('loki', '/etc/loki/config') +
@@ -38,7 +39,8 @@ local k = import 'ksonnet-util/kausal.libsonnet';
3839
) +
3940
deployment.mixin.spec.strategy.rollingUpdate.withMaxSurge('15%') +
4041
deployment.mixin.spec.strategy.rollingUpdate.withMaxUnavailable('15%') +
41-
if $._config.querier.use_topology_spread then
42+
if $._config.querier.no_schedule_constraints then {}
43+
else if $._config.querier.use_topology_spread then
4244
deployment.spec.template.spec.withTopologySpreadConstraints(
4345
// Evenly spread queriers among available nodes.
4446
topologySpreadConstraints.labelSelector.withMatchLabels({ name: 'querier' }) +
@@ -50,6 +52,7 @@ local k = import 'ksonnet-util/kausal.libsonnet';
5052
k.util.antiAffinity
5153
else {},
5254

55+
5356
// PVC for queriers when running as statefulsets
5457
querier_data_pvc:: if $._config.stateful_queriers then
5558
pvc.new('querier-data') +

0 commit comments

Comments
 (0)