fix: disable Debian disk self-healing

This commit is contained in:
juvenal.diaz 2026-10-27 12:05:48 -06:00
parent 6ec2bca208
commit e0e22308b0
1 changed files with 24 additions and 0 deletions

View File

@ -46,6 +46,17 @@ DISK_SELF_HEAL_ALERTS = {
"FreeDiskSpaceFailed",
}
# Debian is intentionally monitored but excluded from automatic disk cleanup:
# its constrained root/data layout has no safe generic deletion target. Keep
# this list explicit so adding another host cannot accidentally enable cleanup.
DISK_SELF_HEAL_DISABLED_HOSTS = {
item.strip().lower()
for item in os.environ.get(
"LAB_DISK_SELF_HEAL_DISABLED_HOSTS", "debian,debian-lab,debian-2"
).split(",")
if item.strip()
}
def prom_escape(value: object) -> str:
text = str(value)
@ -120,6 +131,19 @@ def disk_self_heal_command(payload: dict[str, Any], names: set[str]) -> list[str
labels_list.append(common_labels)
for labels in labels_list:
host_values = (
labels.get("node"),
labels.get("hostname"),
labels.get("host"),
labels.get("instance"),
)
normalized_hosts = {
str(value).split(":", 1)[0].lower()
for value in host_values
if value
}
if normalized_hosts & DISK_SELF_HEAL_DISABLED_HOSTS:
return None
node = str(labels.get("node") or "")
if re.fullmatch(r"pimox-cp(?:-\d+)?", node):
return ["./jeannie", "workers", "disk-cleanup", "control-plane", "--yes"]