Skip to content

[CASCL-1386] (8/11) Add node drain primitives and evict ASG nodes#3175

Draft
L3n41c wants to merge 1 commit into
lenaic/CASCL-1386-evict-07-eks-mngfrom
lenaic/CASCL-1386-evict-08-drain-and-asg
Draft

[CASCL-1386] (8/11) Add node drain primitives and evict ASG nodes#3175
L3n41c wants to merge 1 commit into
lenaic/CASCL-1386-evict-07-eks-mngfrom
lenaic/CASCL-1386-evict-08-drain-and-asg

Conversation

@L3n41c

@L3n41c L3n41c commented Jun 18, 2026

Copy link
Copy Markdown
Member

What does this PR do?

Introduces the shared node-drain primitives — node cordoning (cordonNodes), pod eviction/draining (drainNode) and the pod-eligibility predicates (shouldSkipEviction …) — together with their first consumer, ASG eviction (cordon, drain, terminate the instances, lock the ASG to 0).

Motivation

PR #3026 is too large to review as a single change. This is part 8 of 11 of a stack that splits it into small, individually-reviewable pieces that each build and pass tests on their own. See #3026 for the full feature context and end-to-end QA.

Additional Notes

Stacked PR — the base branch is lenaic/CASCL-1386-evict-07-eks-mng, not main, so the diff shows only this step's change. The drain primitives are bundled with the ASG evictor on purpose: golangci-lint's unused linter rejects an unexported helper that has no caller in the same commit, so the primitives land in the same PR as the first evictor that calls them. Parts 9–10 reuse them. The code is taken verbatim from #3026 (rebased onto main); there are no logic changes versus #3026.

Minimum Agent Versions

N/A — kubectl-datadog plugin only.

Describe your test plan

go test ./cmd/kubectl-datadog/autoscaling/cluster/... passes at this commit. Full end-to-end QA is tracked on #3026.

Checklist

@codecov-commenter

codecov-commenter commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.69697% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 44.36%. Comparing base (f9c10d1) to head (0b04574).

Files with missing lines Patch % Lines
...tl-datadog/autoscaling/cluster/evict/evict_pods.go 78.94% 11 Missing and 5 partials ⚠️
...ubectl-datadog/autoscaling/cluster/evict/cordon.go 96.42% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@                          Coverage Diff                           @@
##           lenaic/CASCL-1386-evict-07-eks-mng    #3175      +/-   ##
======================================================================
+ Coverage                               44.11%   44.36%   +0.24%     
======================================================================
  Files                                     389      391       +2     
  Lines                                   31119    31283     +164     
======================================================================
+ Hits                                    13729    13878     +149     
- Misses                                  16498    16508      +10     
- Partials                                  892      897       +5     
Flag Coverage Δ
unittests 44.36% <89.69%> (+0.24%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...d/kubectl-datadog/autoscaling/cluster/evict/asg.go 100.00% <100.00%> (+100.00%) ⬆️
...ubectl-datadog/autoscaling/cluster/evict/cordon.go 96.42% <96.42%> (ø)
...tl-datadog/autoscaling/cluster/evict/evict_pods.go 78.94% <78.94%> (ø)

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f9c10d1...0b04574. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@datadog-datadog-prod-us1-2

This comment has been minimized.

@L3n41c L3n41c force-pushed the lenaic/CASCL-1386-evict-08-drain-and-asg branch from 22c07f1 to 5bad6e2 Compare June 19, 2026 14:21
@L3n41c L3n41c force-pushed the lenaic/CASCL-1386-evict-07-eks-mng branch from c0c8b6a to 9250b71 Compare June 19, 2026 14:21
@L3n41c L3n41c force-pushed the lenaic/CASCL-1386-evict-08-drain-and-asg branch from 5bad6e2 to e2962ee Compare June 19, 2026 14:45
@L3n41c L3n41c force-pushed the lenaic/CASCL-1386-evict-07-eks-mng branch from 9250b71 to f9c10d1 Compare June 22, 2026 13:24
@L3n41c L3n41c force-pushed the lenaic/CASCL-1386-evict-08-drain-and-asg branch from e2962ee to 0b04574 Compare June 22, 2026 13:25
Part of a stack splitting #3026 (too large to review in one piece) into
small pieces that each build and pass tests on their own. The command is
fully functional only once the whole stack lands.
@L3n41c L3n41c force-pushed the lenaic/CASCL-1386-evict-07-eks-mng branch from f9c10d1 to 8e43ad1 Compare June 23, 2026 08:49
@L3n41c L3n41c force-pushed the lenaic/CASCL-1386-evict-08-drain-and-asg branch from 0b04574 to 1e9f157 Compare June 23, 2026 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants