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

Use Allocatable to replace Capacity #19083

Merged
merged 2 commits into from
Jan 22, 2016
Merged

Conversation

resouer
Copy link
Contributor

@resouer resouer commented Dec 24, 2015

Fixes: #18848

Scheduler should use Allocatable instead of Capacity to make decision. But the general behavior does not need to change.

We should also make sure older kubelet can also work well with this code (use Capacity instead in this case).

@k8s-github-robot
Copy link

Labelling this PR as size/M

@k8s-github-robot k8s-github-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Dec 24, 2015
@k8s-bot
Copy link

k8s-bot commented Dec 24, 2015

GCE e2e test build/test passed for commit 5a04faecbe941564e751071a6e25788c569133d3.

glog.V(10).Infof("Cannot schedule Pod %+v, because Node %+v is full, running %v out of %v Pods.", podName(pod), node, len(existingPods), info.Status.Capacity.Pods().Value())
var allocatable api.ResourceList

// In case old version kubelet does not set Allocatable

Choose a reason for hiding this comment

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

This shouldn't be necessary. This is already performed when converting to the internal API format, here.

@resouer resouer force-pushed the allocatable branch 2 times, most recently from 67ca07b to 2d8eac2 Compare January 5, 2016 07:21
@k8s-bot
Copy link

k8s-bot commented Jan 5, 2016

GCE e2e test build/test passed for commit 67ca07b3daaeb00dcf45dcada911e8d5abeb70c4.

@k8s-bot
Copy link

k8s-bot commented Jan 5, 2016

GCE e2e test build/test passed for commit 2d8eac2.

@timstclair
Copy link

LGTM, but @davidopp should have the final word.

@davidopp
Copy link
Member

davidopp commented Jan 9, 2016

Capacity is also used in
https://github.com/kubernetes/kubernetes/blob/master/plugin/pkg/scheduler/algorithm/priorities/priorities.go

Shouldn't the logic in this PR be "if kuebelet reports allocatable, use that, otherwise use capacity" so that it doesn't break with old kubelets?

@resouer
Copy link
Contributor Author

resouer commented Jan 11, 2016

Yeah, it is originally implemented like that, but @timstclair mentioned that default has already deal with that logic. WDYT?

@k8s-bot
Copy link

k8s-bot commented Jan 11, 2016

GCE e2e test build/test passed for commit e1bda61.

@resouer
Copy link
Contributor Author

resouer commented Jan 11, 2016

@k8s-bot unit test this

@k8s-github-robot k8s-github-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jan 11, 2016
@timothysc
Copy link
Member

@resouer @davidopp Is there an e2e that verifies system behavior?

/cc @ncdc please track on 1.2-candidate.

@resouer
Copy link
Contributor Author

resouer commented Jan 12, 2016

@timothysc Seems not, I will add one

@ncdc ncdc added this to the v1.2-candidate milestone Jan 12, 2016
@resouer
Copy link
Contributor Author

resouer commented Jan 12, 2016

@timothysc It just came to me that we can not control NodeStatus in e2e test. So I propose to write a integration test to cover this logic. Agreed?

cc @davidopp

@timothysc
Copy link
Member

@resouer sgtm

@k8s-github-robot
Copy link

Labelling this PR as size/L

@k8s-github-robot k8s-github-robot added 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 Jan 13, 2016
@k8s-github-robot
Copy link

Labelling this PR as size/M

@k8s-github-robot k8s-github-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 13, 2016
@k8s-bot
Copy link

k8s-bot commented Jan 13, 2016

GCE e2e build/test failed for commit 1a6be7f99554ca9526b88c5cd3b3fe09d3a4d334.

@k8s-bot
Copy link

k8s-bot commented Jan 18, 2016

GCE e2e test build/test passed for commit 4640d12ca95bd6895c497538902f8eafac5d20c5.

@resouer
Copy link
Contributor Author

resouer commented Jan 18, 2016

ping @davidopp @timothysc updated and rebased, looks better?

if int64(len(existingPods))+1 > info.Status.Capacity.Pods().Value() {
glog.V(10).Infof("Cannot schedule Pod %+v, because Node %+v is full, running %v out of %v Pods.", podName(pod), node, len(existingPods), info.Status.Capacity.Pods().Value())
allocatable := info.Status.Allocatable

Copy link
Member

Choose a reason for hiding this comment

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

nix the extra line

@timothysc
Copy link
Member

minor comments.

t.Fatalf("Failed to create node: %v", err)
}

// 3. create resource pod which requires more than Allocatable but less than Capacity
Copy link
Member

Choose a reason for hiding this comment

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

"more than Allocatable" doesn't make sense because you are not reporting Allocatable.

Add integration test to verify allocatable can works
@k8s-bot
Copy link

k8s-bot commented Jan 20, 2016

GCE e2e test build/test passed for commit 0202a20.

@resouer
Copy link
Contributor Author

resouer commented Jan 20, 2016

Fixed based on previous comments

@timothysc
Copy link
Member

thx for the fixes.
lgtm from my side, @davidopp for final say.

@davidopp
Copy link
Member

@dchen1107

@davidopp
Copy link
Member

LGTM

@davidopp davidopp added lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-merge labels Jan 20, 2016
@davidopp davidopp modified the milestones: v1.2, v1.2-candidate Jan 20, 2016
@dchen1107
Copy link
Member

LGTM too. Thanks for picking up this.

@dchen1107
Copy link
Member

#13984

@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 Jan 21, 2016

GCE e2e test build/test passed for commit 0202a20.

@alex-mohr
Copy link
Contributor

@k8s-bot unit test this

alex-mohr added a commit that referenced this pull request Jan 22, 2016
Use Allocatable to replace Capacity
@alex-mohr alex-mohr merged commit 76f02d5 into kubernetes:master Jan 22, 2016
@dchen1107
Copy link
Member

Super!

@dchen1107
Copy link
Member

cc/ @derekwaynecarr too

@derekwaynecarr
Copy link
Member

Awesome!

On Thursday, January 21, 2016, Dawn Chen notifications@github.com wrote:

cc/ @derekwaynecarr https://github.com/derekwaynecarr too


Reply to this email directly or view it on GitHub
#19083 (comment)
.

@resouer resouer deleted the allocatable branch January 24, 2016 08:23
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. 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.