Skip to content

Commit

Permalink
chore: add flag to disable pod constraints to querier configs (backpo…
Browse files Browse the repository at this point in the history
…rt k228) (#14895)

Co-authored-by: Poyzan <[email protected]>
  • Loading branch information
loki-gh-app[bot] and poyzannur authored Nov 13, 2024
1 parent 9c9e941 commit 6cdf15e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions production/ksonnet/loki/config.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
// cores and will result in scheduling delays.
concurrency: 4,

// use_no_constraints is false by default allowing either TopologySpreadConstraints or pod antiAffinity to be configured.
// If no_schedule_constraints is set to true, neither of the pod constraints will be applied.
no_schedule_constraints: false,

// If use_topology_spread is true, queriers can run on nodes already running queriers but will be
// spread through the available nodes using a TopologySpreadConstraints with a max skew
// of topology_spread_max_skew.
Expand Down
5 changes: 4 additions & 1 deletion production/ksonnet/loki/querier.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ local k = import 'ksonnet-util/kausal.libsonnet';
local topologySpreadConstraints = k.core.v1.topologySpreadConstraint,

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


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

0 comments on commit 6cdf15e

Please sign in to comment.