Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit 4f603c7

Browse files
authored
Merge pull request #187 from grafana/flusher-job-blocks
Add flusher job for blocks.
2 parents f5104b4 + b98a40c commit 4f603c7

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* [ENHANCEMENT] Add the Ruler to the read resources dashboard #205
1212
* [ENHANCEMENT] Read dashboards now use `cortex_querier_request_duration_seconds` metrics to allow for accurate dashboards when deploying Cortex as a single-binary. #199
1313
* [ENHANCEMENT] Improved Ruler dashboard. Includes information about notifications, reads/writes, and per user per rule group evaluation. #197, #205
14+
* [ENHANCEMENT] Add `flusher-job-blocks.libsonnet` with support for flushing blocks disks. #187
1415
* [ENHANCEMENT] Add more alerts on failure conditions for ingesters when running the blocks storage. #208
1516
* [FEATURE] Latency recording rules for the metric`cortex_querier_request_duration_seconds` are now part of a `cortex_querier_api` rule group. #199
1617
* [FEATURE] Add overrides-exporter as optional deployment to expose configured runtime overrides and presets. #198

cortex/flusher-job-blocks.libsonnet

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
// Usage example:
3+
//
4+
// local flusher_job = import 'cortex/flusher-job-blocks.libsonnet';
5+
//
6+
// flusher_job {
7+
// 'flusher-25': $.flusher_job_func('flusher-25', 'ingester-data-ingester-25'),
8+
// }
9+
//
10+
// Where 'flusher-25' is a job name, and 'ingester-data-ingester-25' is PVC to flush.
11+
12+
local container = $.core.v1.container,
13+
local job = $.batch.v1.job,
14+
local volumeMount = $.core.v1.volumeMount,
15+
local volume = $.core.v1.volume,
16+
17+
flusher_container::
18+
container.new('flusher', $._images.flusher) +
19+
container.withPorts($.util.defaultPorts) +
20+
container.withArgsMixin($.util.mapToFlags($.ingester_args {
21+
target: 'flusher',
22+
'blocks-storage.tsdb.retention-period': '10000h', // don't delete old blocks too soon.
23+
})) +
24+
$.util.resourcesRequests('4', '15Gi') +
25+
$.util.resourcesLimits(null, '25Gi') +
26+
$.util.readinessProbe +
27+
$.jaeger_mixin,
28+
29+
flusher_job_func(jobName, pvcName)::
30+
job.new() +
31+
job.mixin.spec.template.spec.withContainers([
32+
$.flusher_container +
33+
container.withVolumeMountsMixin([
34+
volumeMount.new('flusher-data', '/data'),
35+
]),
36+
]) +
37+
job.mixin.spec.template.spec.withRestartPolicy('Never') +
38+
job.mixin.spec.template.spec.withVolumes([
39+
volume.fromPersistentVolumeClaim('flusher-data', pvcName),
40+
]) +
41+
job.mixin.metadata.withName(jobName) +
42+
job.mixin.metadata.withNamespace($._config.namespace) +
43+
job.mixin.metadata.withLabels({ name: 'flusher' }) +
44+
job.mixin.spec.template.metadata.withLabels({ name: 'flusher' }) +
45+
job.mixin.spec.template.spec.securityContext.withRunAsUser(0) +
46+
job.mixin.spec.template.spec.withTerminationGracePeriodSeconds(300) +
47+
$.util.configVolumeMount('overrides', '/etc/cortex') +
48+
$.util.podPriority('high'),
49+
}

0 commit comments

Comments
 (0)