Skip to content

Commit

Permalink
Add overrides file for our jsonnet library. (#1705)
Browse files Browse the repository at this point in the history
* Add overrides files for our jsonnet library.

This will now automatically load up overrides for tenants if any for each component.

Signed-off-by: Cyril Tovena <[email protected]>

* Add quotes on the tenant example.

Signed-off-by: Cyril Tovena <[email protected]>

* Mount overrides with a different path than the config.

Signed-off-by: Cyril Tovena <[email protected]>
  • Loading branch information
cyriltovena authored Feb 24, 2020
1 parent 9be21a7 commit bac3afe
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 6 deletions.
3 changes: 2 additions & 1 deletion production/ksonnet/loki/config.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@
schema_start_date: '2018-07-11',

commonArgs: {
'config.file': '/etc/loki/config.yaml',
'config.file': '/etc/loki/config/config.yaml',
'limits.per-user-override-config': '/etc/loki/overrides/overrides.yaml',
},

loki: {
Expand Down
3 changes: 2 additions & 1 deletion production/ksonnet/loki/distributor.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
distributor_deployment:
deployment.new('distributor', 3, [$.distributor_container]) +
$.config_hash_mixin +
$.util.configVolumeMount('loki', '/etc/loki') +
$.util.configVolumeMount('loki', '/etc/loki/config') +
$.util.configVolumeMount('overrides', '/etc/loki/overrides') +
$.util.antiAffinity,

distributor_service:
Expand Down
3 changes: 2 additions & 1 deletion production/ksonnet/loki/ingester.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
ingester_deployment:
deployment.new('ingester', 3, [$.ingester_container]) +
$.config_hash_mixin +
$.util.configVolumeMount('loki', '/etc/loki') +
$.util.configVolumeMount('loki', '/etc/loki/config') +
$.util.configVolumeMount('overrides', '/etc/loki/overrides') +
$.util.antiAffinity +
deployment.mixin.spec.withMinReadySeconds(60) +
deployment.mixin.spec.strategy.rollingUpdate.withMaxSurge(0) +
Expand Down
1 change: 1 addition & 0 deletions production/ksonnet/loki/loki.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
(import 'images.libsonnet') +
(import 'common.libsonnet') +
(import 'config.libsonnet') +
(import 'overrides.libsonnet') +
(import 'consul/consul.libsonnet') +

// Loki services
Expand Down
28 changes: 28 additions & 0 deletions production/ksonnet/loki/overrides.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
_config+: {
overrides: {
// insert tenant overrides here. see https://github.com/grafana/loki/tree/master/docs/configuration#limits_config
//
// 'tenant_x': {
// ingestion_rate_strategy: 'global',
// ingestion_rate_mb: 12,
// ingestion_burst_size_mb: 20,
// max_line_size: 2048,
// split_queries_by_interval: '30m',
// max_concurrent_tail_requests: 10,
// max_query_parallelism: 32,
// },
},
},
local configMap = $.core.v1.configMap,

overrides_config:
configMap.new('overrides') +
configMap.withData({
'overrides.yaml': $.util.manifestYaml(
{
overrides: $._config.overrides,
}
),
}),
}
3 changes: 2 additions & 1 deletion production/ksonnet/loki/querier.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
querier_deployment:
deployment.new('querier', 3, [$.querier_container]) +
$.config_hash_mixin +
$.util.configVolumeMount('loki', '/etc/loki') +
$.util.configVolumeMount('loki', '/etc/loki/config') +
$.util.configVolumeMount('overrides', '/etc/loki/overrides') +
$.util.antiAffinity,

querier_service:
Expand Down
3 changes: 2 additions & 1 deletion production/ksonnet/loki/query-frontend.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
query_frontend_deployment:
deployment.new('query-frontend', 2, [$.query_frontend_container]) +
$.config_hash_mixin +
$.util.configVolumeMount('loki', '/etc/loki') +
$.util.configVolumeMount('loki', '/etc/loki/config') +
$.util.configVolumeMount('overrides', '/etc/loki/overrides') +
$.util.antiAffinity,

local service = $.core.v1.service,
Expand Down
2 changes: 1 addition & 1 deletion production/ksonnet/loki/table-manager.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
table_manager_deployment:
deployment.new('table-manager', 1, [$.table_manager_container]) +
$.config_hash_mixin +
$.util.configVolumeMount('loki', '/etc/loki'),
$.util.configVolumeMount('loki', '/etc/loki/config'),

table_manager_service:
$.util.serviceFor($.table_manager_deployment),
Expand Down

0 comments on commit bac3afe

Please sign in to comment.