--- Exec[orchestrated restart needed].orig
+++ Exec[orchestrated restart needed]
+ command => /bin/sh -c 'cmp -s "/etc/thanos-compact/relabel.yaml" "/etc/thanos-compact/relabel.yaml.unreferenced" || (echo "Please run the sre.o11y.thanos-compact-restart cookbook" >&2; exit 1)'
+ path => ['/bin', '/usr/bin']
+ require => ['File[/etc/thanos-compact/relabel.yaml.unreferenced]', 'File[/etc/thanos-compact/objstore.yaml]']
File[/etc/thanos-compact/relabel.yaml.unreferenced]
- Parameters differences:
--- File[/etc/thanos-compact/relabel.yaml.unreferenced].orig
+++ File[/etc/thanos-compact/relabel.yaml.unreferenced]
+ group => root
+ owner => thanos
+ mode => 0550
+ ensure => file
- Content differences:
--- /etc/thanos-compact/relabel.yaml.unreferenced.orig
+++ /etc/thanos-compact/relabel.yaml.unreferenced
@@ -0,0 +1,26 @@
+# Note: "a^" is a regex that matches nothing,
+# as "a" cannot be followed by the start of the string "^".
+#
+# regex: "^(a^|)$"
+# Used by "ruler blocks designated compactor" when there are no owned instances,
+# to match only Thanos Ruler generated blocks (i.e: without the prometheus label).
+#
+# regex: "^(a^)$"
+# Used by non "ruler blocks designated compactor" when there are no owned instances,
+# to match nothing, as the compactor should not receive any blocks.
+#
+# regex: "^(instance_1|instance_2|...|)$"
+# Used by "ruler blocks designated compactor" when there are owned instances.
+# The regex matches both the owned instances and Thanos Ruler generated blocks,
+# as the compactor needs to receive all blocks to be able to compact them.
+#
+# regex: "^(instance_1|instance_2|...)$"
+# Used by non "ruler blocks designated compactor" when there are owned instances.
+# The regex matches only the owned instances, as the compactor should not receive
+# Thanos Ruler generated blocks.
+
+- action: keep
+ source_labels:
+ - prometheus
+ regex: "^(a^|)$"
+
- Class[Thanos::Compact]
- Parameters differences:
--- Class[Thanos::Compact].orig
+++ Class[Thanos::Compact]
- run_on_host => titan2001.codfw.wmnet
- Systemd::Unit[thanos-compact]
- Class[Profile::Thanos::Compact]
- Parameters differences:
--- Class[Profile::Thanos::Compact].orig
+++ Class[Profile::Thanos::Compact]
- thanos_compact_host => titan2001.codfw.wmnet
- Systemd::Service[thanos-compact]
- File[/etc/systemd/system/thanos-compact.service.d/puppet-override.conf]
- Content differences:
--- /etc/systemd/system/thanos-compact.service.d/puppet-override.conf.orig
+++ /etc/systemd/system/thanos-compact.service.d/puppet-override.conf
@@ -1,7 +1,15 @@
[Service]
+
+# Local restart is blocked if a new relabel-config-file is pending deployment via the cookbook.
+# In this case, the restart must be performed using the sre.o11y.thanos-compact-restart cookbook.
+
Slice=thanos.slice
# force sigkill due to https://github.com/thanos-io/thanos/issues/6398
SendSIGKILL=yes
+ExecReload=
+ExecReload=/bin/bash -c "/usr/bin/cmp -s /etc/thanos-compact/relabel.yaml.unreferenced /etc/thanos-compact/relabel.yaml && /bin/kill -HUP $MAINPID || (echo 'New relabel config file pending deployment. Restart must be performed using the sre.o11y.thanos-compact-restart cookbook.'; exit 1)"
+ExecStartPre=
+ExecStartPre=/bin/bash -c "/usr/bin/cmp -s /etc/thanos-compact/relabel.yaml.unreferenced /etc/thanos-compact/relabel.yaml || (echo 'New relabel config file pending deployment. Restart must be performed using the sre.o11y.thanos-compact-restart cookbook.'; exit 1)"
ExecStart=
ExecStart=/usr/bin/thanos compact \
--http-address 0.0.0.0:12902 \
@@ -15,4 +23,5 @@
--compact.concurrency 2 \
--downsample.concurrency 2 \
--block-meta-fetch-concurrency 96 \
+ --selector.relabel-config-file /etc/thanos-compact/relabel.yaml \
--wait
Relevant files