Skip to content

Commit 32cbf3f

Browse files
Merge pull request #925 from openshift-cherrypick-robot/cherry-pick-922-to-release-4.16
[release-4.16] OCPBUGS-47738:catalog-operator: Delete Pods that were evicted (#3459)
2 parents cee1f16 + 3fbad51 commit 32cbf3f

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)