Skip to content

Commit 6d34137

Browse files
simonkrengerci-robot
authored andcommitted
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 826c3de commit 6d34137

File tree

3 files changed

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

3 files changed

+29
-1
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.

vendor/modules.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ github.com/operator-framework/api/pkg/validation/errors
631631
github.com/operator-framework/api/pkg/validation/interfaces
632632
github.com/operator-framework/api/pkg/validation/internal
633633
# github.com/operator-framework/operator-lifecycle-manager v0.0.0-00010101000000-000000000000 => ./staging/operator-lifecycle-manager
634-
## explicit; go 1.22.5
634+
## explicit; go 1.22.6
635635
github.com/operator-framework/operator-lifecycle-manager/cmd/catalog
636636
github.com/operator-framework/operator-lifecycle-manager/cmd/copy-content
637637
github.com/operator-framework/operator-lifecycle-manager/cmd/olm

0 commit comments

Comments
 (0)