Skip to content

Commit 73104cd

Browse files
authored
Merge pull request grafana/cortex-jsonnet#187 from grafana/flusher-job-blocks
Add flusher job for blocks.
2 parents 4bdfc00 + bdd7a8e commit 73104cd

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed
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)