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

Fix local isolation for pod requesting only overlay or scratch #47179

Merged
merged 2 commits into from
Jun 23, 2017

Conversation

ddysher
Copy link
Contributor

@ddysher ddysher commented Jun 8, 2017

What this PR does / why we need it:

Fix overlay resource predicates for pod with only overlay or scratch storage request.

E.g. the following pod can pass predicate even if overlay is only 512Gi.

apiVersion: v1
kind: Pod
metadata:
  name: pod
spec:
  containers:
  - name: nginx
    image: nginx
    resources:
      requests:
        storage.kubernetes.io/overlay: 1024Gi

similarly, following pod will also pass predicate

apiVersion: v1
kind: Pod
metadata:
  name: pod
spec:
  containers:
  - name: nginx
    image: nginx
    volumeMounts:
    - name: data
      mountPath: /data
  volumes:
  - name: data
    emptyDir:
      sizeLimit: 1024Gi

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #47798

Special notes for your reviewer:

Release note:

@jingxu97 @vishh @dashpole

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 8, 2017
@k8s-ci-robot
Copy link
Contributor

Hi @ddysher. 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 @k8s-bot ok to test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

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. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jun 8, 2017
@k8s-github-robot k8s-github-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. release-note-label-needed labels Jun 8, 2017
fits: false,
test: "request exceeds allocatable",
reasons: []algorithm.PredicateFailureReason{
NewInsufficientResourceError(v1.ResourceStorageScratch, 18, 5, 20),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I copied this from other test cases, but do not understand why v1.ResourceStorageScratch is used in test instead of v1.ResourceStorageOverlay?

@k82cn
Copy link
Member

k82cn commented Jun 8, 2017

@kubernetes/sig-scheduling-pr-reviews , anyone have related knowledge for v1.ResourceStorageScratch?

@k8s-ci-robot k8s-ci-robot added the sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. label Jun 8, 2017
@jingxu97
Copy link
Contributor

jingxu97 commented Jun 8, 2017

v1.ResourceStorageScratch is added in v1.7 to represent the capacity of local storage for scratch space (e.g., used for emptyDir, and also overlay and imagefs if no separate imagefs setup). So ResourceStorageScratch represents the capacity, and ResourceStorageOverlay represents one type of request

@jingxu97
Copy link
Contributor

jingxu97 commented Jun 8, 2017

/approve

@jingxu97
Copy link
Contributor

jingxu97 commented Jun 8, 2017

/lgtm.
Thank you @ddysher for your fix!

@jingxu97
Copy link
Contributor

jingxu97 commented Jun 8, 2017

@davidopp Could you please help approve this PR? Thanks!

@k82cn
Copy link
Member

k82cn commented Jun 8, 2017

@k8s-bot ok to test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jun 8, 2017
@vishh
Copy link
Contributor

vishh commented Jun 8, 2017

/lgtm

Thanks for the fix @ddysher

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 8, 2017
@k8s-github-robot k8s-github-robot added the do-not-merge DEPRECATED. Indicates that a PR should not merge. Label can only be manually applied/removed. label Jun 8, 2017
@k82cn
Copy link
Member

k82cn commented Jun 9, 2017

/release-note-none

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. and removed release-note-label-needed labels Jun 9, 2017
@k82cn
Copy link
Member

k82cn commented Jun 9, 2017

hm.. let me check StorageOverlay and review it :).

@ddysher
Copy link
Contributor Author

ddysher commented Jun 9, 2017

@k82cn FYI #46456

@jingxu97 @vishh np! Thanks for putting this together; this is really a long wanted feature :-)

@k82cn
Copy link
Member

k82cn commented Jun 9, 2017

lgtm; this PR add a check for storage request, only return true if all (cpu, memory, storage, opq) request resources are zero.

But there's some comments about the previous PR (#46456):

  1. In Reosurce.ResourceList(), it do not include StorageScratch; no UT broken, but it's better to include all resources here.
  2. In the storage test, it's better to also add Node's allocation, similar to the other test; I had to go through the for-loop to know how many storage here, and we can not set it case by case

I'll approve this PR and create another one for those two cleanup comments.

@k82cn
Copy link
Member

k82cn commented Jun 9, 2017

/approve

@k82cn
Copy link
Member

k82cn commented Jun 9, 2017

/approve no-issue

@ddysher ddysher changed the title Fix local isolation for pod requesting only overlay Fix local isolation for pod requesting only overlay or scratch Jun 9, 2017
@k8s-github-robot k8s-github-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 9, 2017
@ddysher
Copy link
Contributor Author

ddysher commented Jun 9, 2017

@jingxu97 @vishh @k82cn I've updated the PR to include scratch as well.

emptyDirLimit: 15,
storageMedium: v1.StorageMediumMemory,
nodeInfo: schedulercache.NewNodeInfo(
newResourcePod(schedulercache.Resource{MilliCPU: 2, Memory: 2, StorageOverlay: 5})),
Copy link
Member

Choose a reason for hiding this comment

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

add a description for this case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done. it's just a one line change, so I force update the second commit.

@k82cn
Copy link
Member

k82cn commented Jun 9, 2017

lgtm, just add a description of the new case :).

@ddysher
Copy link
Contributor Author

ddysher commented Jun 10, 2017

description added, but it's not a new case though. git diff is misleading

lgtm, just add a description of the new case :).

@jingxu97
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 10, 2017
@k82cn
Copy link
Member

k82cn commented Jun 12, 2017

@vishh , @jingxu97 , can you help to remove do-not-merge label ?

@ddysher
Copy link
Contributor Author

ddysher commented Jun 19, 2017

@vishh @jingxu97 Do we want to make it for v1.7?

@vishh
Copy link
Contributor

vishh commented Jun 19, 2017

/lgtm

@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ddysher, jingxu97, k82cn, vishh

Associated issue requirement bypassed by: k82cn

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@vishh vishh added this to the v1.7 milestone Jun 19, 2017
@vishh vishh added the kind/bug Categorizes issue or PR as related to a bug. label Jun 19, 2017
@vishh
Copy link
Contributor

vishh commented Jun 19, 2017

@ddysher can you file an issue to get release approval?

@ddysher
Copy link
Contributor Author

ddysher commented Jun 20, 2017

@vishh done

ref: #47798

@vishh
Copy link
Contributor

vishh commented Jun 20, 2017

cc @saad-ali @dchen1107

@saad-ali saad-ali removed the do-not-merge DEPRECATED. Indicates that a PR should not merge. Label can only be manually applied/removed. label Jun 20, 2017
@saad-ali
Copy link
Member

Fix is low risk, approved for 1.7

@marun
Copy link
Contributor

marun commented Jun 23, 2017

CI seems to be stalled.

/test pull-kubernetes-federation-e2e-gce

@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 47883, 47179, 46966, 47982, 47945)

@k8s-github-robot k8s-github-robot merged commit 171f48a into kubernetes:master Jun 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Local storage isolation doesn't work for pod with only overlay or scratch space request