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

Resources prefixed with *kubernetes.io/ should remain unscheduled if they are not exposed on the node. #61860

Merged

Conversation

rohitagarwal003
Copy link
Member

Currently, resources prefixed with *kubernetes.io/ get scheduled to any
node whether it's exposing that resource or not.

On the other hand, resources prefixed with someother.domain/ don't get
scheduled to a node until that node is exposing that resource (or if the
resource is ignored because of scheduler extender).

This commit brings the behavior of *kubernetes.io/ prefixed resources in
line with other extended resources and they will remain unscheduled
until some node exposes these resources.

Fixes #50658

Pods requesting resources prefixed with `*kubernetes.io` will remain unscheduled if there are no nodes exposing that resource.

/sig scheduling
/assign jiayingz vishh bsalamat ConnorDoyle k82cn

@k8s-ci-robot k8s-ci-robot added 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. release-note Denotes a PR that will be considered when it comes time to generate release notes. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Mar 28, 2018
Copy link
Member

@bsalamat bsalamat left a comment

Choose a reason for hiding this comment

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

minor comment, otherwise LGTM.

@@ -47,13 +47,18 @@ func IsExtendedResourceName(name v1.ResourceName) bool {
return true
}

// IsDefaultnamespaceContainingResource returns true if the resource name is in the
// *kubernetes.io/ namespace.
func IsDefaultNamespaceContainingResource(name v1.ResourceName) bool {
Copy link
Member

Choose a reason for hiding this comment

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

The name of this function is confusing and the fact that we have used "Namespace" which is a well known concept in Kubernetes causes even more confusion. I would call it something like "IsNativeResource".

Copy link
Member Author

Choose a reason for hiding this comment

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

I based it on the function below: IsDefaultNamespaceResource90. Also, the prefix variable is called ResourceDefaultNamespacePrefix.

How would you name these two functions? IsNativeResource() seems to make more sense for the function below.

Since the newly added function is very straightforward and seem to not have uses outside of this feel, I don't mind inlining it either.

Copy link
Member

Choose a reason for hiding this comment

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

I know that this whole "Namespace" thing in the function names existed.
You are right that we should probably use "IsNativeResource" for the function below. This one can be called "IsNativeResourceWithPrefix" or "IsPrefixedNativeResource" or something along these.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated. PTAL

@vishh
Copy link
Contributor

vishh commented Mar 28, 2018

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 28, 2018
…they are not exposed on the node.

Currently, resources prefixed with *kubernetes.io/ get scheduled to any
node whether it's exposing that resource or not.

On the other hand, resources prefixed with someother.domain/ don't get
scheduled to a node until that node is exposing that resource (or if the
resource is ignored because of scheduler extender).

This commit brings the behavior of *kubernetes.io/ prefixed resources in
line with other extended resources and they will remain unscheduled
until some node exposes these resources.

This also includes renaming IsDefaultNamespaceResource() to
IsNativeResource().
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 29, 2018
@bsalamat
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 29, 2018
@rohitagarwal003
Copy link
Member Author

/assign liggitt

@rohitagarwal003
Copy link
Member Author

/retest

@rohitagarwal003
Copy link
Member Author

/assign @thockin

@thockin
Copy link
Member

thockin commented Apr 2, 2018

Do we have docs on when a resource would be "bare" vs prefixed with kubernetes ?

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bsalamat, mindprince, thockin, vishh

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 2, 2018
@rohitagarwal003
Copy link
Member Author

Do we have docs on when a resource would be "bare" vs prefixed with kubernetes ?

The in-tree resources (cpu, memory, ephemeral-storage, hugepages-*) are always supposed to be bare. The docs just use bare resources always when talking about these and don't mention anything about prefixing with kubernetes.io.

When talking about extended resources the docs say:

https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/

Extended Resources are fully-qualified resource names outside the kubernetes.io domain.

https://kubernetes.io/docs/tasks/configure-pod-container/extended-resource/

Extended resources are fully qualified with any domain outside of *.kubernetes.io/.

@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 60073, 58519, 61860). If you want to cherry-pick this change to another branch, please follow the instructions here.

@k8s-github-robot k8s-github-robot merged commit 1f69c34 into kubernetes:master Apr 3, 2018
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. 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. 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.

Scheduler ignores requests for unknown fully-qualified resources.
10 participants