• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

kubernetes-sigs / karpenter / 30001588366

23 Jul 2026 11:01AM UTC coverage: 82.448% (+0.01%) from 82.435%
30001588366

Pull #3168

github

maks3201
fix: respect pod terminationGracePeriodSeconds when waiting after drain

MinDrainTime (5s) is used as the minimum wait between all pods being
evicted (deletionTimestamp set) and calling cloudProvider.Delete().
However, IsWaitingEviction() is a pure etcd/API check - it returns
false as soon as eviction is accepted, while the kubelet may still be
running the preStop hook for the pod's full terminationGracePeriodSeconds.

With the default tgps of 30s, Karpenter was calling EC2 TerminateInstances
~25s before preStop hooks could complete, causing:
  FailedPreStopHook
  FailedKillPod: ttrpc: closed

Fix: compute effectiveDrainTime as max(MinDrainTime, maxTGPS) across
pods still present on the node with deletionTimestamp set. MinDrainTime
is retained as the floor to preserve the original behavior of catching
late-scheduled pods.

Fixes: #1894
Pull Request #3168: fix: respect pod terminationGracePeriodSeconds when waiting after drain

14 of 16 new or added lines in 1 file covered. (87.5%)

37 existing lines in 1 file now uncovered.

16582 of 20112 relevant lines covered (82.45%)

97538.1 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

77.32
/pkg/controllers/node/termination/controller.go


Build SHA Not Found

The commit SHA "9fdb14c4543c9bbc986a75175d5d486f5ec6da08" was not found in your repository, so the file cannot be loaded. This may be because you posted from a local development environment, or your CI created an ephemeral commit.

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc