Skip to content

Commit 3fbad51

Browse files
simonkrengeropenshift-cherrypick-robot
authored andcommitted
OCPBUGS-46474:catalog-operator: Delete Pods that were evicted (#3459)
This change adds another reason why a Pod could be detected as "dead", namely when it was evicted by the kubelet. This can happen when there is resource pressure on the Node. Then the reason will be "TerminationByKubelet". This addresses the issue described in https://issues.redhat.com/browse/OCPBUGS-45490 Signed-off-by: Simon Krenger <[email protected]> Upstream-repository: operator-lifecycle-manager Upstream-commit: 8e39847016ba04a4d12599a8d101f4af77c389b5
1 parent cee1f16 commit 3fbad51

File tree

2 files changed

+28
-0
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

+28
-0
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,7 @@ func imageChanged(logger *logrus.Entry, updatePod *corev1.Pod, servingPods []*co
531531
func isPodDead(pod *corev1.Pod) bool {
532532
for _, check := range []func(*corev1.Pod) bool{
533533
isPodDeletedByTaintManager,
534+
isPodTerminatedByKubelet,
534535
} {
535536
if check(pod) {
536537
return true
@@ -551,6 +552,19 @@ func isPodDeletedByTaintManager(pod *corev1.Pod) bool {
551552
return false
552553
}
553554

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+
}
560+
for _, condition := range pod.Status.Conditions {
561+
if condition.Type == corev1.DisruptionTarget && condition.Reason == "TerminationByKubelet" && condition.Status == corev1.ConditionTrue {
562+
return true
563+
}
564+
}
565+
return false
566+
}
567+
554568
// imageID returns the ImageID of the primary catalog source container or an empty string if the image ID isn't available yet.
555569
// Note: the pod must be running and the container in a ready status to return a valid ImageID.
556570
func imageID(pod *corev1.Pod) string {

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

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

0 commit comments

Comments
 (0)