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

Only expose top N images in NodeStatus #25328

Merged
merged 2 commits into from
May 21, 2016

Conversation

resouer
Copy link
Contributor

@resouer resouer commented May 9, 2016

Fix #25209

Sorted the image and only pick set top 50 sized images in node status.

cc @vishh

@k8s-github-robot k8s-github-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. release-note-label-needed labels May 9, 2016
// sort the images from max to min, and only set top N images into the node status.
sort.Sort(ByImageSize(containerImages))
if maxImagesInNodeStatus < len(containerImages) {
containerImages = containerImages[0 : maxImagesInNodeStatus-1]
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, this returns maxImagesInNodeStatus-1 images, is that what you want? @resouer

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, my mistake.

@vishh vishh assigned vishh and unassigned dchen1107 May 10, 2016
@vishh vishh changed the title Only store top N images in status Only expose top N images in NodeStatus May 10, 2016
@vishh vishh added release-note Denotes a PR that will be considered when it comes time to generate release notes. ok-to-merge and removed release-note-label-needed labels May 10, 2016
@k8s-github-robot k8s-github-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 11, 2016
@resouer resouer force-pushed the sort-images branch 2 times, most recently from 9048885 to d342b22 Compare May 11, 2016 10:58
@k8s-github-robot k8s-github-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 11, 2016
@k8s-github-robot k8s-github-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels May 11, 2016
@@ -40,6 +40,22 @@ func Intn(max int) int {
return rng.rand.Intn(max)
}

// IntnRange generates an integer in range min->max.
// By design this should panic if input is invalid, <= 0.
func IntnRange(min int, max int) int {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: (min, max int)

@vishh
Copy link
Contributor

vishh commented May 13, 2016

LGTM. Ok to be merged once the two nits are addressed. Thanks for the PR @resouer

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 13, 2016
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 14, 2016
@resouer
Copy link
Contributor Author

resouer commented May 16, 2016

Fixed rebase :)

@yifan-gu
Copy link
Contributor

LGTM

@yifan-gu yifan-gu added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 16, 2016
@vishh vishh added this to the v1.3 milestone May 17, 2016
// 0 is invalid.
for min, max := range map[int]int{1: 2, 10: 123, 100: 500} {
inrange := IntnRange(min, max)
if inrange < min || inrange > max {
Copy link
Member

Choose a reason for hiding this comment

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

Apologies for the drive-by review, but since I'm build cop and looking for safe things to merge...

Generating a single number per test here is probably not sufficient, could take a long time to expose a problem. Suggest doing this 100+ times per test.

Second, these functions both have a bug/undocumented feature, which is that they'll never return the top number in the range. Either document or fix.

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice catch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will fix this

@k8s-github-robot k8s-github-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 19, 2016
@resouer
Copy link
Contributor Author

resouer commented May 19, 2016

updated the rand tests cc @lavalamp

@lavalamp lavalamp added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 19, 2016
@lavalamp
Copy link
Member

lavalamp commented May 19, 2016

@resouer thanks for humoring me :) LGTM

@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-bot
Copy link

k8s-bot commented May 21, 2016

GCE e2e build/test passed for commit d917ed2.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit 68ab865 into kubernetes:master May 21, 2016
@resouer resouer deleted the sort-images branch May 23, 2016 02:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants