Skip to content

Commit 61ddfd1

Browse files
Improve code readability fix
Signed-off-by: Roelof Kuijpers <[email protected]>
1 parent 1d946b8 commit 61ddfd1

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

pkg/health/health_pod.go

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -122,22 +122,21 @@ func getCorev1PodHealth(pod *corev1.Pod) (*HealthStatus, error) {
122122
Message: pod.Status.Message,
123123
}, nil
124124
}
125-
policy := pod.Spec.RestartPolicy
125+
policy := pod.Spec.RestartPolicy
126126
if _, ok := pod.Annotations[AnnotationIgnoreRestartPolicy]; ok || policy == corev1.RestartPolicyAlways {
127127
return getHealthStatus(pod)
128128
}
129-
130-
if policy == corev1.RestartPolicyOnFailure || policy == corev1.RestartPolicyNever {
131-
// Most pods set with a restart policy of OnFailure or Never, have a finite life.
132-
// These pods are typically resource hooks. Thus, we consider these as Progressing
133-
// instead of healthy. If this is unwanted, e.g., when the pod is managed by an
134-
// operator and therefore has a restart policy of OnFailure or Never, then use the
135-
// the AnnotationIgnoreRestartPolicy annotation.
136-
return &HealthStatus{
137-
Status: HealthStatusProgressing,
138-
Message: pod.Status.Message,
139-
}, nil
140-
}
129+
130+
if policy == corev1.RestartPolicyOnFailure || policy == corev1.RestartPolicyNever {
131+
// Most pods set with a restart policy of OnFailure or Never, have a finite life.
132+
// These pods are typically resource hooks. Thus, we consider these as Progressing
133+
// instead of healthy. If this is unwanted, e.g., when the pod is managed by an
134+
// operator and therefore has a restart policy of OnFailure or Never, then use the
135+
// the AnnotationIgnoreRestartPolicy annotation.
136+
return &HealthStatus{
137+
Status: HealthStatusProgressing,
138+
Message: pod.Status.Message,
139+
}, nil
141140
}
142141
}
143142
return &HealthStatus{

0 commit comments

Comments
 (0)