Skip to content

OCPBUGS-45490: catalog-operator: Delete Pods that were evicted #3459

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions pkg/controller/registry/reconciler/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ func imageChanged(logger *logrus.Entry, updatePod *corev1.Pod, servingPods []*co
func isPodDead(pod *corev1.Pod) bool {
for _, check := range []func(*corev1.Pod) bool{
isPodDeletedByTaintManager,
isPodTerminatedByKubelet,
} {
if check(pod) {
return true
Expand All @@ -551,6 +552,19 @@ func isPodDeletedByTaintManager(pod *corev1.Pod) bool {
return false
}

// This reason is set when the Pod was evicted due to resource pressure on the Node
func isPodTerminatedByKubelet(pod *corev1.Pod) bool {
if pod.DeletionTimestamp == nil {
return false
}
for _, condition := range pod.Status.Conditions {
if condition.Type == corev1.DisruptionTarget && condition.Reason == "TerminationByKubelet" && condition.Status == corev1.ConditionTrue {
return true
}
}
return false
}

// imageID returns the ImageID of the primary catalog source container or an empty string if the image ID isn't available yet.
// Note: the pod must be running and the container in a ready status to return a valid ImageID.
func imageID(pod *corev1.Pod) string {
Expand Down
Loading