From a6a0027a3cd3da380479642debb202f2722710ee Mon Sep 17 00:00:00 2001 From: Kemal Akkoyun Date: Tue, 1 Sep 2020 18:43:47 +0300 Subject: [PATCH] querier: Add lookback delta for querier (#145) * Add lookback delta for querier Signed-off-by: Kemal Akkoyun * Add changelog entry Signed-off-by: Kemal Akkoyun --- CHANGELOG.md | 1 + all.jsonnet | 2 ++ .../manifests/thanos-query-deployment.yaml | 1 + .../kube-thanos/kube-thanos-query.libsonnet | 24 +++++++++++++++++++ 4 files changed, 28 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 62bc6e4b..717331ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ We use *breaking* word for marking changes that are not backward compatible (rel ### Added - [#142](https://github.com/thanos-io/kube-thanos/pull/142) query-frontend: Add thanos query frontend component. +- [#145](https://github.com/thanos-io/kube-thanos/pull/145) querier: Add a new mixin to specify `--query.lookback-delta` flag. ### Fixed diff --git a/all.jsonnet b/all.jsonnet index 706a989b..273e22e1 100644 --- a/all.jsonnet +++ b/all.jsonnet @@ -103,6 +103,7 @@ local q = t.query + t.query.withServiceMonitor + t.query.withQueryTimeout + + t.query.withLookbackDelta + commonConfig + { config+:: { name: 'thanos-query', @@ -113,6 +114,7 @@ local q = ], replicaLabels: ['prometheus_replica', 'rule_replica'], queryTimeout: '5m', + lookbackDelta: '15m', }, }; diff --git a/examples/all/manifests/thanos-query-deployment.yaml b/examples/all/manifests/thanos-query-deployment.yaml index 0e1cff95..77564c49 100644 --- a/examples/all/manifests/thanos-query-deployment.yaml +++ b/examples/all/manifests/thanos-query-deployment.yaml @@ -49,6 +49,7 @@ spec: - --store=dnssrv+_grpc._tcp.thanos-rule.thanos.svc.cluster.local - --store=dnssrv+_grpc._tcp.thanos-store.thanos.svc.cluster.local - --query.timeout=5m + - --query.lookback-delta=15m image: quay.io/thanos/thanos:master-2020-08-11-2ea2c2b7 livenessProbe: failureThreshold: 4 diff --git a/jsonnet/kube-thanos/kube-thanos-query.libsonnet b/jsonnet/kube-thanos/kube-thanos-query.libsonnet index 3866d996..d3232bc3 100644 --- a/jsonnet/kube-thanos/kube-thanos-query.libsonnet +++ b/jsonnet/kube-thanos/kube-thanos-query.libsonnet @@ -195,4 +195,28 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet'; }, }, }, + + withLookbackDelta:: { + local tq = self, + config+:: { + lookbackDelta: error 'must provide lookbackDelta', + }, + + deployment+: { + spec+: { + template+: { + spec+: { + containers: [ + if c.name == 'thanos-query' then c { + args+: [ + '--query.lookback-delta=' + tq.config.lookbackDelta, + ], + } else c + for c in super.containers + ], + }, + }, + }, + }, + }, }