diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e392cda..e09b24ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ * [ENHANCEMENT] Add the Ruler to the read resources dashboard #205 * [ENHANCEMENT] Read dashboards now use `cortex_querier_request_duration_seconds` metrics to allow for accurate dashboards when deploying Cortex as a single-binary. #199 * [ENHANCEMENT] Improved Ruler dashboard. Includes information about notifications, reads/writes, and per user per rule group evaluation. #197, #205 +* [ENHANCEMENT] Add `flusher-job-blocks.libsonnet` with support for flushing blocks disks. #187 * [ENHANCEMENT] Add more alerts on failure conditions for ingesters when running the blocks storage. #208 * [FEATURE] Latency recording rules for the metric`cortex_querier_request_duration_seconds` are now part of a `cortex_querier_api` rule group. #199 * [FEATURE] Add overrides-exporter as optional deployment to expose configured runtime overrides and presets. #198 diff --git a/cortex/flusher-job-blocks.libsonnet b/cortex/flusher-job-blocks.libsonnet new file mode 100644 index 00000000..7a99b005 --- /dev/null +++ b/cortex/flusher-job-blocks.libsonnet @@ -0,0 +1,49 @@ +{ + // Usage example: + // + // local flusher_job = import 'cortex/flusher-job-blocks.libsonnet'; + // + // flusher_job { + // 'flusher-25': $.flusher_job_func('flusher-25', 'ingester-data-ingester-25'), + // } + // + // Where 'flusher-25' is a job name, and 'ingester-data-ingester-25' is PVC to flush. + + local container = $.core.v1.container, + local job = $.batch.v1.job, + local volumeMount = $.core.v1.volumeMount, + local volume = $.core.v1.volume, + + flusher_container:: + container.new('flusher', $._images.flusher) + + container.withPorts($.util.defaultPorts) + + container.withArgsMixin($.util.mapToFlags($.ingester_args { + target: 'flusher', + 'blocks-storage.tsdb.retention-period': '10000h', // don't delete old blocks too soon. + })) + + $.util.resourcesRequests('4', '15Gi') + + $.util.resourcesLimits(null, '25Gi') + + $.util.readinessProbe + + $.jaeger_mixin, + + flusher_job_func(jobName, pvcName):: + job.new() + + job.mixin.spec.template.spec.withContainers([ + $.flusher_container + + container.withVolumeMountsMixin([ + volumeMount.new('flusher-data', '/data'), + ]), + ]) + + job.mixin.spec.template.spec.withRestartPolicy('Never') + + job.mixin.spec.template.spec.withVolumes([ + volume.fromPersistentVolumeClaim('flusher-data', pvcName), + ]) + + job.mixin.metadata.withName(jobName) + + job.mixin.metadata.withNamespace($._config.namespace) + + job.mixin.metadata.withLabels({ name: 'flusher' }) + + job.mixin.spec.template.metadata.withLabels({ name: 'flusher' }) + + job.mixin.spec.template.spec.securityContext.withRunAsUser(0) + + job.mixin.spec.template.spec.withTerminationGracePeriodSeconds(300) + + $.util.configVolumeMount('overrides', '/etc/cortex') + + $.util.podPriority('high'), +}