Skip to content

Commit

Permalink
KUBE-479: Eviction adjustments (#132)
Browse files Browse the repository at this point in the history
* Remove roundTripTime addition to timeout.

* Log addition to better identify steps

* Cancel child contexts for deletion immediately instead of waiting for function to exit

* Remove the PDB path as we decided to keep retrying on PDB errors, add comment about this

* Extract the "batch action" in drainHandler as kubernetes_helper

* Change helper a bit. Replace usage in drain handler.

* Small renames

* Add comment about timeout if we still have pods after all our hard work

* Adjust delete_node_handler.go

* Remove unused error/package

* Adjust drain/delete to return an error when some pods failed so we can distinguish this case and continue

* Add/adjust tests for drain handler

* Make drain handler tests parallel

* Small comment adjustment

* Check for context cancellation before starting wait for termination

* Fix test according to new expectation
  • Loading branch information
Tsonov authored Aug 22, 2024
1 parent ee356b7 commit 39f7e66
Show file tree
Hide file tree
Showing 4 changed files with 464 additions and 158 deletions.
6 changes: 3 additions & 3 deletions actions/delete_node_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ func (h *deleteNodeHandler) Handle(ctx context.Context, action *castai.ClusterAc
return h.deletePod(ctx, *deleteOptions, pod)
}

if err := h.sendPodsRequests(ctx, pods, deletePod); err != nil {
return fmt.Errorf("sending delete pods requests: %w", err)
}
deletedPods, failedPods := executeBatchPodActions(ctx, log, pods, deletePod, "delete-pod")
log.Infof("successfully deleted %d pods, failed to delete %d pods", len(deletedPods), len(failedPods))

if err := h.deleteNodeVolumeAttachments(ctx, req.NodeName); err != nil {
log.Warnf("deleting volume attachments: %v", err)
}
Expand Down
Loading

0 comments on commit 39f7e66

Please sign in to comment.