Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix taint removal retry for non-swallowed errors #1898

Merged
merged 1 commit into from
Jan 21, 2024

Conversation

ConnorJC3
Copy link
Contributor

@ConnorJC3 ConnorJC3 commented Jan 19, 2024

Is this a bug fix or adding new feature?

Bug fix

What is this PR about? / Why do we need it?

https://pkg.go.dev/k8s.io/apimachinery/pkg/util/wait#ExponentialBackoff

When the condition func returns an error, it isn't retried:

Stops and returns as soon as: 1. the condition check returns true or an error

This change configures the conditional func used by removeTaintInBackground to always swallow the error

What testing is done?

Added basic unit test confirming the function retries

Manually tested, output from real world retry failures:

I0119 15:57:29.455540       1 metadata_ec2.go:25] "Retrieving EC2 instance identity metadata" regionFromSession=""
E0119 15:57:29.472054       1 node.go:861] "Unexpected failure when attempting to remove node taint(s)" err="nodes \"i-0e0b9229e1b239ef0\" is forbidden: User \"system:serviceaccount:kube-system:ebs-csi-node-sa\" cannot get resource \"nodes\" in API group \"\" at the cluster scope"
E0119 15:57:29.975040       1 node.go:861] "Unexpected failure when attempting to remove node taint(s)" err="nodes \"i-0e0b9229e1b239ef0\" is forbidden: User \"system:serviceaccount:kube-system:ebs-csi-node-sa\" cannot get resource \"nodes\" in API group \"\" at the cluster scope"
E0119 15:57:30.979037       1 node.go:861] "Unexpected failure when attempting to remove node taint(s)" err="nodes \"i-0e0b9229e1b239ef0\" is forbidden: User \"system:serviceaccount:kube-system:ebs-csi-node-sa\" cannot get resource \"nodes\" in API group \"\" at the cluster scope"
E0119 15:57:32.980967       1 node.go:861] "Unexpected failure when attempting to remove node taint(s)" err="nodes \"i-0e0b9229e1b239ef0\" is forbidden: User \"system:serviceaccount:kube-system:ebs-csi-node-sa\" cannot get resource \"nodes\" in API group \"\" at the cluster scope"
E0119 15:57:36.984689       1 node.go:861] "Unexpected failure when attempting to remove node taint(s)" err="nodes \"i-0e0b9229e1b239ef0\" is forbidden: User \"system:serviceaccount:kube-system:ebs-csi-node-sa\" cannot get resource \"nodes\" in API group \"\" at the cluster scope"
E0119 15:57:44.987308       1 node.go:861] "Unexpected failure when attempting to remove node taint(s)" err="nodes \"i-0e0b9229e1b239ef0\" is forbidden: User \"system:serviceaccount:kube-system:ebs-csi-node-sa\" cannot get resource \"nodes\" in API group \"\" at the cluster scope"
E0119 15:58:00.995860       1 node.go:861] "Unexpected failure when attempting to remove node taint(s)" err="nodes \"i-0e0b9229e1b239ef0\" is forbidden: User \"system:serviceaccount:kube-system:ebs-csi-node-sa\" cannot get resource \"nodes\" in API group \"\" at the cluster scope"
E0119 15:58:33.014379       1 node.go:861] "Unexpected failure when attempting to remove node taint(s)" err="nodes \"i-0e0b9229e1b239ef0\" is forbidden: User \"system:serviceaccount:kube-system:ebs-csi-node-sa\" cannot get resource \"nodes\" in API group \"\" at the cluster scope"
E0119 15:59:37.017078       1 node.go:861] "Unexpected failure when attempting to remove node taint(s)" err="nodes \"i-0e0b9229e1b239ef0\" is forbidden: User \"system:serviceaccount:kube-system:ebs-csi-node-sa\" cannot get resource \"nodes\" in API group \"\" at the cluster scope"
E0119 16:01:45.026438       1 node.go:861] "Unexpected failure when attempting to remove node taint(s)" err="nodes \"i-0e0b9229e1b239ef0\" is forbidden: User \"system:serviceaccount:kube-system:ebs-csi-node-sa\" cannot get resource \"nodes\" in API group \"\" at the cluster scope"
E0119 16:01:45.026490       1 node.go:868] "Retries exhausted, giving up attempting to remove node taint(s)" err="timed out waiting for the condition"

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 19, 2024
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jan 19, 2024
Copy link

Code Coverage Diff

File Old Coverage New Coverage Delta
github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/driver/node.go 78.7% 80.3% 1.6

@ConnorJC3 ConnorJC3 changed the title Fix retry for non-swallowed errors Fix taint removal retry for non-swallowed errors Jan 19, 2024
@ConnorJC3
Copy link
Contributor Author

/retest

Copy link
Member

@torredil torredil left a comment

Choose a reason for hiding this comment

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

node.go lgtm

pkg/driver/node_test.go Outdated Show resolved Hide resolved
Copy link
Member

@torredil torredil left a comment

Choose a reason for hiding this comment

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

Thanks @ConnorJC3
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 19, 2024
@AndrewSirenko
Copy link
Contributor

/retry

@AndrewSirenko
Copy link
Contributor

/retest

Copy link
Contributor

@AndrewSirenko AndrewSirenko left a comment

Choose a reason for hiding this comment

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

Thanks for this

@AndrewSirenko
Copy link
Contributor

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: AndrewSirenko

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

The pull request process is described here

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 approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 21, 2024
@k8s-ci-robot k8s-ci-robot merged commit a41a7a4 into kubernetes-sigs:master Jan 21, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants