Skip to content

Commit 1c9a596

Browse files
authored
Skip static pods during eviction loop (#6)
1 parent 19830d6 commit 1c9a596

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

pkg/handler/handler.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,9 @@ func (h *Handler) GetPodsForNode(node v1.Node) ([]v1.Pod, error) {
280280
continue
281281
}
282282

283-
// skip pods with DaemonSet controller object
284-
if len(pod.OwnerReferences) > 0 && pod.ObjectMeta.OwnerReferences[0].Kind == "DaemonSet" {
285-
h.logger.Debugf("Skipping %s as it is part of a DaemonSet", pod.Name)
283+
// skip pods with DaemonSet controller object or static pods
284+
if len(pod.OwnerReferences) > 0 && slices.Contains([]string{"DaemonSet", "Node"}, pod.ObjectMeta.OwnerReferences[0].Kind) {
285+
h.logger.Debugf("Skipping %s as it is part of a DaemonSet or is a static pod", pod.Name)
286286
continue
287287
}
288288

@@ -356,6 +356,10 @@ func (h *Handler) getControllerObject(pod v1.Pod) (*controllerObject, error) {
356356
h.logger.Warnf("DaemonSets are not covered")
357357
return newControllerObject("DaemonSet", "", "", nil), nil
358358

359+
case "Node":
360+
h.logger.Warnf("Static pods are not covered")
361+
return newControllerObject("StaticPod", "", "", nil), nil
362+
359363
case "StatefulSet":
360364
sts, err := h.appContext.K8sClient.AppsV1().StatefulSets(pod.Namespace).Get(h.appContext.Context, pod.OwnerReferences[0].Name, metav1.GetOptions{})
361365
if err != nil {

0 commit comments

Comments
 (0)