Commit Graph

679 Commits (a8f318779b511307a53fbaecb5fbb7bb40847ab7)

Author SHA1 Message Date
k8s-ci-robot c00f19bd15
Merge pull request #68403 from wgliang/master.deprecate-Parallelize
Replace Parallelize with function ParallelizeUntil and formally depre…
2018-10-06 09:40:07 -07:00
Guoliang Wang 558e1960b8 [scheduler cleanup phase 1]: Move FakeCache to pkg/scheduler/internal/cache/fake 2018-10-06 23:58:53 +08:00
Guoliang Wang 187e2e01c9 Move scheduler cache interface and implementation to pkg/scheduler/internal/cache 2018-10-06 20:48:59 +08:00
Christoph Blecker 97b2992dc1
Update gofmt for go1.11 2018-10-05 12:59:38 -07:00
Guoliang Wang c2622dd9d8 Replace Parallelize with function ParallelizeUntil and formally deprecate the Parallelize 2018-10-05 17:56:56 +08:00
Bobby (Babak) Salamat 2d9d8c405d Add validation for percentage-of-nodes-to-score of the scheduler config 2018-10-02 17:09:47 -07:00
k8s-ci-robot 14949b302f
Merge pull request #68724 from krmayankk/sched1
scheduler: improve readability of bind function
2018-10-01 18:04:04 -07:00
k8s-ci-robot 5b658bb65e
Merge pull request #69136 from zhangmingld/deletecommentgetPodsMatchingAffinity
func getPodsMatchingAffinity no longer exists,dont need it in comment
2018-09-30 02:37:03 -07:00
Mayank Kumar 1ae12337db scheduler: add error handling for bind 2018-09-28 21:13:21 -07:00
Wei Huang 9da576f03c
move SchedulingQueue to pkg/scheduler/internal/queue 2018-09-28 11:51:02 -07:00
Wei Huang 2e7461c087
auto-generated files 2018-09-28 11:51:01 -07:00
k8s-ci-robot db1d1c8674
Merge pull request #68700 from Huang-Wei/schedulingQ-graceful-shutdown
shutdown schedulingQueue gracefully
2018-09-28 00:46:14 -07:00
Wei Huang be661fddb4
shutdown schedulingQueue gracefully
- add Close() to interface SchedulingQueue
- implement Close() for FIFO and PriorityQueue
- add unit test
2018-09-27 14:32:58 -07:00
Wei Huang 56fcfc5fee
cleanup duplicate assignment logic in scheduler 2018-09-27 11:38:05 -07:00
k8s-ci-robot 762ddf792d
Merge pull request #68984 from k82cn/k8s_68899_m
Keep backward compatibility for 'node.Spec.Unschedulable'.
2018-09-27 04:48:49 -07:00
zhangmingld 061e0dbb7e func getPodsMatchingAffinity no longer exists,dont need it in comment 2018-09-27 14:42:49 +08:00
k8s-ci-robot 823530d4db
Merge pull request #68917 from zhangmingld/fixwordserr
Fix some typo err
2018-09-26 22:59:32 -07:00
k8s-ci-robot a6bc5aa49e
Merge pull request #68563 from DylanBLE/dev
fix scheduler crash when Prioritize Map function failed
2018-09-26 22:59:04 -07:00
Bobby (Babak) Salamat c051f0d31a autogenerated files 2018-09-26 14:22:21 -07:00
Bobby (Babak) Salamat f340f8baf8 Remove PDB and its event handlers from the scheduler cache 2018-09-26 14:22:21 -07:00
hongjian.sun f33c2c11f2 fix scheduler crash when Prioritize Map function failed 2018-09-26 20:16:05 +08:00
k8s-ci-robot 28d86ac47d
Merge pull request #67308 from cofyc/fix67260
Use monotonically increasing generation to prevent equivalence cache race
2018-09-25 00:18:00 -07:00
Jonathan Basseri b0a8dbbc9d Add scheduler throughput metric.
This adds a counter to the scheduler that can be used to calculate
throughput and error ratio. Pods which fail to schedule are not counted
as errors, but can still be tracked separately from successes.

We already measure scheduler latency, but throughput was missing. This
should be considered a key metric for the scheduler.
2018-09-24 14:38:39 -07:00
Da K. Ma 78f6484e14 Keep backward compatibility for 'node.Spec.Unschedulable'.
Signed-off-by: Da K. Ma <klaus1982.cn@gmail.com>
2018-09-23 10:33:51 +08:00
Yecheng Fu b3f1e1200b Update notes to document why invalidation order is important. 2018-09-22 12:09:24 +08:00
Yecheng Fu 2f46bc8a18 Use seqeuence number to represent generation of equivalence cache.
- snapshot equivalence cache generation numbers before snapshotting the
scheduler cache
- skip update when generation does not match live generation
- keep the node and increment its generation to invalidate it instead of
deletion
- use predicates order ID as key to improve performance
2018-09-22 12:08:21 +08:00
Yecheng Fu a2cc1b1a20 Revert "Use sync.map to scale ecache better"
This reverts commit 17d0190706.
2018-09-22 11:33:06 +08:00
zhangmingld 6aaeb209eb fix some typo 2018-09-21 10:19:35 +08:00
Wei Huang 7490542156
fix PodAntiAffinity issues
- update logic of verifying incoming pod's anti-affinity
- rename podMatchesAffinityTermProperties to podMatchesAllAffinityTermProperties
- add podMatchesAnyAffinityTermProperties which is used in some PodAntiAffinity cases
- rename some functions to make it more readable
- add unit tests to verify correctness of PodAffinity and PodAntiAffinity
  - verifying "Existing pod anti-affinity"
  - verifying "incoming pod's anti-affinity"
  - verifying "incoming pod's affinity"
2018-09-13 18:32:33 -07:00
Kubernetes Submit Queue a6eb49f0dc
Merge pull request #68195 from luxas/consolidate_componentconfig_code_standards
Automatic merge from submit-queue (batch tested with PRs 67950, 68195). If you want to cherry-pick this change to another branch, please follow the instructions here: https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md.

Consolidate componentconfig code standards

**What this PR does / why we need it**:

This PR fixes a bunch of very small misalignments in ComponentConfig packages:
 - Add sane comments to all functions/variables in componentconfig `register.go` files
 - Make the `register.go` files of componentconfig pkgs follow the same pattern and not differ from each other like they do today.
 - Register the `openapi-gen` tag in all `doc.go` files where the pkg contains _external_ types.
 - Add the `groupName` tag where missing
 - Fix cases where `addKnownTypes` was registered twice in the `SchemeBuilder`
 - Add `Readme` and `OWNERS` files to `Godeps` directories if missing.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:


**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```

/assign @sttts @thockin
2018-09-07 11:19:40 -07:00
Lucas Käldström 83d53ea1c2
Standardize componentconfig code/comment patterns 2018-09-06 13:42:02 +03:00
Stephen Cuppett d85daf0f4c Resolves #59015, extends existing regex to cover t3, r5(d) & z1d instance types
From current AWS documentation:

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/volume_limits.html

T3, C5, C5d, M5, M5d, R5, R5d, and z1d instances support a maximum of
28 attachments, and every instance has at least one network interface
attachment. If you have no additional network interface attachments on
these instances, you could attach 27 EBS volumes.
2018-09-05 21:24:09 -04:00
Kubernetes Submit Queue ca43f007a3
Merge pull request #67731 from gnufied/fix-csi-attach-limit
Automatic merge from submit-queue (batch tested with PRs 68161, 68023, 67909, 67955, 67731). If you want to cherry-pick this change to another branch, please follow the instructions here: https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md.

Fix csi attach limit

Add support for volume limits for CSI.

xref: https://github.com/kubernetes/community/pull/2051

```release-note
Add support for volume attach limits for CSI volumes
```
2018-09-05 14:51:55 -07:00
Hemant Kumar fc61620db5 Fix compatibility tests for scheduler 2018-09-05 12:29:00 -04:00
Michelle Au e124159990 Add scheduler option for bind timeout 2018-09-04 17:25:23 -07:00
Michelle Au ce2dfac296 generated files 2018-09-04 16:47:43 -07:00
Michelle Au 01d83fa104 Scheduler changes to assume volume and pod together, and then bind
volume and pod asynchronously afterwards. This will also make it easier
to migrate to the scheduler framework.
2018-09-04 16:30:14 -07:00
Kubernetes Submit Queue 6b02edd369
Merge pull request #68196 from losipiuk/lo/revert-delte-predicate-funs
Automatic merge from submit-queue (batch tested with PRs 67555, 68196). If you want to cherry-pick this change to another branch, please follow the instructions here: https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md.

Add back predicate related accessors to scheduler.Configurator

```release-note
NONE
```
2018-09-04 11:41:37 -07:00
Kubernetes Submit Queue a0b457d0e5
Merge pull request #67555 from wgliang/opt/improve-performance
Automatic merge from submit-queue (batch tested with PRs 67555, 68196). If you want to cherry-pick this change to another branch, please follow the instructions here: https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md.

Not split nodes when searching for nodes but doing it all at once

**What this PR does / why we need it**:
Not split nodes when searching for nodes but doing it all at once.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:
@bsalamat 

This is a follow up PR of #66733.

https://github.com/kubernetes/kubernetes/pull/66733#discussion_r205932531

**Release note**:

```release-note
Not split nodes when searching for nodes but doing it all at once.
```
2018-09-04 11:41:34 -07:00
Guoliang Wang 6c63dcfffe Not split nodes when searching for nodes but doing it all at once 2018-09-04 14:07:24 +08:00
Kubernetes Submit Queue f3b98a08b0
Merge pull request #66799 from noqcks/master
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here: https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md.

Add validation for kube-scheduler configuration options

**What this PR does / why we need it**: This adds validation to the kube-scheduler so that we're not accepting bogus values to the kube-scheduler. As requested by @bsalamat in issue https://github.com/kubernetes/kubernetes/issues/66743

**Which issue(s) this PR fixes**:
Fixes #66743

**Special notes for your reviewer**:
- Not sure if this validation is too heavy handed. Would love some feedback. 
- I started working on this before I realized @islinwb was also working on this same problem... https://github.com/kubernetes/kubernetes/pull/66787 I put this PR up anyways since I'm sure good code exists in both. I wasn't aware of the /assign command so didn't assign myself before starting work. 
- I didn't have time to work on adding validation to deprecated cli options. If the rest of this looks ok, I can finish that up.
- I hope the location of IsValidSocketAddr is correct. Lmk if it isn't. 

**Release note**:
```release-note
Adding validation to kube-scheduler at the API level
```
2018-09-03 17:17:49 -07:00
Kubernetes Submit Queue 7548764f96
Merge pull request #67788 from mohamed-mehany/inter-pod-affinity-optimization
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here: https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md.

Affinity/Anti-Affinity Optimization of Pod Being Scheduled

**What this PR does / why we need it**:
Following #66948, it was noticed that the applied optimizations for anti-affinity rules lookup of existing pods could be further applied to checking affinity and anti-affinity terms of the Pod being scheduled. This is done by mapping topology pairs to pods that potentially match the pod being scheduled instead of mapping nodes to matching pods, and accordingly the search space is reduced.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #67738

**Special notes for your reviewer**:
/sig scheduling
/sig scalability

**Release note**:

```release-note
Improve performance of Pod affinity/anti-affinity in the scheduler
```
2018-09-03 11:40:09 -07:00
Łukasz Osipiuk fa39053412 Add back predicate related accessors to scheduler.Configurator 2018-09-03 19:12:01 +02:00
Kubernetes Submit Queue da25aaa39e
Merge pull request #68081 from silveryfu/image-locality-tests-new
Automatic merge from submit-queue (batch tested with PRs 63437, 68081). If you want to cherry-pick this change to another branch, please follow the instructions here: https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md.

Enable ImageLocalityPriority by default with integration tests

**What this PR does / why we need it**:

This PR is a follow-up to [#63842](https://github.com/kubernetes/kubernetes/issues/63842). It moves the ImageLocalityPriority function to default priority functions of the default algorithm provider and adds integration tests for the updated scheduling policy.

- Compared to [#64662](https://github.com/kubernetes/kubernetes/pull/64662), this PR does note provide e2e test due to concerns about a large image may add too much overhead to the testing infrastructure and pipeline. We should add e2e tests in the future with the use of large enough image(s) in following PRs. 

- Compared to [#64662](https://github.com/kubernetes/kubernetes/pull/64662), this PR simplifies the code changes and keeps code changes under test/integration/scheduler/.

- The PR contains a bug fix for [#65745](https://github.com/kubernetes/kubernetes/pull/65745) - caught by the integration test - where the image states are not properly cloned to the scheduler's cachedNodeInfoMap. We might split this fix into a separate PR.

The integration test covers what follows: a pod requiring a large image (~= 3GB) is submitted to the cluster and there is a single node in the cluster has the same large image; the pod should get scheduled to that node. We might also consider whether more scenarios are desired.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

Kindly ping @resouer and @bsalamat 

**Release note**:

```release-note
None
```
2018-09-01 16:58:33 -07:00
noqcks 0334a34e4a
Add validation for kube-scheduler
adding validation for componentconfig

adding validation to cmd kube-scheduler

Add support for ipv6 in IsValidSocketAddr function

updating copyright date in componentconfig/validation/validation.go

updating copyright date in componentconfig/validation/validation_test.go

adding validation for cli options

adding BUILD files

updating validate function to return []errors in cmd/kube-scheduler

ok, really returning []error this time

adding comments for exported componentconfig Validation functions

silly me, not checking structs along the way :'(

refactor to avoid else statement

moving policy nil check up one function

rejigging some deprecated cmd validations

stumbling my way around validation slowly but surely

updating according to review from @bsalamat

- not validating leader election config unless leader election is enabled
- leader election time values cannot be zero
- removing validation for KubeConfigFile
- removing validation for scheduler policy

leader elect options should be non-negative

adding test cases for renewDeadline and leaseDuration being zero

fixing logic in componentconfig validation 😅

removing KubeConfigFile reference from tests as it was removed in master

2ff9bd6699

removing bogus space after var assignment

adding more tests for componentconfig based on feedback

making updates to validation because types were moved on master

update bazel build

adding validation for staging/apimachinery

adding validation for staging/apiserver

adding fieldPaths for staging validations

moving staging validations out of componentconfig

updating test case scenario for staging/apimachinery

./hack/update-bazel.sh

moving kube-scheduler validations from componentconfig

./hack/update-bazel.sh

removing non-negative check for QPS

resourceLock required

adding HardPodAffinitySymmetricWeight 0-100 range to cmd flag help section
2018-08-31 22:29:19 -04:00
Klaus Ma 26142e614c Wait for Scheduler cache empty.
Signed-off-by: Klaus Ma <klaus1982.cn@gmail.com>
2018-08-31 19:42:10 +08:00
Silvery Fu 74fbbe8e52 Fix cloning image states from node info 2018-08-31 00:58:29 -07:00
Silvery Fu c06dcb2d6a Move image locality to default priority functions 2018-08-31 00:58:09 -07:00
Ahmad Diaa ee393b4e06 addressed reviewer comments 2018-08-30 01:48:55 +02:00
Ahmad Diaa ac4a082b33 use topologyPairsMaps for inter pod affinity/anti-affinity maps 2018-08-30 01:48:54 +02:00
Kubernetes Submit Queue f07d0955e9
Merge pull request #67642 from tizhou86/newUnitTest7
Automatic merge from submit-queue (batch tested with PRs 67766, 67642, 67772). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Add unit test cases for scheduler/algorithm/predicates.

**What this PR does / why we need it**:
Add unit test cases for scheduler/algorithm/predicates for more code coverage.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
NONE

**Special notes for your reviewer**:
NONE

**Release note**:

```release-note
NONE
```
2018-08-27 06:14:14 -07:00
Kubernetes Submit Queue 459b537885
Merge pull request #67750 from tizhou86/newUnitTest9
Automatic merge from submit-queue (batch tested with PRs 66257, 67750). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Add unit test cases for scheduler/util.

**What this PR does / why we need it**:
Add unit test cases for scheduler/util for more code coverage.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
NONE

**Special notes for your reviewer**:
NONE

**Release note**:

```release-note
NONE
```
2018-08-26 23:01:13 -07:00
tizhou86 3e0fdc28c9 Add unit test cases for scheduler/algorithm/predicates. 2018-08-27 10:57:04 +08:00
Kubernetes Submit Queue 66fa85c837
Merge pull request #67760 from houjun41544/20180823
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

 Complement unit test case TestNodesWherePreemptionMightHelp for scheduler/core

**What this PR does / why we need it**:

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note

```
2018-08-26 19:39:06 -07:00
Kubernetes Submit Queue 92f2319379
Merge pull request #67759 from tizhou86/newPR3
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Fix golint error under scheduler/factory.

**What this PR does / why we need it**:
Fix golint error under scheduler/factory.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
NONE

**Special notes for your reviewer**:
NONE

**Release note**:

```release-note
NONE
```
2018-08-26 00:06:26 -07:00
Kubernetes Submit Queue a697d71cb5
Merge pull request #66916 from dixudx/kubeadm_scheduler_api
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Moving KubeSchedulerConfiguration from ComponentConfig API types to staging repos

**What this PR does / why we need it**:

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes kubernetes/kubeadm#528

**Special notes for your reviewer**:
/cc luxas timothysc 
/cc @kubernetes/sig-cluster-lifecycle-pr-reviews 
**Release note**:

```release-note
Moving KubeSchedulerConfiguration from ComponentConfig API types to staging repos
```
2018-08-24 14:38:58 -07:00
Di Xu 7f8a59162b auto-generated 2018-08-24 10:58:09 +08:00
Di Xu 9f506da2d4 add new GVK kubescheduler.config.k8s.io/v1alpha1.KubeSchedulerConfiguration 2018-08-24 10:58:09 +08:00
houjun 08e5f4573a Complement unit test case TestNodesWherePreemptionMightHelp for scheduler/core 2018-08-23 18:54:23 +08:00
tizhou86 2a2c0c37d4 Fix golint error under scheduler/factory. 2018-08-23 17:24:32 +08:00
tizhou86 6fbc7d51be Fix golint error under scheduler/algorithm/priorities. 2018-08-23 17:20:55 +08:00
tizhou86 d971778844 Add unit test cases for scheduler/util. 2018-08-23 15:26:27 +08:00
Hemant Kumar 8e4b33d1a8 Move volume limit feature to beta 2018-08-22 19:36:01 -04:00
Hemant Kumar 4b17a48def Implement support for updating volume limits
Create a new predicate to count CSI volumes
2018-08-22 19:36:00 -04:00
Kubernetes Submit Queue 4cca6a89a0
Merge pull request #66862 from resouer/sync-map
Automatic merge from submit-queue (batch tested with PRs 66862, 67618). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Use sync.map to scale equiv class cache better

**What this PR does / why we need it**:

Change the current lock in first level ecache into  `sync.Map`, which is known for scaling better than `sync. Mutex ` on machines with >8 CPUs

ref: https://golang.org/pkg/sync/#Map
 
And the code is much cleaner in this way.

5k Nodes, 10k Pods benchmark with ecache enabled in 64 cores VM:

```bash
// before
BenchmarkScheduling/5000Nodes/0Pods-64             10000          17550089 ns/op

// after
BenchmarkScheduling/5000Nodes/0Pods-64             10000          16975098 ns/op
```
Comparing to current implementation, the improvement after this change is noticeable, and the test is stable in 8, 16, 64 cores VM.

**Special notes for your reviewer**:

**Release note**:

```release-note
Use sync.map to scale ecache better
```
2018-08-21 00:24:01 -07:00
Kubernetes Submit Queue ef388fee53
Merge pull request #66948 from mohamed-mehany/anti-affinity-optimization
Automatic merge from submit-queue (batch tested with PRs 67041, 66948). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Anti affinity optimization

**What this PR does / why we need it**:
This pull request aims to optimize the performance of anti-affinity rules lookup of existing pods
This optimization maps the topology values to a list of pods running on nodes that match this value and store that map in the pod metadata. Accordingly, when validating anti-affinity rules of existing pods we will only check those running on nodes with similar topology values to the current candidate (node) for scheduling.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #63937

**Special notes for your reviewer**:
/sig scalability
/sig scheduling
**Release note**:

```release-note
improve performance of anti-affinity predicate of default scheduler.
```
2018-08-17 19:14:08 -07:00
Ahmad Diaa b4c7d190cd using set instead of lists for topologyPairsMaps attributes 2018-08-18 01:02:48 +02:00
Ahmad Diaa 0f4c3064fd created struct for topologyPairs maps 2018-08-18 01:02:48 +02:00
Ahmad Diaa f6659e4543 further enhancements removing matchingTerms from metadata 2018-08-18 01:02:47 +02:00
Mohamed Mehany 3fb6912d08 add topologyValue map to reduce search space 2018-08-18 01:02:46 +02:00
Bobby (Babak) Salamat 2860743c86 Autogenerated files 2018-08-17 11:18:52 -07:00
Bobby (Babak) Salamat abb70aee98 Add a scheduler config argument to set the percentage of nodes to score 2018-08-17 11:18:51 -07:00
Bobby (Babak) Salamat a5045d107e Add NodeTree to the scheduler cache 2018-08-17 09:56:51 -07:00
Bobby (Babak) Salamat c1896c97ea Add a node tree that allows iterating over nodes in regions and zones 2018-08-17 09:56:51 -07:00
Kubernetes Submit Queue eeb3389f3b
Merge pull request #63260 from misterikkit/ecache-metrics
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

scheduler: add metrics to equivalence cache

This adds counters to equiv. cache reads & writes. Reads are labeled by
hit/miss, while writes are labeled to indicate whether the write was
discarded.

This will give us visibility into,
- hit rate of cache reads
- ratio of reads to writes
- rate of discarded writes



**What this PR does / why we need it**:

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes https://github.com/kubernetes/kubernetes/issues/63259

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-08-17 01:10:51 -07:00
Kubernetes Submit Queue 825548df95
Merge pull request #67464 from misterikkit/deadcode
Automatic merge from submit-queue (batch tested with PRs 67461, 67464, 67416). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Delete dead code in pkg/scheduler

**What this PR does / why we need it**:
This is just some cleanup. I found some unused code while evaluating the scheduler code.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
/kind cleanup
/sig scheduling
2018-08-15 20:09:09 -07:00
Jonathan Basseri fbf3d2b84c Delete dead code in pkg/scheduler.
This deletes some unused functions from the `Configurator` interface.
2018-08-15 17:14:38 -07:00
Jonathan Basseri a77e3bd16b Delete dead code.
This removes a fake Cache implementation that is not used anywhere
(anymore).
2018-08-15 17:14:37 -07:00
Jonathan Basseri b874d2789b Add metrics to equivalence cache.
This adds counters to equiv. cache reads & writes. Reads are labeled by
hit/miss, while writes are labeled to indicate whether the write was
discarded.

This will give us visibility into,
- hit rate of cache reads
- ratio of reads to writes
- rate of discarded writes
2018-08-15 15:51:13 -07:00
Wei Huang 976797c0b8
fix an issue in NodeInfo.Clone()
- usedPorts is a map-in-map struct, add fix to ensure it's deep copied
- updated unit test
2018-08-15 13:31:16 -07:00
Kubernetes Submit Queue d7634dcf23
Merge pull request #66856 from charrywanganthony/scheduler_space
Automatic merge from submit-queue (batch tested with PRs 66491, 66587, 66856, 66657, 66923). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

add space for output

**Release note**:
```release-note
NONE
```
2018-08-14 17:55:11 -07:00
Kubernetes Submit Queue 6274590518
Merge pull request #66656 from wackxu/fixappversion
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

 use apps/v1 version for scheduler

/kind cleanup

**Release note**:

```release-note
NONE
```
2018-08-11 23:25:33 -07:00
Avesh Agarwal be741feb1a Ouput volumes (total capacity and requests) too along with cpu and memory
when the feature BalanceAttachedNodeVolumes is used.
2018-08-07 15:40:33 -04:00
Avesh Agarwal ea7f711ae2 Fix incorrect reporting of total request including current pod in the
resource allocation priority function.
2018-08-07 15:37:55 -04:00
Harry Zhang 17d0190706 Use sync.map to scale ecache better 2018-08-07 14:06:09 +08:00
Chao Wang 895b6d441d add space for output 2018-08-01 18:08:31 +08:00
Kubernetes Submit Queue f4d8220df5
Merge pull request #65616 from cofyc/fix56163
Automatic merge from submit-queue (batch tested with PRs 65570, 65616). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Retry scheduling on StorageClass events

**What this PR does / why we need it**:

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #56163

**Special notes for your reviewer**:

I have taken over #60006.
It's hard to test in e2e, because we cannot know reschedule of pod is triggered by which event (periodically service/node events will move pods to active queue too). ~~I'll add integration tests for this functionality after [this PR](https://github.com/kubernetes/kubernetes/pull/65296) get merged.~~ (already added)

**Release note**:

```release-note
NONE
```
2018-07-31 19:18:00 -07:00
Kubernetes Submit Queue 0e9b1dd20f
Merge pull request #66671 from hanxiaoshuai/cleanup07261
Automatic merge from submit-queue (batch tested with PRs 63955, 66685, 66671). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

remove unused code in pkg/scheduler/algorithm/scheduler_interface_test.go

**What this PR does / why we need it**:
remove unused code in pkg/scheduler/algorithm/scheduler_interface_test.go
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-07-26 21:05:11 -07:00
Kubernetes Submit Queue fea4ad2783
Merge pull request #66670 from foxyriver/fix-log
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

fix error log

**What this PR does / why we need it**:

fix error log



**Release note**:

```release-note
NONE
```
2018-07-26 19:43:19 -07:00
Mayank Kumar a5b6d805ea Use GetControllerOf from apimachinery and remove kubernetes copy 2018-07-26 12:20:35 -07:00
hangaoshuai f3fb9e0f33 remove unused code in pkg/scheduler/algorithm/scheduler_interface_test.go 2018-07-26 21:01:50 +08:00
foxyriver 3b4f250c4a fix error log 2018-07-26 19:48:48 +08:00
wackxu ab35fa0414 update bazel 2018-07-26 17:37:29 +08:00
xushiwei 00425595 fed8572745 use apps/v1 version for scheduler 2018-07-26 17:37:29 +08:00
Kubernetes Submit Queue e4465b6e2f
Merge pull request #66599 from cofyc/fixfeaturegate
Automatic merge from submit-queue (batch tested with PRs 66540, 66599). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Invalidate CheckVolumeBinding predicate only when VolumeScheduling feature is enabled

**What this PR does / why we need it**:

Invalidate CheckVolumeBinding predicate only when VolumeScheduling feature is enabled.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-07-26 01:55:17 -07:00
Kubernetes Submit Queue 84a15d0291
Merge pull request #66540 from hanxiaoshuai/fixut0724
Automatic merge from submit-queue (batch tested with PRs 66540, 66599). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

replace predicates string with corresponding const in TestDefaultPredicates

**What this PR does / why we need it**:
replace predicates string with corresponding const in TestDefaultPredicates. Unify with the const in func defaultPredicates().
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-07-26 01:55:14 -07:00
Bobby (Babak) Salamat be55371ff2 minor cleanup of selector_spreading priority function 2018-07-25 13:43:37 -07:00
Yecheng Fu d2fc875489 Invalidate CheckVolumeBinding predicate only when VolumeScheduling
feature is enabled.
2018-07-25 15:11:23 +08:00
Kubernetes Submit Queue 4dbcf32b3c
Merge pull request #66471 from islinwb/improve_TestZeroRequest
Automatic merge from submit-queue (batch tested with PRs 66291, 66471, 66499). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Improve unit test TestZeroRequest

**What this PR does / why we need it**:

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #66468

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-07-24 13:59:58 -07:00
Kubernetes Submit Queue 2119d349b0
Merge pull request #66291 from resouer/fix-extender
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Extender preemption should respect IsInterested()

**What this PR does / why we need it**:

Extender preemption should respect IsInterested()

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #66289 

**Special notes for your reviewer**:

The bug is reported and the first commit is co-authored by: @chenchun

**Release note**:

```release-note
Extender preemption should respect IsInterested()
```
2018-07-24 13:48:38 -07:00
hangaoshuai 2c59a683a2 replace predicates string with corresponding const in TestDefaultPredicates 2018-07-24 14:27:36 +08:00
Weibin Lin 972e78748a add pod UID 2018-07-23 10:44:31 +08:00
Harry Zhang d644162a29 Extender preemption should respect IsInterested()
Co-authored-by: Harry Zhang <resouer@gmail.com>
Co-authored-by: Chun Chen <ramichen@tencent.com>
2018-07-23 10:13:38 +08:00
Weibin Lin 5449d153bb Improve unit test TestZeroRequest 2018-07-23 09:15:19 +08:00
Kubernetes Submit Queue 4797c8df8f
Merge pull request #63665 from xchapter7x/pkg-scheduler-core
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

use subtest for table units (pkg/scheduler/core)

**What this PR does / why we need it**: Update scheduler's unit table tests to use subtest

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:

**Special notes for your reviewer**:
breaks up PR: https://github.com/kubernetes/kubernetes/pull/63281
/ref #63267

**Release note**:

```release-note
This PR will leverage subtests on the existing table tests for the scheduler units.
Some refactoring of error/status messages and functions to align with new approach.

```
2018-07-21 01:52:30 -07:00
Kubernetes Submit Queue 827aa934ac
Merge pull request #66397 from gnufied/fix-default-max-volume-ebs
Automatic merge from submit-queue (batch tested with PRs 66410, 66398, 66061, 66397, 65558). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Fix volume limit for EBS on m5 and c5 instances

This is a fix for lower volume limits on m5 and c5 instance types while we wait for https://github.com/kubernetes/features/issues/554 to land GA.

This problem became urgent because many of our users are trying to migrate to those instance types in light of spectre/meltdown vulnerability but  lower volume limit on those instance types often causes cluster instability. Yes they can workaround by configuring the scheduler with lower limit but often this becomes somewhat difficult to do when cluster is mixed. 

The newer default limits were picked from https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/volume_limits.html

Text about spectre/meltdown is available on - https://community.bitnami.com/t/spectre-variant-2/54961/5

/sig storage
/sig scheduling

```release-note
Fix volume limit for EBS on m5 and c5 instance types
```
2018-07-20 18:51:11 -07:00
John Calabrese ad234e58be use subtest for table units
remove duplicate testname from error msg

remove subtest for test setup loop

do not break on test failure

  https://github.com/kubernetes/kubernetes/pull/63665#discussion_r203571355

remove duplicate test.name in output

  https://github.com/kubernetes/kubernetes/pull/63665#discussion_r203574001
  https://github.com/kubernetes/kubernetes/pull/63665#discussion_r203574012
2018-07-20 16:02:50 -04:00
Yecheng Fu 8f0373792f Retry scheduling on various events. 2018-07-20 09:54:34 +08:00
Kubernetes Submit Queue 795b7da8b0
Merge pull request #65714 from resouer/fix-63784
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Re-design equivalence class cache to two level cache

**What this PR does / why we need it**:

The current ecache introduced a global lock across all the nodes, and this patch tried to assign ecache per node to eliminate that global lock. The improvement of scheduling performance and throughput are both significant.

**CPU Profile Result** 

Machine: 32-core 60GB GCE VM

1k nodes 10k pods bench test (we've highlighted the critical function):

1. Current default scheduler with ecache enabled:
![equivlance class cache bench test 001](https://user-images.githubusercontent.com/1701782/42196992-51b0a32a-7eb3-11e8-89ee-f13383091a00.jpeg)
2. Current default scheduler with ecache disabled:
![equivlance class cache bench test 002](https://user-images.githubusercontent.com/1701782/42196993-51eb0c68-7eb3-11e8-9326-1a7762072863.jpeg)
3. Current default scheduler with this patch and ecache enabled:
![equivlance class cache bench test 003](https://user-images.githubusercontent.com/1701782/42196994-52280ed8-7eb3-11e8-8100-690e2af2cf2f.jpeg)

**Throughput Test Result** 

1k nodes 3k pods `scheduler_perf` test: 

Current default scheduler, ecache is disabled:
```bash
Minimal observed throughput for 3k pod test: 200
PASS
ok      k8s.io/kubernetes/test/integration/scheduler_perf    30.091s
```
With this patch, ecache is enabled:
```bash
Minimal observed throughput for 3k pod test: 556
PASS
ok      k8s.io/kubernetes/test/integration/scheduler_perf    11.119s
```

**Design and implementation:**

The idea is: we re-designed ecache into a "two level cache". 

The first level cache holds the global lock across nodes and sync is needed only when node is added or deleted, which is of much lower frequency. 

The second level cache is assigned per node and its lock is restricted to per node level, thus there's no need to bother the global lock during whole predicate process cycle. For more detail, please check [the original discussion](https://github.com/kubernetes/kubernetes/issues/63784#issuecomment-399848349).

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #63784

**Special notes for your reviewer**:

~~Tagged as WIP to make sure this does not break existing code and tests, we can start review after CI is happy.~~

**Release note**:

```release-note
Re-design equivalence class cache to two level cache
```
2018-07-19 16:16:02 -07:00
Hemant Kumar 45b8107378 Fix volume limit for EBS on m5 and c5 instances 2018-07-19 16:27:52 -04:00
Kubernetes Submit Queue 357decc9db
Merge pull request #63666 from xchapter7x/pkg-scheduler-factory
Automatic merge from submit-queue (batch tested with PRs 58487, 63666). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

use subtest for table units (pkg/scheduler/factory)

**What this PR does / why we need it**: Update scheduler's unit table tests to use subtest

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:

**Special notes for your reviewer**:
breaks up PR: https://github.com/kubernetes/kubernetes/pull/63281
/ref #63267

**Release note**:

```release-note
This PR will leverage subtests on the existing table tests for the scheduler units.
Some refactoring of error/status messages and functions to align with new approach.

```
2018-07-19 02:09:06 -07:00
Harry Zhang e5a7a4caf7 Fist level ecache for nodeMap
Use new cache map in scheduler

Add a integration test

Move init before schedudling

Add lock for first level cache
2018-07-18 15:11:59 +08:00
Harry Zhang 17977478e7 RWLock for cache 2018-07-18 15:11:59 +08:00
Nikhita Raghunath c166743272 scheduler: fix panic while removing node from imageStates cache 2018-07-16 11:42:28 +05:30
tanshanshan 06fb64cdf8 fix glogformat 2018-07-14 10:22:12 +08:00
Kubernetes Submit Queue b883f4cff8
Merge pull request #65745 from silveryfu/image-locality-scoring
Automatic merge from submit-queue (batch tested with PRs 66011, 66111, 66106, 66039, 65745). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Enable adaptive scoring in ImageLocalityPriority

**What this PR does / why we need it**:

This PR replaces the original, pure image-size based scoring to an adaptive scoring scheme. The new scoring scheme considers not only the image size but also its `"spread" `- the definition of `"spread"` is described in what follows: 

> Given an image`i`, `spread_i = num_node_has_i / total_num_nodes`  

And the image receives the score: `score_i = size_i * spread_i`, as proposed by @resouer. The final node score is the summation of image scores for all images found existing on the node that are mentioned in the pod spec.

The goal of this heuristic is to better _balance image locality with other scheduling policies_. In particular, it aims to mitigate and prevent the undesirable "node heating problem", _i.e._, pods get assigned to the same or a few nodes due to preferred image locality. Given an image, the larger `spread` it has the more image locality we can consider for it - since we can expect more nodes having this image.

The new image state information in scheduler cache, enabled in this PR, allows other potential heuristics to be explored.

**Special notes for your reviewer**:

@resouer 

Additional unit tests are WIP. 

**Release note**:

```release-note
NONE
```
2018-07-12 17:57:16 -07:00
Silvery Fu 2003a0db97 Rework image locality with spread-based scoring 2018-07-11 23:58:23 -07:00
Silvery Fu c3f111f74a Add image states to scheduler cache 2018-07-11 23:58:02 -07:00
Silvery Fu 05293233cf Update generated bazel 2018-07-11 23:57:34 -07:00
Yecheng Fu b841b15e27 Invalidate CheckVolumeBinding predicate cache on PV update. 2018-07-12 14:55:30 +08:00
Kubernetes Submit Queue f2db955b9d
Merge pull request #64363 from idealhack/sub-benchmarks/scheduler/schedulercache
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

scheduler: update tests to use sub-benchmarks (pkg/scheduler/cache)

**What this PR does / why we need it**:

Go 1.7 added the subtest feature which can make table-driven tests much easier to run and debug. Some tests are not using this feature.

Further reading: [Using Subtests and Sub-benchmarks](https://blog.golang.org/subtests)

/kind cleanup

**Release note**:

```release-note
NONE
```
2018-07-01 19:04:19 -07:00
Yang Li d7e12ce453 scheduler: update tests to use sub-benchmarks (pkg/scheduler/cache) 2018-07-01 00:51:42 +08:00
Kubernetes Submit Queue ea3451f83e
Merge pull request #65188 from aveshagarwal/master-rhbz-1555057
Automatic merge from submit-queue (batch tested with PRs 65188, 65541, 65534). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Increase glog level of some scheduling errors.

In our production environments, we are noticing that for every scheduling error, we are logging 3 errors at following lines:

1. https://github.com/kubernetes/kubernetes/blob/master/pkg/scheduler/scheduler.go#L194

2. https://github.com/kubernetes/kubernetes/blob/master/pkg/scheduler/factory/factory.go#L1416

3. https://github.com/kubernetes/kubernetes/blob/master/pkg/scheduler/factory/factory.go#L1323

This PR increases log levels of the last 2 errors to V(3).Infof. We can discuss if it would be helpful to increase the log level of the first error too.

@kubernetes/sig-scheduling-pr-reviews 
@bsalamat @k82cn @liggitt @sjenning 

```release-note
None.
```
2018-06-29 21:42:07 -07:00
Dr. Stefan Schimanski f8de7cea40 Update generated files 2018-06-29 20:36:17 +02:00
Avesh Agarwal c0cffb8a34 Increase glog level of some scheduling errors. 2018-06-28 23:34:29 -04:00
Kubernetes Submit Queue a13fe4d15d
Merge pull request #65424 from liggitt/scheduler-config
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Fix scheduler config decoding

Fixes #65413

Implements a custom unmarshaler for a single scheduler config type which did not correctly specify JSON tags until https://github.com/kubernetes/kubernetes/issues/65414 is resolved

Adds missing compatibility tests for scheduler extenders back to 1.7

```release-note
Fixes incompatibility with custom scheduler extender configurations specifying `bindVerb`
```
2018-06-25 00:21:35 -07:00
Jordan Liggitt fcaaf59359
Fix scheduler config decoding 2018-06-24 23:28:56 -04:00
Kubernetes Submit Queue f0311d8232
Merge pull request #65396 from bsalamat/sched_no_sort
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Improve scheduler's performance by eliminating sorting of nodes by their score

**What this PR does / why we need it**:
Profiling scheduler, I noticed that scheduler spends a significant amount of time in sorting the nodes after we score them to find nodes with the highest score. Finding nodes with the highest score does not need sorting the array. This PR replaces the sort with a linear scan.

Eliminating the sort results in over 10% improvement in throughput of the scheduler.

Before (3 runs for 5000 nodes, scheduling 1000 pods in a cluster running 2000 pods):
BenchmarkScheduling/5000Nodes/2000Pods-12         	    1000	  20682552 ns/op
BenchmarkScheduling/5000Nodes/2000Pods-12         	    1000	  20464729 ns/op
BenchmarkScheduling/5000Nodes/2000Pods-12         	    1000	  21188906 ns/op

After:
BenchmarkScheduling/5000Nodes/2000Pods-12         	    1000	  18485866 ns/op
BenchmarkScheduling/5000Nodes/2000Pods-12         	    1000	  18457749 ns/op
BenchmarkScheduling/5000Nodes/2000Pods-12         	    1000	  18418200 ns/op

**Release note**:

```release-note
Improve scheduler's performance by eliminating sorting of nodes by their score.
```
2018-06-23 20:12:01 -07:00
Bobby (Babak) Salamat ffc8cc2f50 Improve scheduler's performance by eliminating sorting when finding the host with the highest score 2018-06-23 11:24:43 -07:00
Kubernetes Submit Queue 582b88c879
Merge pull request #64995 from bsalamat/preempt_opt
Automatic merge from submit-queue (batch tested with PRs 65388, 64995). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Add more conditions to the list of predicate failures that won't be resolved by preemption

**What this PR does / why we need it**:
Adds more conditions to the list of predicate failures that won't be resolved by preemption. This change can potentially improve performance of preemption by avoiding the nodes that won't be able to schedule the pending pod no matter how many other pods are removed from them.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
Add more conditions to the list of predicate failures that won't be resolved by preemption.
```

/sig scheduling
2018-06-23 05:52:07 -07:00
Bobby (Babak) Salamat 8cdf83ed1e Add tests to cover newly added unresolvable failures 2018-06-22 17:06:19 -07:00
Bobby (Babak) Salamat fab26e470c Add more unresolvable conditions to optimize preemption logic 2018-06-22 17:04:55 -07:00
Jeff Grafton 23ceebac22 Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
Jeff Grafton a725660640 Update to gazelle 0.12.0 and run hack/update-bazel.sh 2018-06-22 16:22:18 -07:00
Kubernetes Submit Queue b45ba959c0
Merge pull request #64693 from xiechengsheng/fix-typos
Automatic merge from submit-queue (batch tested with PRs 65024, 65287, 65345, 64693, 64941). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Fix some typos in code comments.

Signed-off-by: xiechengsheng <XIE1995@whut.edu.cn>



**What this PR does / why we need it**:
Fix some typos in code comments.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
NONE

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-06-22 06:10:21 -07:00
xiechengsheng 66e0b53c3c fix some typos
Signed-off-by: xiechengsheng <XIE1995@whut.edu.cn>
2018-06-22 09:26:14 +08:00
Kubernetes Submit Queue 23b4690d00
Merge pull request #65306 from shyamjvs/fine-grained-scheduler-metric
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Split scheduler latency metric to fine-grained steps

This splits the summary metric we recently added into finer steps. It should be very useful for performance experiments.

/cc @wojtek-t 
fyi - @bsalamat @misterikkit 

Strictly speaking this is a breaking change, but since this metric was added only ~week ago I think it should fine (we should port this change to 1.11).

```release-note
Split 'scheduling_latency_seconds' metric into finer steps (predicate, priority, premption)
```
2018-06-21 09:11:58 -07:00
Shyam Jeedigunta b9ae20c99e Split scheduler latency metric to fine-grained steps 2018-06-21 14:19:39 +02:00
Kubernetes Submit Queue d1f5cb2348
Merge pull request #65050 from sttts/sttts-deepcopy-update
Automatic merge from submit-queue (batch tested with PRs 64895, 64938, 63700, 65050, 64957). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Bump gengo to include uniform pointer deepcopy

This bumps k8s.io/gengo with uniform pointer support in deepcopy-gen.

Fixes https://github.com/kubernetes/code-generator/issues/45.
2018-06-21 04:15:16 -07:00
Kubernetes Submit Queue 15902d9113
Merge pull request #63662 from xchapter7x/pkg-scheduler-algorithmprovider
Automatic merge from submit-queue (batch tested with PRs 64285, 63660, 63661, 63662, 64883). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

use subtest for table units (pkg/scheduler/algorithmprovider)

**What this PR does / why we need it**: Update scheduler's unit table tests to use subtest

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:

**Special notes for your reviewer**:
breaks up PR: https://github.com/kubernetes/kubernetes/pull/63281
/ref #63267

**Release note**:

```release-note
This PR will leverage subtests on the existing table tests for the scheduler units.
Some refactoring of error/status messages and functions to align with new approach.

```
2018-06-21 01:19:26 -07:00
Kubernetes Submit Queue 58574021a7
Merge pull request #63661 from xchapter7x/pkg-scheduler
Automatic merge from submit-queue (batch tested with PRs 64285, 63660, 63661, 63662, 64883). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

use subtest for table units (pkg/scheduler)

**What this PR does / why we need it**: Update scheduler's unit table tests to use subtest

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:

**Special notes for your reviewer**:
breaks up PR: https://github.com/kubernetes/kubernetes/pull/63281
/ref #63267

**Release note**:

```release-note
This PR will leverage subtests on the existing table tests for the scheduler units.
Some refactoring of error/status messages and functions to align with new approach.

```
2018-06-21 01:19:22 -07:00
Kubernetes Submit Queue 1712073165
Merge pull request #63660 from xchapter7x/pkg-scheduler-algorithm-predicates
Automatic merge from submit-queue (batch tested with PRs 64285, 63660, 63661, 63662, 64883). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

use subtest for table units (pkg/scheduler/algorithm/predicates)

**What this PR does / why we need it**: Update scheduler's unit table tests to use subtest

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:

**Special notes for your reviewer**:
breaks up PR: https://github.com/kubernetes/kubernetes/pull/63281
/ref #63267

**Release note**:

```release-note
This PR will leverage subtests on the existing table tests for the scheduler units.
Some refactoring of error/status messages and functions to align with new approach.

```
2018-06-21 01:19:18 -07:00
Jonathan Basseri 56b941f3df scheduler: fix equiv. cache logging.
Change the log messages to accurately reflect the cache behavior.
2018-06-20 10:52:33 -07:00
Jonathan Basseri c24842d806 Add a package docstring to core/equivalence. 2018-06-20 10:52:33 -07:00
Jonathan Basseri b571065bc4 Clean up names in equivalence package.
Remove stutter from names and provide more idiomatic patterns.

This makes call sites that use equivalence cache easier to read.
2018-06-20 10:52:33 -07:00
Jonathan Basseri 31c746d960 Move equivalence cache into new package.
This moves the equivalence cache implementation out of the 'core'
package and into k8s.io/kubernetes/pkg/scheduler/core/equivalence.

Separating the equiv. cache from the genericScheduler implementation
make their interaction points easier to follow, and prevents us from
accidentally accessing unexported fields.
2018-06-20 10:52:32 -07:00
Kubernetes Submit Queue bb6270bd92
Merge pull request #64692 from adohe/scheduler_cache
Automatic merge from submit-queue (batch tested with PRs 64882, 64692, 64389, 60626, 64840). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

update pod state of scheduler cache when UpdatePod

update pod state map in scheduler cache when call UpdatePod. @k82cn @bsalamat 

```release-note
keep pod state consistent when scheduler cache UpdatePod
```
2018-06-20 10:03:23 -07:00
Kubernetes Submit Queue dd040d6010
Merge pull request #63942 from misterikkit/ecache-cleanup
Automatic merge from submit-queue (batch tested with PRs 64142, 64426, 62910, 63942, 64548). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

scheduler: further cleanup of equivalence cache

**What this PR does / why we need it**:
This improves comments and simplifies some names/logic in equivalence_cache.go, as well as changing the order of some items in the file.


**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
/kind cleanup
2018-06-20 00:05:18 -07:00
Kubernetes Submit Queue 53d03c58cd
Merge pull request #64179 from wgliang/master.scheduler-unused-para
Automatic merge from submit-queue (batch tested with PRs 64252, 64307, 64163, 64378, 64179). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Remove unused parameter (pod) in `pkg/scheduler/core/generic_scheduler`

**What this PR does / why we need it**:

Remove unused parameter (pod) in `pkg/scheduler/core/generic_scheduler`

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-06-19 21:45:21 -07:00
Kubernetes Submit Queue e486e8f1f9
Merge pull request #63659 from xchapter7x/pkg-scheduler-algorithm-priorities-util
Automatic merge from submit-queue (batch tested with PRs 65230, 57355, 59174, 63698, 63659). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

use subtest for table units (pkg-scheduler-algorithm-priorities-util)

**What this PR does / why we need it**: Update scheduler's unit table tests to use subtest

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:

**Special notes for your reviewer**:
breaks up PR: https://github.com/kubernetes/kubernetes/pull/63281
/ref #63267

**Release note**:

```release-note
This PR will leverage subtests on the existing table tests for the scheduler units.
Some refactoring of error/status messages and functions to align with new approach.

```
2018-06-19 20:19:25 -07:00
Krzysztof Siedlecki e32910a544 Readding summary metrics 2018-06-14 15:05:12 +02:00
Krzysztof Siedlecki 0547bbf744 Revert "Fixing scheduling latency metrics"
This reverts commit 0e833bfc83.
2018-06-14 14:50:12 +02:00
Dr. Stefan Schimanski 1208437f84 Update generated files 2018-06-13 12:35:13 +02:00
John Calabrese f415558c30 use subtest for table units
implement PR feedback

replace errorf + return with fatalf

  https://github.com/kubernetes/kubernetes/pull/63662#discussion_r192540370
  https://github.com/kubernetes/kubernetes/pull/63662#discussion_r192540457
2018-06-08 11:44:24 -04:00
John Calabrese 0acc56a10d use subtest for table units
fix typos in subtest name

  pr feedback:
  - https://github.com/kubernetes/kubernetes/pull/63664#pullrequestreview-119554594

fix typo in test name

  https://github.com/kubernetes/kubernetes/pull/63664#discussion_r187712413
2018-06-08 11:30:19 -04:00
John Calabrese 7735dd6843 use subtest for table units
apply consistent format to name strings

  - #63661 (comment)
  - #63661 (comment)

inline subtest logic

  https://github.com/kubernetes/kubernetes/pull/63661/files#r192540031

remove duplicate messaging in subtest errors
2018-06-08 10:52:28 -04:00
AdoHe 6116c64f64 keep pod state consistent when UpdatePod 2018-06-06 21:13:12 +08:00
xiechengsheng cd65afdf05 fix some typos
Signed-off-by: xiechengsheng <XIE1995@whut.edu.cn>
2018-06-06 13:11:26 +08:00
John Calabrese 8bbf182695 use subtest for table units
apply subtest to predicates
2018-06-05 09:07:57 -04:00
Silvery Fu 8792f99bf8 Fix the handling of untagged images 2018-06-04 13:57:09 -07:00
Silvery Fu 73970a5027 Update generated bazel 2018-06-04 13:56:51 -07:00
Łukasz Osipiuk 98041d0925 Allow parametrization of RequestedToCapacityRatio priority function via policy config 2018-06-04 12:28:54 +02:00
Łukasz Osipiuk 4684d5aac6 Register RequestedToCapacityRatioPriority priority function 2018-06-04 11:30:57 +02:00
Hemant Kumar a0a9ccfa87 Implement scheduler changes for volume limits 2018-06-01 19:17:31 -04:00
Guoliang Wang 761cf41427 Move pkg/scheduler/schedulercache -> pkg/scheduler/cache 2018-05-31 22:55:34 +08:00
Kubernetes Submit Queue b5d21a92ad
Merge pull request #64339 from liztio/pronouns
Automatic merge from submit-queue (batch tested with PRs 61803, 64305, 64170, 64361, 64339). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Remove some unnecessarily gendered pronouns in comments

**What this PR does / why we need it**:

A bunch of comments are unnecessarily gendered. I've changed them to gender-neutral they/theirs.

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-05-30 17:34:25 -07:00
Krzysztof Siedlecki 0e833bfc83 Fixing scheduling latency metrics 2018-05-30 11:20:12 +02:00
Jonathan Basseri ba08b05e28 Rename equiv. class invalidation functions.
Change the invalidation functions to have cleaner and more consistent
names.
2018-05-29 11:23:13 -07:00
Jonathan Basseri 5d13798e5c Change the return of EquivalenceClass.lookupResult.
This makes the lookup behave like a normal map lookup, so it is easier
for readers to follow the logic. It also inverts the "invalid" bool to
an "ok" bool because `!invalid` is a double negative.
2018-05-29 11:22:02 -07:00
Jonathan Basseri 9b06870620 Clean up names and comments in equivalence cache. 2018-05-29 11:22:02 -07:00
John Calabrese c6379cef0e use subtest for table units 2018-05-28 09:41:31 -04:00
John Calabrese d1abc5c824 use subtest for table units
employ consitent table var naming

  - https://github.com/kubernetes/kubernetes/pull/63659#discussion_r187736533
2018-05-28 09:33:42 -04:00
Kubernetes Submit Queue d057795f3b
Merge pull request #64278 from silveryfu/master
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Adding tests for ImageLocalityPriority

**What this PR does / why we need it**:

This PR adds tests for ImageLocalityPriority scheduling policy, as follow-ups of [#63842](https://github.com/kubernetes/kubernetes/issues/63842) and [#63345](https://github.com/kubernetes/kubernetes/issues/63345). It includes the unit test for ImageSizes function of NodeInfo in the scheduler cache.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

@resouer 

**Release note**:

```release-note
NONE
```
2018-05-26 12:46:57 -07:00
liz ffeca16101
Remove some unnecessarily gendered pronouns in comments 2018-05-25 17:48:17 -04:00
Kubernetes Submit Queue 8b442973ac
Merge pull request #64302 from krmayankk/refactor-rbd
Automatic merge from submit-queue (batch tested with PRs 64204, 64302). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

simplify logic and remove else blocks

```release-note
NONE
```
2018-05-25 05:47:07 -07:00
Kubernetes Submit Queue 89b73711fe
Merge pull request #64049 from aveshagarwal/master-scheduler-flake
Automatic merge from submit-queue (batch tested with PRs 61963, 64279, 64130, 64125, 64049). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Fix TestSchedulerWithVolumeBinding to avoid setting predicate ordering.

It is causing data race condition as predicate ordering is changing global
variable `predicatesOrdering`. Infact this test does not require any special
predicate order and should work on default predicate ordering as far as
VolumeScheduling feature is enabled.

See these logs:

```
==================
==================
WARNING: DATA RACE
Read at 0x00c420894180 by goroutine 156:
  k8s.io/kubernetes/pkg/scheduler/core.podFitsOnNode()
      /home/avagarwa/upstream-code/gocode/src/k8s.io/kubernetes/pkg/scheduler/core/generic_scheduler.go:503 +0xbb
  k8s.io/kubernetes/pkg/scheduler/core.(*genericScheduler).findNodesThatFit.func1()
      /home/avagarwa/upstream-code/gocode/src/k8s.io/kubernetes/pkg/scheduler/core/generic_scheduler.go:353 +0x2f0
  k8s.io/kubernetes/vendor/k8s.io/client-go/util/workqueue.Parallelize.func1()
      /home/avagarwa/upstream-code/gocode/src/k8s.io/kubernetes/vendor/k8s.io/client-go/util/workqueue/parallelizer.go:47 +0xa3

Previous write at 0x00c420894180 by goroutine 186:
  k8s.io/kubernetes/pkg/scheduler.TestSchedulerWithVolumeBinding()
      /home/avagarwa/upstream-code/gocode/src/k8s.io/kubernetes/pkg/scheduler/scheduler_test.go:663 +0x71
  testing.tRunner()
      /usr/lib/golang/src/testing/testing.go:777 +0x16d

Goroutine 156 (running) created at:
  k8s.io/kubernetes/vendor/k8s.io/client-go/util/workqueue.Parallelize()
      /home/avagarwa/upstream-code/gocode/src/k8s.io/kubernetes/vendor/k8s.io/client-go/util/workqueue/parallelizer.go:43 +0x139
  k8s.io/kubernetes/pkg/scheduler/core.(*genericScheduler).findNodesThatFit()
      /home/avagarwa/upstream-code/gocode/src/k8s.io/kubernetes/pkg/scheduler/core/generic_scheduler.go:378 +0xe8a
  k8s.io/kubernetes/pkg/scheduler/core.(*genericScheduler).Schedule()
      /home/avagarwa/upstream-code/gocode/src/k8s.io/kubernetes/pkg/scheduler/core/generic_scheduler.go:131 +0x385
  k8s.io/kubernetes/pkg/scheduler.(*Scheduler).schedule()
      /home/avagarwa/upstream-code/gocode/src/k8s.io/kubernetes/pkg/scheduler/scheduler.go:192 +0xcd
  k8s.io/kubernetes/pkg/scheduler.(*Scheduler).scheduleOne()
      /home/avagarwa/upstream-code/gocode/src/k8s.io/kubernetes/pkg/scheduler/scheduler.go:447 +0x598
  k8s.io/kubernetes/pkg/scheduler.(*Scheduler).(k8s.io/kubernetes/pkg/scheduler.scheduleOne)-fm()
      /home/avagarwa/upstream-code/gocode/src/k8s.io/kubernetes/pkg/scheduler/scheduler.go:182 +0x41
  k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/util/wait.JitterUntil.func1()
      /home/avagarwa/upstream-code/gocode/src/k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:133 +0x61
  k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/util/wait.JitterUntil()
      /home/avagarwa/upstream-code/gocode/src/k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:134 +0xcd
  k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/util/wait.Until()
      /home/avagarwa/upstream-code/gocode/src/k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:88 +0x5a

Goroutine 186 (running) created at:
  testing.(*T).Run()
      /usr/lib/golang/src/testing/testing.go:824 +0x564
  testing.runTests.func1()
      /usr/lib/golang/src/testing/testing.go:1063 +0xa4
  testing.tRunner()
      /usr/lib/golang/src/testing/testing.go:777 +0x16d
  testing.runTests()
      /usr/lib/golang/src/testing/testing.go:1061 +0x4e1
  testing.(*M).Run()
      /usr/lib/golang/src/testing/testing.go:978 +0x2cd
  main.main()
      _testmain.go:52 +0x22a
==================
--- FAIL: TestSchedulerWithVolumeBinding (18.04s)
	testing.go:730: race detected during execution of test
FAIL
```

It is pretty easy to reproduce this race by following these steps:

```
cd pkg/scheduler
go test -c -race
stress -p 100 ./scheduler.test
```

Predicate ordering to this unit test was added here: https://github.com/kubernetes/kubernetes/pull/57168
Since the whole scheduler instance uses just one ordering at time, not sure what is the advantage. 

@kubernetes/sig-scheduling-bugs @bsalamat @k82cn @frobware @smarterclayton @sjenning 

```release-note
None
```
2018-05-25 01:09:29 -07:00
Mayank Kumar 83818ee0c8 simplify else 2018-05-25 00:38:54 -07:00
Silvery Fu 096dda3768 Rename and add unit test for ImageSizes 2018-05-24 23:29:23 -07:00
Kubernetes Submit Queue b8dff0b4f1
Merge pull request #63975 from godliness/lock-optimization
Automatic merge from submit-queue (batch tested with PRs 63434, 64172, 63975, 64180, 63755). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Optimize the lock which in the RunPredicate

**What this PR does / why we need it**:


Enhance the performance of scheduler

-  Change the lock in the RunPredicate from lock to rlock




**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:

Could solve part of #63784 

**Special notes for your reviewer**:

_Run benchmark test by scheduler_perf_:
`Before`  BenchmarkScheduling/1000Nodes/0Pods-32     1000    11689758 ns/op
`After`     BenchmarkScheduling/1000Nodes/0Pods-32     1000    5951510 ns/op

_Run integration (density) test by scheduler_perf_:
Schedule 3000 Pods On 3000 Nodes
`Before`  rate  19 per second on average
`After`     rate  58 per second on average

_Cpu profile test result_:
`Before`  [click](https://cdn.rawgit.com/godliness/files/master/63784_before.svg)
`After`     [click](https://cdn.rawgit.com/godliness/files/master/63784_after.svg)

**Release note**:

```release-note
`None`
```

/sig scheduling

/cc @misterikkit 
/cc @bsalamat
/cc @ravisantoshgudimetla 
/cc @resouer
2018-05-24 12:18:17 -07:00
Kubernetes Submit Queue a80b334bcb
Merge pull request #63895 from misterikkit/warning-note
Automatic merge from submit-queue (batch tested with PRs 64127, 63895, 64066, 64215, 64202). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Add warnings about cache invalidation.

Part of https://github.com/kubernetes/kubernetes/pull/63040 is the
assumption that scheduler cache updates must happen before equivalence
cache updates for any given informer event.

The reason for this is that the equivalence cache implementation checks
the main cache for staleness while holding the equiv. cache write lock.

case 1: If an informer invalidates an equiv. cache entry before the
staleness check, then we know that the main cache update completed.

case 2: If an informer blocks trying to grab the equiv. cache lock, then
invalidation will occur right after the potentially stale update is
written.

This patch adds a note to places where we invalidate the equivalence
cache so that hopefully nobody violates this invariant.



**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
/kind cleanup
/sig scheduling
2018-05-24 10:45:15 -07:00
Kubernetes Submit Queue 2a18b02641
Merge pull request #64216 from misterikkit/nil-or-empty
Automatic merge from submit-queue (batch tested with PRs 64174, 64187, 64216, 63265, 64223). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Do not use DeepEqual to compare slices in test.

This wraps DeepEqual with a helper that considers nil slices and empty
slices to be equal.

Scheduler code might use a nil slice or empty slice to represent an
empty list, so tests should not be sensitive to the difference.  Tests
could fail because DeepEqual considers nil to be different from an empty
slice.



**What this PR does / why we need it**:
Avoid breaking tests in cases where application behavior is not changed.

**Special notes for your reviewer**:
This brittle test keeps breaking in a number of my PRs. Hoping to get this fix merged independently.

**Release note**:

```release-note
NONE
```

/sig scheduling
/kind cleanup
2018-05-24 09:41:17 -07:00
godliness 506271b363 Optimize the lock which in the RunPredicate 2018-05-24 10:41:19 +08:00
Jonathan Basseri 2de996856f Do not use DeepEqual to compare slices in test.
This wraps DeepEqual with a helper that considers nil slices and empty
slices to be equal.

Scheduler code might use a nil slice or empty slice to represent an
empty list, so tests should not be sensitive to the difference.  Tests
could fail because DeepEqual considers nil to be different from an empty
slice.
2018-05-23 11:18:00 -07:00
Guoliang Wang 097094e5fa Remove unused parameter (pod) 2018-05-23 13:56:17 +08:00
Kubernetes Submit Queue c0f1cb67e3
Merge pull request #64032 from wgliang/master.rmove-scheduler-unused
Automatic merge from submit-queue (batch tested with PRs 63283, 64032, 64159, 64126, 64098). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

remove unused code of (pkg/scheduler)

**What this PR does / why we need it**:
/kind cleanup

remove unused code


**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-05-22 22:14:07 -07:00
Jonathan Basseri 18a8184dce Add warnings about cache invalidation.
Part of https://github.com/kubernetes/kubernetes/pull/63040 is the
assumption that scheduler cache updates must happen before equivalence
cache updates for any given informer event.

The reason for this is that the equivalence cache implementation checks
the main cache for staleness while holding the equiv. cache write lock.

case 1: If an informer invalidates an equiv. cache entry before the
staleness check, then we know that the main cache update completed.

case 2: If an informer blocks trying to grab the equiv. cache lock, then
invalidation will occur right after the potentially stale update is
written.

This patch adds a note to places where we invalidate the equivalence
cache so that hopefully nobody violates this invariant.
2018-05-22 15:15:37 -07:00
Kubernetes Submit Queue 0a2467d849
Merge pull request #63459 from resouer/fix-63427
Automatic merge from submit-queue (batch tested with PRs 63598, 63913, 63459, 63963, 60464). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Check nodeInfo before ecache predicate

**What this PR does / why we need it**:

There's chances during test when nodeInfo is nil which may cause ecache predicate fail with nil pointer.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #63427

**Special notes for your reviewer**:

Not sure how to reproduce the original issue yet. i.e. why and when `nodeInfo` will become nil in tests is not clear to me, that's why I label it as WIP.

cc @bsalamat who may have more inputs.

**Release note**:

```release-note
NONE
```
2018-05-19 06:49:19 -07:00
Avesh Agarwal ea057eb9b5 Fix TestSchedulerWithVolumeBinding to avoid setting predicate ordering.
It is causing data race condition as predicate ordering is changing global
variable predicatesOrdering. Infact this test does not require any special
predicate order and should work on default predicate ordering as far as
VolumeScheduling feature is enabled.
2018-05-18 14:19:26 -04:00
Guoliang Wang 9219a76266 remove unused code of (pkg/scheduler) 2018-05-18 23:48:43 +08:00
Kubernetes Submit Queue 9a15ee7035
Merge pull request #63749 from wenlxie/githubupstream.master.minofixforgetstorageclass
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

minor fix for VolumeZoneChecker predicate 

storageclass can be in annotation and spec.

```release-note
minor fix for VolumeZoneChecker predicate, storageclass can be in annotation and spec.
```
2018-05-17 05:51:05 -07:00
wenlxie 38106e7f0b storageclass can be in annotation and spec 2018-05-16 20:49:09 +08:00
Kubernetes Submit Queue af9531b8a7
Merge pull request #63658 from xchapter7x/pkg-scheduler-algorithm-priorities
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

use subtest for table units (pkg-scheduler-algorithm-priorities)

**What this PR does / why we need it**: Update scheduler's unit table tests to use subtest

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:

**Special notes for your reviewer**:
breaks up PR: https://github.com/kubernetes/kubernetes/pull/63281
/ref #63267

**Release note**:

```release-note
This PR will leverage subtests on the existing table tests for the scheduler units.
Some refactoring of error/status messages and functions to align with new approach.

```
2018-05-15 14:12:39 -07:00
Kubernetes Submit Queue c4994e17d6
Merge pull request #63603 from resouer/clean-cache
Automatic merge from submit-queue (batch tested with PRs 63603, 63557, 62015). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Clean up equiv cache with a simple implementation instead of LRU

**What this PR does / why we need it**:

The original version of equiv cache use pod hash as cache key, also, the predicate order is not fixed. So I used a LRU cache to improve hit rate.

While now we've already refactored it to use predicates as keys, and its order was also fixed in scheduler, we can use a simplest cache instead now.

**Special notes for your reviewer**:

The question is brought up by @misterikkit

**Release note**:

```release-note
NONE
```
2018-05-15 02:07:38 -07:00
Harry Zhang 7f01ce4ec0 Update generated bazel 2018-05-11 14:25:23 +08:00
Harry Zhang 0377c69aad Use simple cache instead of LRU
Update generated bazel

Use map instead
2018-05-11 14:25:17 +08:00
John Calabrese 3a9e988015 use subtest for table units 2018-05-10 07:12:20 -04:00
Kubernetes Submit Queue aea6addb82
Merge pull request #62934 from wackxu/scto
Automatic merge from submit-queue (batch tested with PRs 62354, 62934, 63502). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Refactor GetResourceRequest and GetResourceLimit

**What this PR does / why we need it**:

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:
/assign @bsalamat 

**Release note**:

```release-note
NONE
```
2018-05-09 09:30:11 -07:00
Kubernetes Submit Queue 0949cefd7b
Merge pull request #62453 from k82cn/k8s_61410_2
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Supported nodeSelector.matchFields in scheduler.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
part of  #61410

**Special notes for your reviewer**:

**Release note**:
```release-note
Supported nodeSelector.matchFields (node's `metadata.node`) in scheduler.
```
2018-05-09 02:47:21 -07:00
wackxu adea3733a8 add SetMaxResource for Resource 2018-05-09 15:33:24 +08:00
Kubernetes Submit Queue 13f3c7c7ca
Merge pull request #63120 from wgliang/master.remove-todo
Automatic merge from submit-queue (batch tested with PRs 58580, 63120). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

-Remove TODO comment of GetNonzeroRequests function

**What this PR does / why we need it**:

-Remove TODO comment of GetNonzeroRequests function

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
NONE

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-05-08 21:45:13 -07:00
Silvery Fu 4087ff32bc Build image size map upon node info updates 2018-05-08 15:02:18 -07:00
Kubernetes Submit Queue 8d064823bb
Merge pull request #63264 from bsalamat/monotonic_generation
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Increase scheduler cache generation number monotonically in order to avoid collision

**What this PR does / why we need it**:
Increments the scheduler cache generation number monotonically to avoid collision of the generation numbers. More context in #63262.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #63262.

**Special notes for your reviewer**:

**Release note**:

```release-note
Increase scheduler cache generation number monotonically in order to avoid collision and use of stale information in scheduler.
```
2018-05-08 03:45:57 -07:00
Harry Zhang 8df3ab75a4 Check nodeInfo before ecache 2018-05-06 22:42:20 +08:00
David Eads 94e3d94d67 update tests to be specific about the versions they are testing instead of floating 2018-05-01 13:18:41 -04:00
Kubernetes Submit Queue 12a6236148
Merge pull request #63178 from misterikkit/ecache-locking
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

scheduler: clean up and simplify equivalence cache locking

**What this PR does / why we need it**:
This is a cleanup of the locking code for equivalence cache. There is no change to the current logic or locking. This PR has a couple of implications, though.
1. It deletes (unreachable) code that could have been used to cache predicate results that consider nominated pods.
2. Callers should no longer lock/unlock the eCache manually, so coordinating that lock with other synchronization is restricted.


**Special notes for your reviewer**:

**Release note**:
<!--  Write your release note:
1. Enter your extended release note in the below block. If the PR requires additional action from users switching to the new release, include the string "**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #
action required".
2. If no release note is required, just write "NONE".
-->
```release-note
NONE
```
/sig scheduling
/kind cleanup
2018-04-30 19:29:49 -07:00
ceshihao 7f24a7c984 run make update 2018-04-28 15:43:09 +00:00
Da K. Ma b1a7f85c9e Supported matchField for NodeAffinity.
Signed-off-by: Da K. Ma <klaus1982.cn@gmail.com>
2018-04-28 11:10:29 +08:00
ceshihao 56b3f2f409 move pkg/scheduler/util/testutil.go to pkg/scheduler/testing 2018-04-28 02:36:04 +00:00
Bobby (Babak) Salamat 3cfed68c7a fixup! Make scheduler cache generation number monotonic to avoid collision 2018-04-27 17:52:02 -07:00
Jonathan Basseri 79d30b1ad6 Hide EquivalenceCache mutex from users.
Since the equiv. cache lock no longer needs to be held across multiple
method calls, move the locking inside and don't expose it to users.
2018-04-27 15:55:10 -07:00
Jonathan Basseri b85184227d Rename exported methods on EquivalenceCache.
This changes two methods in EquivalenceCache to be unexported, because
they should no longer be called by users of this type. (Even users in
the same package!)
2018-04-27 15:55:10 -07:00
Jonathan Basseri 55662f26f1 Simplify logic in podFitsOnNode.
Use new (*EquivalenceCache).RunPredicate to simplify how we read and
update the equivalence cache items.
2018-04-27 15:55:10 -07:00
Jonathan Basseri e67b3225a4 Remove predicateResults map from podFitsOnNode.
The purpose of this map is to combine two predicate results before
writing to the equivalence cache. However, the branch that combines
results is unreachable.

1. Combining results happens in the second iteration of the outer loop.
2. There is only a second iteration when podsAdded is true.
3. We skip equiv. cache when podsAdded is true.
2018-04-27 15:55:10 -07:00
Jonathan Basseri ca6b312c97 Add RunPredicate to EquivalenceCache.
This method combines "lookup" and "update" into one operation. The
benefit is that this method call is very similar to running an ordinary
predicate, so callers can simplify their code.
2018-04-27 15:55:10 -07:00
Bobby (Babak) Salamat b90892fa95 Make scheduler cache generation number monotonic to avoid collision 2018-04-27 13:23:25 -07:00
Kubernetes Submit Queue 6b64c07baf
Merge pull request #59735 from wgliang/master.predicates_test
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Add test for scheduler:VolumeCountConflicts

**What this PR does / why we need it**:
Add test for scheduler:VolumeCountConflicts

**Special notes for your reviewer**:
2018-04-26 20:41:33 -07:00
Kubernetes Submit Queue 0cf3788419
Merge pull request #63174 from misterikkit/equivHash
Automatic merge from submit-queue (batch tested with PRs 62937, 63105, 63031, 63174). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Revert "Revert "Revert revert of equivalence class hash calculation i…

…n scheduler""

This reverts commit 4386751b5d.



**What this PR does / why we need it**:
This re-introduces the change from https://github.com/kubernetes/kubernetes/pull/58555 which changes how the scheduler computes equivalence classes of pods. I believe we have fixed the flakiness observed previously (https://github.com/kubernetes/kubernetes/issues/61512, https://github.com/kubernetes/kubernetes/issues/62921). I have run the test in question a few dozen times without a failure.

```bash
make test-integration WHAT="./test/integration/scheduler" KUBE_TEST_ARGS="-run TestPreemptionStarvation" GOFLAGS="-v"
```

/ref https://github.com/kubernetes/kubernetes/issues/58222

**Special notes for your reviewer**:
I had to resolve several merge conflicts. I think I resolved them correctly, but keep an eye out for anything silly.

**Release note**:

```release-note
NONE
```
/sig scheduling
2018-04-26 16:40:19 -07:00
David Eads a89291a5de stop duplicating preferred version order 2018-04-26 10:03:36 -04:00
Da K. Ma 2c10d15ae5 Do not schedule pod to the node under PID pressure.
Signed-off-by: Da K. Ma <klaus1982.cn@gmail.com>
2018-04-26 10:07:42 +08:00
Jonathan Basseri eace2d08d0 Revert "Revert "Revert revert of equivalence class hash calculation in scheduler""
This reverts commit 4386751b5d.
2018-04-25 16:11:59 -07:00
Kubernetes Submit Queue 6251402266
Merge pull request #63040 from misterikkit/ecache-race
Automatic merge from submit-queue (batch tested with PRs 62432, 62868, 63040). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

scheduler: fix race condition in equivalence cache

**What this PR does / why we need it**:
This adds an equivalence cache test to exercise the race condition observed in https://github.com/kubernetes/kubernetes/issues/62921 and then fixes the race.

The `Cache` interface needed a new method to check whether a `NodeInfo` is stale, and `genericScheduler` needed some plumbing to make the `Cache` object available to `podFitsOnNode()`.

The solution is, right before writing to the eCache, check the scheduler cache to see if the current `NodeInfo` object is out of date. If the node is out of date, then don't write to the eCache. If the `NodeInfo` is stale, it is because of a cache update that should also invalidate the eCache entry. That invalidation either happens before `podFitsOnNode()` acquires the eCache lock (original bug, so we don't do the write) or blocks until we release that lock (removing the potentially bad entry).

Fixes #62921 

**Special notes for your reviewer**:

**Release note**:

equivalence cache is still alpha, so no release note.
```release-note
NONE
```
/sig scheduling
/assign bsalalamat
/assign resouer
2018-04-25 12:56:14 -07:00
Kubernetes Submit Queue e270b8aace
Merge pull request #63067 from k82cn/k8s_63027
Automatic merge from submit-queue (batch tested with PRs 62982, 63075, 63067, 62877, 63141). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Removed e2e test on empty NodeAffinity.

Signed-off-by: Da K. Ma <klaus1982.cn@gmail.com>

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #63027 

**Special notes for your reviewer**:
In #62448, we removed the validation on empty `nodeAffinity` which is already handled in scheduler: select no objects.

**Release note**:
```release-note
None
```
2018-04-25 11:53:17 -07:00
Jonathan Basseri dacc1a8d52 Check for old NodeInfo when updating equiv. cache.
Because the scheduler takes a snapshot of cache data at the start of
each scheduling cycle, updates to the equivalence cache should be
skipped if there was a cache update during the cycle.

If the current NodeInfo becomes stale while we evaluate predicates, we
will not write any results into the equivalence cache. We will still use
the results for the current scheduling cycle, though.
2018-04-25 10:18:40 -07:00
Jonathan Basseri ca7bfc02ee Add IsUpTodate() to Cache interface.
This allows scheduler implementations to check if a NodeInfo object
matches the current state of the cache. Useful if the NodeInfo in
question came from a Snapshot() for example.
2018-04-25 10:18:40 -07:00
Jonathan Basseri 02d657827c Test race condition in equivalence cache.
Add a unit test that invalidates equivalence cache during a scheduling
cycle. This exercises the bug described in
https://github.com/kubernetes/kubernetes/issues/62921
2018-04-25 10:18:40 -07:00
Kubernetes Submit Queue 02e3577ab1
Merge pull request #60009 from zetaab/nodetaint
Automatic merge from submit-queue (batch tested with PRs 63129, 63066, 60009, 63136, 63086). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

add node shutdown taint

**What this PR does / why we need it**: we need node stopped taint in order to detach volumes immediately without waiting timeout. More info in issue ticket #58635 

**Which issue(s) this PR fixes** 
Fixes #58635

**Special notes for your reviewer**: this was reverted, original PR https://github.com/kubernetes/kubernetes/pull/59323 Hopefully now bugs are fixed. However, I will execute more tests manually today.

**Release note**:
```release-note
NONE
```
2018-04-25 06:29:22 -07:00
Da K. Ma 793ed98715 Added more UT for invalid case.
Signed-off-by: Da K. Ma <klaus1982.cn@gmail.com>
2018-04-25 11:14:24 +08:00
Guoliang Wang e075309b0d -Remove TODO comment of GetNonzeroRequests function 2018-04-25 10:44:43 +08:00
Bobby (Babak) Salamat a073dfdbd9 Fix scheduler Pod informers to receive events when pods are scheduled by other schedulers. 2018-04-23 11:07:53 -07:00
Jesse Haka de967b717d PR #59323, fix bug and remove one api call, add node util dependency to cloud controller 2018-04-22 20:32:26 +03:00
Kubernetes Submit Queue bdd6ff40db
Merge pull request #62765 from wgliang/master.pob-name-conflict
Automatic merge from submit-queue (batch tested with PRs 61324, 62880, 62765). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

-Fix the name could cause a conflict if an object with the same name …

…is created in a different namespace

**What this PR does / why we need it**:
/kind bug

Using the name could cause a conflict if an object with the same name is created in a different namespace

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #
#62750

**Special notes for your reviewer**:
/assign @bsalamat 

**Release note**:
```
NONE
```
2018-04-20 17:23:23 -07:00
Guoliang Wang df49a4b8c6 -Fix the name could cause a conflict if an object with the same name is created in a different namespace 2018-04-20 11:37:46 +08:00
Kubernetes Submit Queue 1e39d68ecb
Merge pull request #62243 from resouer/fix-62068
Automatic merge from submit-queue (batch tested with PRs 59592, 62308, 62523, 62635, 62243). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Separate pod priority from preemption

**What this PR does / why we need it**:
Users request to split priority and preemption feature gate so they can use priority separately.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #62068 

**Special notes for your reviewer**:

~~I kept use `ENABLE_POD_PRIORITY` as ENV name for gce cluster scripts for backward compatibility reason. Please let me know if other approach is preffered.~~

~~This is a potential **break change** as existing clusters will be affected, we may need to include this in 1.11 maybe?~~

TODO: update this doc https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/

[Update] Usage: in config file for scheduler:
```yaml
apiVersion: componentconfig/v1alpha1
kind: KubeSchedulerConfiguration
...
disablePreemption: true
```

**Release note**:

```release-note
Split PodPriority and PodPreemption feature gate
```
2018-04-19 14:50:27 -07:00
Kubernetes Submit Queue 98968c36d8
Merge pull request #62715 from bsalamat/fix_antiaffinity
Automatic merge from submit-queue (batch tested with PRs 62761, 62715). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Fix inter-pod anti-affinity check to consider a pod a match when all the anti-affinity terms match

**What this PR does / why we need it**:
Inter-pod anti-affinity check used to incorrectly consider a pod a match when any of the anti-affinity terms matched the pod. This PR fixes the logic to consider a pod a match when all the terms match the pod.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #62567

**Special notes for your reviewer**:

**Release note**:

```release-note
Fix inter-pod anti-affinity check to consider a pod a match when all the anti-affinity terms match.
```

/sig scheduling
2018-04-17 22:38:13 -07:00
Bobby (Babak) Salamat eb213e68c2 Fix anti-affinity issue that caused a pod to be considered a match if any of the terms matched (as opposed to all terms matched) 2018-04-16 23:47:46 -07:00
Bobby (Babak) Salamat 4f2155ae22 Addressed reviewer comments 2018-04-16 16:09:24 -07:00
Bobby (Babak) Salamat c590ec7ae9 Fix an issue in inter-pod affinity predicate that cause affinity to self being processed incorrectly 2018-04-14 19:46:38 -07:00
Bobby (Babak) Salamat 4d7fff1257 Add test to ensure anti-affinity matches against all terms 2018-04-14 19:32:58 -07:00
Kubernetes Submit Queue 3cdf5eecd7
Merge pull request #62211 from bsalamat/affinity_performance
Automatic merge from submit-queue (batch tested with PRs 62467, 62482, 62211). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Improve performance of affinity/anti-affinity predicate by 20x in large clusters

**What this PR does / why we need it**:
Improves performance of affinity/anti-affinity predicate by over 20x in large clusters. Performance improvement is smaller in small clusters, but it is still very significant and is about 4x. Also, before this PR, performance of the predicate was dropping quadratically with increasing size of nodes and pods. As the results shows, the slow down is now linear in larger clusters.

Affinity/anti-affinity predicate was checking all pods of the cluster for each node in the cluster to determine feasibility of affinit/anti-affinity terms of the pod being scheduled. This optimization first finds all the pods in a cluster that match the affinity/anti-affinity terms of the pod being scheduled once and stores the metadata. It then only checks the topology of the matching pods for each node in the cluster. 
 This results in major reduction of the search space per node and improves performance significantly. 

Below results are obtained by running scheduler benchmarks:
```
make test-integration WHAT=./test/integration/scheduler_perf KUBE_TEST_ARGS="-run=xxx -bench=.*BenchmarkSchedulingAntiAffinity"
```
```
AntiAffinity Topology: Hostname
before: BenchmarkSchedulingAntiAffinity/500Nodes/250Pods-12         	     	  37031638 ns/op
after:  BenchmarkSchedulingAntiAffinity/500Nodes/250Pods-12         	     	  10373222 ns/op

before: BenchmarkSchedulingAntiAffinity/500Nodes/5000Pods-12        	     	 134205302 ns/op
after:  BenchmarkSchedulingAntiAffinity/500Nodes/5000Pods-12        	     	  12000580 ns/op

befor: BenchmarkSchedulingAntiAffinity/1000Nodes/10000Pods-12         	     	 498439953 ns/op
after: BenchmarkSchedulingAntiAffinity/1000Nodes/10000Pods-12         	     	  24692552 ns/op


AntiAffinity Topology: Region
before: BenchmarkSchedulingAntiAffinity/500Nodes/250Pods-12         	     	  60003672 ns/op
after:  BenchmarkSchedulingAntiAffinity/500Nodes/250Pods-12         	     	  13346400 ns/op

before: BenchmarkSchedulingAntiAffinity/1000Nodes/10000Pods-12         	     	 600085491 ns/op
after: BenchmarkSchedulingAntiAffinity/1000Nodes/10000Pods-12         	     	  27783333 ns/op
```

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

ref/ #56032 #47318 #25319

**Release note**:

```release-note
improve performance of affinity/anti-affinity predicate of default scheduler significantly.
```

/sig scheduling
2018-04-13 07:25:21 -07:00
Harry Zhang 4f0bd4121e Disable pod preemption by config 2018-04-12 21:11:51 -07:00
Bobby (Babak) Salamat 3041698e52 Addressed reviewer comments 2018-04-12 16:30:08 -07:00
Bobby (Babak) Salamat 418c7502f0 Improve performance of affinity/anti-affinity predicate 2018-04-11 21:17:29 -07:00
Kubernetes Submit Queue 3fa28cb0e0
Merge pull request #62236 from zhangxiaoyu-zidif/fix-caps-on-schedulerName
Automatic merge from submit-queue (batch tested with PRs 61147, 62236, 62018). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

spec.SchedulerName should be spec.schedulerName in kube-scheduler help

**What this PR does / why we need it**:
spec.SchedulerName should be spec.schedulerName in kube-scheduler help
```shell
--scheduler-name string                  Name of the scheduler, used to select which pods will be processed by this scheduler, based on pod's "spec.SchedulerName". (default "default-scheduler")
```


**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-04-10 05:31:17 -07:00
zhangxiaoyu-zidif 2d2e1032b4 add one placeholder for err in scheduelr.go 2018-04-08 14:14:13 +08:00
zhangxiaoyu-zidif a7771ef58b spec.SchedulerName should be spec.schedulerName in kube-scheduler help 2018-04-07 18:06:17 +08:00
Kubernetes Submit Queue 71f150422c
Merge pull request #62180 from msau42/binding-predicate
Automatic merge from submit-queue (batch tested with PRs 61918, 62180, 62198). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Use provided node object in volume binding predicate

**What this PR does / why we need it**:
Autoscaler creates fake node objects, so we should use the provided node object instead of looking up the node from the informer.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #62178

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-04-06 11:56:07 -07:00
Kubernetes Submit Queue 6d8df0c400
Merge pull request #61445 from resouer/extender-priority
Automatic merge from submit-queue (batch tested with PRs 62063, 62169, 62155, 62139, 61445). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Schedule even if extender is not available when using extender 

**What this PR does / why we need it**:
When using scheduler extender, if the extender is not available scheduling of all pods fail.
We should let the scheduling happen but display error message that extender is failing.

`IsIgnorable()`  is added to extender to indicate: if scheduling of all pods should fail when it's unavailable

**Backward compabtiility:**

We use `IsIgnorable` instead of `IsCritical` so that when this flag is not set, the default value will be `false`, i.e. not ignorable, which consistent with the current behavior in existing extenders.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes: #60616

**Special notes for your reviewer**:
kindly cc @ravisantoshgudimetla to see if this meets your expectation

TODO: update the examples in kubernetes/examples, but the strategy there is not clear to me for now

**Release note**:

```release-note
Schedule even if extender is not available when using extender 
```
2018-04-05 17:42:13 -07:00
Kubernetes Submit Queue ea529bc9ad
Merge pull request #62179 from timothysc/owner_labels
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Update OWNERS labels for cluster-lifecycle and scheduling

**What this PR does / why we need it**:
Updates auto labeling to make everyone's lives easier. 


**Special notes for your reviewer**:

**Release note**:

```
NONE
```

/cc @kubernetes/sig-cluster-lifecycle-pr-reviews @kubernetes/sig-scheduling-pr-reviews
2018-04-05 15:25:06 -07:00
Michelle Au 8d1cd819ec Use provided node object in volume binding predicate 2018-04-05 14:35:55 -07:00
Timothy St. Clair 3d0efc2e5a Update OWNERS labels for cluster-lifecycle and scheduling 2018-04-05 16:25:04 -05:00