kubernetes / kubectl

Issue tracker and mirror of kubectl code
Apache License 2.0
2.89k stars 924 forks source link

Drain Package Functions Should Use PollUntilContextTimeout and Return Properly Typed Errors #1627

Open ugrkm opened 4 months ago

ugrkm commented 4 months ago

Drain package function waitForDelete uses wait.PollImmediate. That function is deprecated and instead PollUntilContextTimeout should be used. In addition, we cannot check the returned error from waitForDelete function with wait.Interrupted because the function returns an error with fmt.Errorf.

What would you like to be added: Instead of using wait.PollImmediate, we should switch to PollUntilContextTimeout . Also, the waitForDelete should return an error of type ErrorInterrupted.

Why is this needed: wait.PollImmediate is deprecated. The current returned error is hard to check and requires string comparison.

ugrkm commented 4 months ago

I am happy to work on this, if this change sounds reasonable.

mpuckett159 commented 3 months ago

/triage accepted We would accept a PR for this, thank you for offering to help with this @ugrkm