Skip to content

Conversation

@ryan-mist
Copy link
Contributor

Fixes #N/A

Description

  • add option MIN_NODE_DRAIN_TIME to allow configuration of minimum time we spend draining the Node during termination
    • the check is done by adding an annotation on the Node to indicate when draining started

How was this change tested?

  • manual testing to ensure annotation is added to the Node and minDrainTime is respected
Annotations:        alpha.kubernetes.io/provided-node-ip: 192.168.123.182
...
                    karpenter.sh/disrupted-taint-time: 2025-12-19T13:28:10-08:00
...
CreationTimestamp:  Fri, 19 Dec 2025 10:57:55 -0800
Taints:             karpenter.sh/disrupted:NoSchedule

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ryan-mist
Once this PR has been reviewed and has the lgtm label, please assign maciekpytel for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Dec 19, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @ryan-mist. Thanks for your PR.

I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Dec 19, 2025
func (t *Terminator) Taint(ctx context.Context, node *corev1.Node, taint corev1.Taint) error {
// TaintForDisruption idempotently adds the karpenter.sh/disruption:NoSchedule taint
// and the karpenter.sh/disrupted-taint-time annotation to a node with a NodeClaim
func (t *Terminator) TaintForDisruption(ctx context.Context, node *corev1.Node) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are changing your Taint() method to TaintForDisruption(), but the Taint() method is still being used elsewhere.
ref: pretty.go

Wouldn't it be better to keep the Taint() method and add TaintForDisruption() as a separate method?

Copy link
Contributor

@moko-poi moko-poi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implement unit tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants