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
kubelet/image: improve error handling on noImageToCleanup #117981
Conversation
Welcome @haitch! |
Hi @haitch. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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/test-infra repository. |
/ok-to-test |
/triage accepted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix! The changes look good.
/lgtm
LGTM label has been added. Git tree hash: a791702cae8b85aee38a386ebac494dbb6a3b417
|
/assign @mrunalp @derekwaynecarr @dchen1107 |
@haircommander ptal |
@@ -39,6 +39,10 @@ import ( | |||
"k8s.io/kubernetes/pkg/kubelet/util/sliceutils" | |||
) | |||
|
|||
var ( | |||
errNoImageToCleanup = goerrors.New("NoImageToCleanup") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not seeing a reason to have this look like an event type. Maybe it would be better as "no images to cleanup" and then the error condition below would read more like a sentence?
@@ -323,6 +327,11 @@ func (im *realImageGCManager) GarbageCollect(ctx context.Context) error { | |||
klog.InfoS("Disk usage on image filesystem is over the high threshold, trying to free bytes down to the low threshold", "usage", usagePercent, "highThreshold", im.policy.HighThresholdPercent, "amountToFree", amountToFree, "lowThreshold", im.policy.LowThresholdPercent) | |||
freed, err := im.freeSpace(ctx, amountToFree, time.Now()) | |||
if err != nil { | |||
if goerrors.Is(err, errNoImageToCleanup) { | |||
klog.InfoS("No images eligible for garbage collection") | |||
im.recorder.Eventf(im.nodeRef, v1.EventTypeWarning, events.FreeDiskSpaceFailed, err.Error()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why only an event here?
New changes are detected. LGTM label has been removed. |
Adding label 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/test-infra repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: feiskyer, haitch The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@haitch: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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/test-infra repository. I understand the commands that are listed here. |
PR needs rebase. 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/test-infra repository. |
What type of PR is this?
/kind bug
What this PR does / why we need it:
basically move 2 condition checks ahead, to scanning phase, instead of delete phase.
then we can elegantly report no image to cleanup, in stead of
failed to garbage collect required amount of images. Wanted to free 473842483 bytes, but freed 0 bytes
after the change, you either get
no image to cleanup
orimage cleanup error
.Which issue(s) this PR fixes:
fixes #71869
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: