-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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_stats: fix potential e2e crash dereferencing ContainerStats.CPU #79057
kubelet_stats: fix potential e2e crash dereferencing ContainerStats.CPU #79057
Conversation
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 this fix :)
/lgtm
/assign @BenTheElder
/test pull-kubernetes-bazel-build |
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.
/lgtm cancel
whoops, jumped the gun here. I'm not sure this is actually going to work the way we are hoping.
I think this change will just push the nil failure back to the computeContainerResourceUsage
method.
Maybe we should also continue
if either cStats
or oldStats
is nil?
8bdc819
to
9553434
Compare
@mattjmcnaughton thanks for the review... I've tweaked the PR with your suggestion. |
/retest |
9553434
to
b9feff9
Compare
/retest |
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.
Cool, I'm convinced that this won't crash :)
My only request is for someone else with more context on this code than me to confirm that we do not want to treat either oldStats
or cStats
being new as a test failure. I'll let whoever does that confirmation approve.
/assign @timothysc |
test/e2e/framework/kubelet_stats.go
Outdated
@@ -598,6 +598,9 @@ func (r *resourceCollector) collectStats(oldStatsMap map[string]*stats.Container | |||
} | |||
|
|||
if oldStats, ok := oldStatsMap[name]; ok { | |||
if oldStats.CPU == nil || cStats.CPU == nil { |
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.
cStats.Memory looks like it might be subject to the same problem if that comes back nil.
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 review... Updated the PR :)
b9feff9
to
997e1f6
Compare
/lgtm |
/retest |
/priority important-soon |
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.
/approve
/hold
this seems reasonable, holding in case we still want input from @timothysc, feel free to hold cancel to unflake and follow up later :-)
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: BenTheElder, rphillips 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 |
I don't see an issue, but I'd defer to @kubernetes/sig-node-pr-reviews for final lgtm. |
/lgtm |
/retest Review the full test history for this PR. Silence the bot with an |
2 similar comments
/retest Review the full test history for this PR. Silence the bot with an |
/retest Review the full test history for this PR. Silence the bot with an |
What type of PR is this?
/kind flake
What this PR does / why we need it:
The kubelet's stats API can return nil within the CPU attribute of cadvisorapiv2.ContainerStats. This patch fixes the e2e test to check for nil CPU attributes before trying to dereference
oldStats.CPU
andcStats.CPU
. We are seeing this flake currently within CI.ref: https://bugzilla.redhat.com/show_bug.cgi?id=1679612
ref: https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/stats/helper.go#L36-L40
ref: https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/stats/helper.go#L77-L84
/cc @kubernetes/sig-node-pr-reviews @sjenning
Which issue(s) this PR fixes:
Special notes for your reviewer:
Does this PR introduce a user-facing change?: