From 26d10464cbc0e8c5db24414754fd99ac9d7339c5 Mon Sep 17 00:00:00 2001 From: "avi@robusta.dev" Date: Thu, 29 Feb 2024 11:27:03 +0200 Subject: [PATCH] bugfix StatefulsetStatus doesnt have the field unavailableReplicas --- playbooks/robusta_playbooks/pod_investigator_enricher.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/playbooks/robusta_playbooks/pod_investigator_enricher.py b/playbooks/robusta_playbooks/pod_investigator_enricher.py index 79a2eb990..7c3b62329 100755 --- a/playbooks/robusta_playbooks/pod_investigator_enricher.py +++ b/playbooks/robusta_playbooks/pod_investigator_enricher.py @@ -146,9 +146,12 @@ def get_pod_issue_explanation(event: KubernetesResourceEvent, issue: PodIssue, m unavailable_replicas = 0 available_replicas = 0 - if resource.kind in ["Deployment", "StatefulSet"]: + if resource.kind == "Deployment": unavailable_replicas = resource.status.unavailableReplicas if resource.status.unavailableReplicas else 0 available_replicas = resource.status.availableReplicas if resource.status.availableReplicas else 0 + elif resource.kind == "StatefulSet": + available_replicas = resource.status.availableReplicas if resource.status.availableReplicas else 0 + unavailable_replicas = resource.status.replicas - available_replicas elif resource.kind == "DaemonSet": unavailable_replicas = resource.status.numberUnavailable if resource.status.numberUnavailable else 0 available_replicas = resource.status.numberAvailable if resource.status.numberAvailable else 0