chore: add flag to disable pod constraints to querier configs (#14875)

Co-authored-by: Paul Rogers <129207811+paul1r@users.noreply.github.com>
pull/14890/head
Poyzan 6 months ago committed by GitHub
parent b646861e77
commit 7dee08ae72
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      production/ksonnet/loki/config.libsonnet
  2. 5
      production/ksonnet/loki/querier.libsonnet

@ -52,6 +52,10 @@
// cores and will result in scheduling delays. // cores and will result in scheduling delays.
concurrency: 4, 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 // 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 // spread through the available nodes using a TopologySpreadConstraints with a max skew
// of topology_spread_max_skew. // of topology_spread_max_skew.

@ -29,6 +29,7 @@ local k = import 'ksonnet-util/kausal.libsonnet';
local topologySpreadConstraints = k.core.v1.topologySpreadConstraint, local topologySpreadConstraints = k.core.v1.topologySpreadConstraint,
querier_deployment: if !$._config.stateful_queriers then 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]) + deployment.new('querier', 3, [$.querier_container]) +
$.config_hash_mixin + $.config_hash_mixin +
k.util.configVolumeMount('loki', '/etc/loki/config') + k.util.configVolumeMount('loki', '/etc/loki/config') +
@ -38,7 +39,8 @@ local k = import 'ksonnet-util/kausal.libsonnet';
) + ) +
deployment.mixin.spec.strategy.rollingUpdate.withMaxSurge('15%') + deployment.mixin.spec.strategy.rollingUpdate.withMaxSurge('15%') +
deployment.mixin.spec.strategy.rollingUpdate.withMaxUnavailable('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( deployment.spec.template.spec.withTopologySpreadConstraints(
// Evenly spread queriers among available nodes. // Evenly spread queriers among available nodes.
topologySpreadConstraints.labelSelector.withMatchLabels({ name: 'querier' }) + topologySpreadConstraints.labelSelector.withMatchLabels({ name: 'querier' }) +
@ -50,6 +52,7 @@ local k = import 'ksonnet-util/kausal.libsonnet';
k.util.antiAffinity k.util.antiAffinity
else {}, else {},
// PVC for queriers when running as statefulsets // PVC for queriers when running as statefulsets
querier_data_pvc:: if $._config.stateful_queriers then querier_data_pvc:: if $._config.stateful_queriers then
pvc.new('querier-data') + pvc.new('querier-data') +

Loading…
Cancel
Save