Skip to content

Commit 5d11fcb

Browse files
anik120openshift-cherrypick-robot
authored andcommitted
add missing pod disruption reasons to isPodDead (#3519)
isPodDead had checks for TerminationByKubelet and DeletionByTaintManager. It was missing checks for PreemptionByScheduler EvictionByEvictionAPI DeletionByPodGC ref: https://kubernetes.io/docs/concepts/workloads/pods/disruptions/#pod-disruption-conditions This PR adds those reasons. Signed-off-by: Anik Bhattacharjee <[email protected]> Upstream-repository: operator-lifecycle-manager Upstream-commit: 59bfe7f2225dd96ca5690157ebb5d0dc7ac654f9
1 parent 877b6fd commit 5d11fcb

File tree

2 files changed

+8
-58
lines changed
  • staging/operator-lifecycle-manager/pkg/controller/registry/reconciler
  • vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/reconciler

2 files changed

+8
-58
lines changed

staging/operator-lifecycle-manager/pkg/controller/registry/reconciler/grpc.go

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -528,37 +528,12 @@ func imageChanged(logger *logrus.Entry, updatePod *corev1.Pod, servingPods []*co
528528
return false
529529
}
530530

531+
// isPodDead checks if the pod has the DisruptionTarget condition set to true,
532+
// which indicates that the Pod is about to be deleted due to a disruption.
533+
// ref: https://kubernetes.io/docs/concepts/workloads/pods/disruptions/#pod-disruption-conditions
531534
func isPodDead(pod *corev1.Pod) bool {
532-
for _, check := range []func(*corev1.Pod) bool{
533-
isPodDeletedByTaintManager,
534-
isPodTerminatedByKubelet,
535-
} {
536-
if check(pod) {
537-
return true
538-
}
539-
}
540-
return false
541-
}
542-
543-
func isPodDeletedByTaintManager(pod *corev1.Pod) bool {
544-
if pod.DeletionTimestamp == nil {
545-
return false
546-
}
547-
for _, condition := range pod.Status.Conditions {
548-
if condition.Type == corev1.DisruptionTarget && condition.Reason == "DeletionByTaintManager" && condition.Status == corev1.ConditionTrue {
549-
return true
550-
}
551-
}
552-
return false
553-
}
554-
555-
// This reason is set when the Pod was evicted due to resource pressure on the Node
556-
func isPodTerminatedByKubelet(pod *corev1.Pod) bool {
557-
if pod.DeletionTimestamp == nil {
558-
return false
559-
}
560535
for _, condition := range pod.Status.Conditions {
561-
if condition.Type == corev1.DisruptionTarget && condition.Reason == "TerminationByKubelet" && condition.Status == corev1.ConditionTrue {
536+
if condition.Type == corev1.DisruptionTarget && condition.Status == corev1.ConditionTrue {
562537
return true
563538
}
564539
}

vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/reconciler/grpc.go

Lines changed: 4 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)