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

Define ksonnet lib for query scheduler. #4102

Merged
merged 3 commits into from
Aug 10, 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
1 change: 1 addition & 0 deletions production/ksonnet/loki/config.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using_boltdb_shipper: true,

wal_enabled: false,
query_scheduler_enabled: false,

// flags for running ingesters/queriers as a statefulset instead of deployment type.
stateful_ingesters: false,
Expand Down
4 changes: 4 additions & 0 deletions production/ksonnet/loki/loki.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
(import 'query-frontend.libsonnet') +
(import 'ruler.libsonnet') +

// Query scheduler support
// must be mixed in after frontend and querier so it can override their configuration.
(import 'query-scheduler.libsonnet') +

// Supporting services
(import 'memcached.libsonnet') +

Expand Down
51 changes: 51 additions & 0 deletions production/ksonnet/loki/query-scheduler.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@

local k = import 'ksonnet-util/kausal.libsonnet';

{
// Override frontend and querier configuration
_config +:: {
loki+: if $._config.query_scheduler_enabled then {
frontend+: {
scheduler_address: 'query-scheduler.%s.svc.cluster.local:9095' % $._config.namespace,
},
frontend_worker+: {
frontend_address: '',
scheduler_address: 'query-scheduler.%s.svc.cluster.local:9095' % $._config.namespace,
},
} else {},
},

query_scheduler_args:: if $._config.query_scheduler_enabled then
$._config.commonArgs {
target: 'query-scheduler',
'log.level': 'debug',
}
else {},

local container = k.core.v1.container,
query_scheduler_container:: if $._config.query_scheduler_enabled then
container.new('query-scheduler', $._images.query_frontend) +
container.withPorts($.util.defaultPorts) +
container.withArgsMixin(k.util.mapToFlags($.query_scheduler_args)) +
$.jaeger_mixin +
k.util.resourcesRequests('2', '600Mi') +
k.util.resourcesLimits(null, '1200Mi')
else {},

local deployment = k.apps.v1.deployment,
query_scheduler_deployment: if $._config.query_scheduler_enabled then
deployment.new('query-scheduler', 2, [$.query_scheduler_container]) +
$.config_hash_mixin +
k.util.configVolumeMount('loki', '/etc/loki/config') +
k.util.configVolumeMount(
$._config.overrides_configmap_mount_name,
$._config.overrides_configmap_mount_path,
) +
k.util.antiAffinity
else {},

local service = k.core.v1.service,
query_scheduler_service: if $._config.query_scheduler_enabled then
k.util.serviceFor($.query_scheduler_deployment)
else {},
}