Commit Graph

2629 Commits (2eb1083b9bcfbd118118f361169b327913d0d128)

Author SHA1 Message Date
Kubernetes Submit Queue 014676fc4f
Merge pull request #57523 from jennybuckley/podtolerationrestriction-config
Automatic merge from submit-queue (batch tested with PRs 57651, 56411, 56779, 57523, 57624). 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 podtolerationrestriction config to scheme

**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 #57522

Related to #57513
2018-01-02 14:09:48 -08:00
Kubernetes Submit Queue 65acc6d6a7
Merge pull request #57027 from CaoShuFeng/resourcequota_validation_pod
Automatic merge from submit-queue (batch tested with PRs 49856, 56257, 57027, 57695, 57432). 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 duplicated validation from pod's resourcequota admission

ResourceQuota is a validating admission plugin. Before it runs, pods
has already been validated. It's not necessary to validate it again.

**Release note**:
```release-note
NONE
```
2018-01-02 13:15:47 -08:00
qiu 9aca4057eb edit line138 2018-01-02 20:29:11 +08:00
Christoph Blecker 80e344644e
Regenerate all generated code 2018-01-02 00:21:07 -08:00
hzxuzhonghu 075e8dce00 fix local up cluster startup flag bug 2017-12-27 17:46:50 +08:00
Kubernetes Submit Queue 980a5e80b1
Merge pull request #57132 from zjj2wry/kube-schedule-initflag
Automatic merge from submit-queue (batch tested with PRs 55483, 57132). 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>.

enhance kube-schedule init flag

**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)*:
```
remove TODO: once we switch everything over to Cobra commands, we can go back to calling
utilflag.InitFlags() (by removing its pflag.Parse() call). 
For now, we have to set the normalize func and add the go flag set by hand.
```

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-12-25 10:53:28 -08:00
Kubernetes Submit Queue ff23474c12
Merge pull request #57502 from tanshanshan/scheduler-NominatedNode
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>.

Rename the annotation key for nominated pods to "scheduler.kubernetes.io/nominated-node-name"

**What this PR does / why we need it**:
Rename the annotation key for nominated pods to "scheduler.kubernetes.io/nominated-node-name"

**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 #57471

**Special notes for your reviewer**:

**Release note**:

```release-note

```
2017-12-24 20:07:41 -08:00
Jeff Grafton 46e894bfd3 Switch go binaries from (hacky) static to pure Go 2017-12-23 13:13:09 -08:00
Jeff Grafton efee0704c6 Autogenerate BUILD files 2017-12-23 13:12:11 -08:00
Kubernetes Submit Queue 1f182ae147
Merge pull request #57513 from deads2k/admission-19-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>.

add eventratelimit config to scheme

Fixes https://github.com/kubernetes/kubernetes/issues/57030

Because the config types are decoded, their types have to be registered in the scheme used for admission config decoding.  Looks like we missed one.

@kubernetes/sig-api-machinery-bugs 
/assign jennybuckley
2017-12-22 19:12:19 -08:00
tanshanshan 6ac0f4198a rename key 2017-12-22 09:18:46 +08:00
Jonathan Basseri 732e785e0a Performance improvement for affinity term matching.
When a PodAffinityTerm uses TopologyKey=kubernetes.io/hostname, we can
avoid searching the entire cluster for a match by only listing pods on
the given node.
2017-12-21 16:01:22 -08:00
Kubernetes Submit Queue d7e5bd194a
Merge pull request #57477 from misterikkit/noStrCat
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>.

Avoid string concatenation when comparing pods.

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

Pod comparison in (*NodeInfo).Filter was using GetPodFullName before
comparing pod names. This is a concatenation of pod name and pod
namespace, and it is significantly faster to compare name & namespace
instead.

This is a set of 3 PRs targeting affinity predicate performance. (#57476, #57477, #57478) The key takeaway is approximately 2x speedup in the large affinity benchmark.

The unexpected increase in BenchmarkScheduling/1000Nodes/1000Pods seems to be an outlier, and did not recur on subsequent runs. The benchmarks have a moderate amount of variance to them, and I did not run them enough times to measure mean and standard deviation.

| test | b.N | master | #57476 | #57477 | #57478 | combined |
| ---- | --- | ------ | ------ | ---------- | ---------- | -------- |
| BenchmarkScheduling/100Nodes/0Pods                | 100 |  39629010 ns/op | 36898566 ns/op (-6.89%)   |  38461530 ns/op (-2.95%)  |  36214136 ns/op (-8.62%)  |  43090781 ns/op (+8.74%)  |
| BenchmarkScheduling/100Nodes/1000Pods             | 100 |  85489577 ns/op | 69538016 ns/op (-18.66%)  |  70104254 ns/op (-18.00%) |  75015585 ns/op (-12.25%) |  80986960 ns/op (-5.27%)  |
| BenchmarkScheduling/1000Nodes/0Pods               | 100 | 219356660 ns/op | 200149051 ns/op (-8.76%)  | 192867469 ns/op (-12.08%) | 196896770 ns/op (-10.24%) | 212563662 ns/op (-3.10%)  |
| BenchmarkScheduling/1000Nodes/1000Pods            | 100 | 380368238 ns/op | 381786369 ns/op (+0.37%)  | 387224973 ns/op (+1.80%)  | 417974358 ns/op (+9.89%)  | 411140230 ns/op (+8.09%)  |
| BenchmarkSchedulingAntiAffinity/500Nodes/250Pods  | 250 | 124399176 ns/op | 97568988 ns/op (-21.57%)  | 112027363 ns/op (-9.95%)  | 129134326 ns/op (+3.81%)  |  98607941 ns/op (-20.73%) |
| BenchmarkSchedulingAntiAffinity/500Nodes/5000Pods | 250 | 491677096 ns/op | 441562422 ns/op (-10.19%) | 278127757 ns/op (-43.43%) | 447355609 ns/op (-9.01%)  | 226310721 ns/op (-53.97%) |

Combined performance contains all three patches.
Percentages are relative to master.

Methodology:

I ran the tests on each branch with this command.
```
make test-integration WHAT="./test/integration/scheduler_perf" KUBE_TEST_ARGS="-run=xxxx -bench=."
```

The benchmarks have a fair amount of variance to them, and I did not run them enough times to measure mean and standard deviation.

**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 #

The three PRs in this set should collectively fix #54189.

**Special notes for your reviewer**:

**Release note**:

```release-note
Improve scheduler performance of MatchInterPodAffinity predicate.
```
2017-12-21 15:18:55 -08:00
jennybuckley d0f262444f add podtolerationrestriction config to scheme 2017-12-21 11:10:05 -08:00
Jonathan Basseri 3909dc1341 Avoid array growth in FilteredList.
The method (*schedulerCache).FilteredList builds an array of *v1.Pod
that contains every pod in the cluster except for those filtered out by
a predicate. Today, it starts with a nil slice and appends to it.

Based on current usage, FilteredList is expected to return every pod in
the cluster or omit some pods from a single node. This change reserves
array capacity equal to the total number of pods in the cluster.
2017-12-21 10:50:04 -08:00
Jonathan Basseri 7b3638ea77 Avoid string concatenation when comparing pods.
Pod comparison in (*NodeInfo).Filter was using GetPodFullName before
comparing pod names. This is a concatenation of pod name and pod
namespace, and it is significantly faster to compare name & namespace
instead.
2017-12-21 09:31:53 -08:00
David Eads 5e966af1d0 add eventratelimit config to scheme 2017-12-21 08:09:55 -05:00
Kubernetes Submit Queue 754bb1350f
Merge pull request #55442 from anfernee/priority_resource
Automatic merge from submit-queue (batch tested with PRs 57257, 55442). 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>.

Merge 3 resource allocation priority functions

**What this PR does / why we need it**: those 3 priority functions are closed related, and share a lot of the same logic, put them together.

**Release note**:
```release-note
None
```
2017-12-20 23:56:49 -08:00
Yongkun Anfernee Gui c65225ee19 Merge 3 resource allocation priority functions 2017-12-20 17:21:22 -08:00
Kubernetes Submit Queue c13a2abaf3
Merge pull request #57368 from brendandburns/version
Automatic merge from submit-queue (batch tested with PRs 57349, 57368). 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 '/version/' to the system:discovery role, since that's what the spec says.

See: https://github.com/kubernetes-client/java/issues/153

```release-note
Add the path '/version/' to the `system:discovery` cluster role.
```
2017-12-20 14:53:38 -08:00
Brendan Burns 20bb9edff4
Update cluster-roles.yaml 2017-12-20 10:44:55 -08:00
Brendan Burns 519d0cde7b
Update policy.go 2017-12-20 10:44:07 -08:00
Kubernetes Submit Queue 51fbd6e637
Merge pull request #57168 from yastij/predicates-ordering
Automatic merge from submit-queue (batch tested with PRs 57252, 57168). 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>.

Implementing predicates ordering

**What this PR does / why we need it**: implements predicates ordering for the scheduler

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

**Special notes for your reviewer**:


@bsalamat @gmarek @resouer as discussed on slack, to implement ordering we have to choices:

- use a layered approach with a list that indexes the order of the predicates map

- change the underlying data structure used to represent a collection of predicates (a map in our case) into a list of predicates objects. 
Going with this solution might be "cleaner" but it will require a lot of changes and will increase the cost for accessing predicates from O(1) to O(n) (n being the number of predicates used by the scheduler).

we might go with this solution for now. If the number of predicates start growing, we might switch to the second option.
 
**Release note**:

```release-note
adding predicates ordering for the kubernetes scheduler.
```
2017-12-20 07:48:35 -08:00
Yassine TIJANI e62952d02b using consts to refer to predicate names 2017-12-20 13:21:20 +00:00
Brendan Burns ec53238901 Add '/version/*' to the system:discovery role, since that's what the open
api spec says.
2017-12-19 21:47:20 -08:00
Kubernetes Submit Queue 60e7727cb8
Merge pull request #57348 from tallclair/psp-owners
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 PodSecurityPolicy OWNERS

Make myself an approver of PodSecurityPolicy, and also add a couple reviewers.

```release-note
NONE
```
2017-12-18 13:29:51 -08:00
Kubernetes Submit Queue b6b1762a80
Merge pull request #56349 from php-coder/simplify_admission_test
Automatic merge from submit-queue (batch tested with PRs 56947, 56349, 57140, 53686, 57314). 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>.

 admission_test.go(TestAdmitPreferNonmutating): simplify test

**What this PR does / why we need it**:
This PR simplifies `TestAdmitPreferNonmutating` test by inlining members that have a constant values.

**Release note**:
```release-note
NONE
```

PTAL @liggitt @tallclair 
CC @simo5
2017-12-18 12:24:38 -08:00
Tim Allclair f65b709794
Add PodSecurityPolicy OWNERS 2017-12-18 11:47:05 -08:00
Yassine TIJANI ecba504974 implementing predicates ordering 2017-12-18 17:44:24 +00:00
Kubernetes Submit Queue 665e8b2d65
Merge pull request #56375 from CaoShuFeng/glogV10
Automatic merge from submit-queue (batch tested with PRs 56375, 56872, 57053, 57165, 57218). 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 extra level check of glog

**Release note**:
```release-note
NONE
```
2017-12-17 05:33:38 -08:00
Kubernetes Submit Queue 7a23bbb024
Merge pull request #57177 from liggitt/rbac-log
Automatic merge from submit-queue (batch tested with PRs 56386, 57204, 55692, 57107, 57177). 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>.

Raise RBAC DENY log level

Fixes #46877 
Fixes https://github.com/kubernetes/kubernetes/issues/55821

Can still be logged verbosely with `--vmodule=rbac*=5` if desired

```release-note
NONE
```
2017-12-17 04:19:47 -08:00
Kubernetes Submit Queue 7f87337b8b
Merge pull request #56650 from danwinship/networkpolicy-rbac
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 RBAC policies for NetworkPolicy

**What this PR does / why we need it**:
When using RBAC, none of the namespace-level roles currently have permission to do anything with NetworkPolicy. (Only cluster-admin does, by virtue of having permission on "*".) This fixes it so "admin" and "edit" have read/write permission, and "view" has read-only permission.

I added permission for both the extensions and networking objects, which I believe is correct as long as both of them exist?

(This would be nice to fix in 1.9, although it's not a regression. It's always been broken.)

**Release note**:
```release-note
When using Role-Based Access Control, the "admin", "edit", and "view" roles now have the expected permissions on NetworkPolicy resources.
```
2017-12-16 12:09:11 -08:00
Kubernetes Submit Queue 203078538a
Merge pull request #56792 from denverdino/fix-typo-in-algorithmprovider-defaults
Automatic merge from submit-queue (batch tested with PRs 56250, 56809, 56812, 56792, 56724). 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 typo

Signed-off-by: Li Yi <denverdino@gmail.com>

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

Fix the typo in /plugin/pkg/scheduler/algorithmprovider/defaults.go
2017-12-16 07:46:46 -08:00
Kubernetes Submit Queue 54591dd181
Merge pull request #56707 from brunomcustodio/kube-scheduler-config-file-warning
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 wording in kube-scheduler warning

**Release note**:
```release-note
NONE
```
2017-12-16 04:58:24 -08:00
Kubernetes Submit Queue a99fdfc680
Merge pull request #56480 from CaoShuFeng/schedule_queue
Automatic merge from submit-queue (batch tested with PRs 56480, 56675, 56624, 56648, 56658). 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 scheduling queue unit test

This change makes sure the Pop() test finish completely.

**Release note**:
```release-note
NONE
```
2017-12-16 03:24:40 -08:00
Kubernetes Submit Queue f5fa99cc82
Merge pull request #56549 from CaoShuFeng/thread_safe
Automatic merge from submit-queue (batch tested with PRs 56579, 55236, 56512, 56549, 56538). 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>.

Heap is not thread safe in scheduling queue

/cc @bsalamat 

**Release note**:
```release-note
NONE
```
2017-12-15 21:19:42 -08:00
Kubernetes Submit Queue d9b45d08c0
Merge pull request #56460 from liggitt/flex-pv-secret
Automatic merge from submit-queue (batch tested with PRs 56413, 56322, 56490, 56460, 56487). 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>.

Allow FlexVolume PV secret namespaces

Completes the secret namespace PV refactor, so all PV volume sources that specify secrets can reference them outside the PVC namespace.

Finished the secret-related aspect of https://github.com/kubernetes/kubernetes/issues/32131

```release-note
PersistentVolume flexVolume sources can now reference secrets in a namespace other than the PersistentVolumeClaim's namespace.
```
2017-12-15 16:43:55 -08:00
Kubernetes Submit Queue 40ad5d02f8
Merge pull request #56322 from guangxuli/priority_map_performance
Automatic merge from submit-queue (batch tested with PRs 56413, 56322, 56490, 56460, 56487). 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>.

Put process of getting pod controller reference into metadata

**What this PR does / why we need it**:
We should extract our common process/data into metadata just as other map priority functions do, so we could avoid getting same required data repeatedly in every node map process.

**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 #
None

**Special notes for your reviewer**:

**Release note**:

```release-note
None
```
2017-12-15 16:43:50 -08:00
Kubernetes Submit Queue 68c857e207
Merge pull request #55957 from jsafrane/protection-predicate
Automatic merge from submit-queue (batch tested with PRs 57211, 56150, 56368, 56271, 55957). 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>.

Skip pods that refer to PVCs that are being deleted

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

New check was added to `Schedule()` to make sure that a scheduled pod refers to existing PVCs that are not being deleted.

In 1.9 we plan to add a new feature that uses finalizers on PVC to protect PVCs that are used by a running pod from being deleted. This finalizer will be removed when all pods that use a PVC are finished or deleted. See https://github.com/kubernetes/community/blob/master/contributors/design-proposals/storage/postpone-pvc-deletion-if-used-in-a-pod.md for details.

I needed to pass `pvcLister` to `GenericScheduler`.

UX:

```
$ kubectl describe pod
...
  Type     Reason            Age              From               Message
  ----     ------            ----             ----               -------
  Warning  FailedScheduling  5s (x4 over 8s)  default-scheduler  persistentvolumeclaim "myclaim" is being deleted
  Warning  FailedScheduling  1s (x2 over 1s)  default-scheduler  persistentvolumeclaim "myclaim" not found

```


**Release note**:

```release-note
Scheduler skips pods that use a PVC that either does not exist or is being deleted.
```

/sig scheduling
/kind feature
2017-12-15 14:00:49 -08:00
Kubernetes Submit Queue 588c1e970a
Merge pull request #56271 from tanshanshan/fix-little-scheduler
Automatic merge from submit-queue (batch tested with PRs 57211, 56150, 56368, 56271, 55957). 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>.

Put variable declared in the front.

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

put variable declared in the front.

**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

```
2017-12-15 14:00:47 -08:00
Kubernetes Submit Queue e2e5f2339b
Merge pull request #55853 from guangxuli/fix_scheduler_test
Automatic merge from submit-queue (batch tested with PRs 56308, 54304, 56364, 56388, 55853). 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>.

httptest server should be close since Close issue has been fixed

**What this PR does / why we need it**:
per https://github.com/kubernetes/kubernetes/issues/19254, the issue seem to be fix for a long time and `server.Close` is no longer a issue in current related golang version, so it's time to uncomment the server.Close(). 

**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 #
None
**Special notes for your reviewer**:

**Release note**:

```release-note
None
```
2017-12-15 02:04:45 -08:00
Kubernetes Submit Queue 59bf6fed73
Merge pull request #56388 from CaoShuFeng/failureDomain
Automatic merge from submit-queue (batch tested with PRs 56308, 54304, 56364, 56388, 55853). 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 failure domain from InterPodAffinityPriority

**Release note**:
```release-note
NONE
```
2017-12-15 02:04:42 -08:00
Kubernetes Submit Queue 45f983144f
Merge pull request #55504 from php-coder/cleanup_create_sc
Automatic merge from submit-queue (batch tested with PRs 55557, 55504, 56269, 55604, 56202). 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>.

Create{Container,Pod}SecurityContext: modify a pod and don't return the annotations

**What this PR does / why we need it**:
Prior https://github.com/kubernetes/kubernetes/pull/52849 we couldn't modify a pod and had to return annotations from the methods. But now, as we always working with a copy of a pod, we can modify it directly and we don't need to copy&return annotations separately.

This PR simplifies the code by modifying a pod directly. Also it renames these methods and replaces returning of the `SecurityContext` by in-place modification.

In fact it reverts the changes from https://github.com/kubernetes/kubernetes/pull/30257

**Release note**:
```release-note
NONE
```

PTAL @liggitt @timstclair 
CC @simo5
2017-12-14 13:54:40 -08:00
Kubernetes Submit Queue 5e478f072c
Merge pull request #56184 from CaoShuFeng/statefulset
Automatic merge from submit-queue (batch tested with PRs 54410, 56184, 56199, 56191, 56231). 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 useless const

Trivial fix.

**Release note**:

```release-note
NONE
```
2017-12-14 05:33:11 -08:00
zhengjiajin ffbfd81c06 remove dependency from cobra, only use option test init flag 2017-12-14 17:31:49 +08:00
Jordan Liggitt 13854c46a7
Raise RBAC DENY log level 2017-12-14 00:06:23 -05:00
Jordan Liggitt d073c10dbc
Refactor flex pv to allow secret namespace 2017-12-13 23:32:16 -05:00
David Eads 7dc7693e86 make quota reusable 2017-12-13 08:39:55 -05:00
zhengjiajin d8fa60f243 auto generated file 2017-12-13 14:56:36 +08:00
zhengjiajin 3ee3cf65cb enhance kube-schedule init flag 2017-12-13 14:46:58 +08:00
Jordan Liggitt 0682372bae
Define default role for full kubelet API access 2017-12-13 00:44:24 -05:00
Kubernetes Submit Queue 7335c41ebe
Merge pull request #56622 from wackxu/nodemiss
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>.

delete a node from its cache if it gets node not found error

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

delete a node from its cache if it gets node not found error

**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/56261

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-12-12 11:22:12 -08:00
Cao Shufeng 208df08ea6 remove useless validation from pod's resourcequota admission
ResourceQuota is a validating admission plugin. Before it runs, pods
has already been validated. It's not necessary to validate it again.
2017-12-11 17:49:33 +08:00
Derek Carr 1748b42b21 LimitRange ignores objects previously marked for deletion 2017-12-08 12:06:41 -05:00
Kubernetes Submit Queue 305d644363
Merge pull request #56577 from resouer/fix-eclass-pvc
Automatic merge from submit-queue (batch tested with PRs 56688, 56577). 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 pvc as part of equivalence hash

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

Should add PVC as part of equivalence hash so that `StatefulSe`t and `Operator` will always run the volume predicate, while the `ReplicaSet` can still  re-use cached ones.

**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 #56265

**Special notes for your reviewer**:

**Release note**:

```release-note
Add pvc as part of equivalence hash
```
2017-12-05 14:31:09 -08:00
Cao Shufeng 16999f172d remove duplicated validation from podsecuritypolicy 2017-12-05 19:13:44 +08:00
hzxuzhonghu e31ed07a9c also check pod securityContextt hostNetwork in exec admission controller 2017-12-05 15:15:46 +08:00
Kubernetes Submit Queue 3fef902161
Merge pull request #56709 from gnufied/cluster-role-for-cloud-provider
Automatic merge from submit-queue (batch tested with PRs 56785, 56709). 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>.

cloud-provider needs cluster-role to apply taint to the node

When volume is stuck in attaching state on AWS, cloud-provider
needs to taint the node. But the node can not be tainted
without proper access. Without this change https://github.com/kubernetes/kubernetes/pull/55558 will not work.

xref - https://github.com/kubernetes/kubernetes/issues/56819

cc @jsafrane @liggitt 

/sig storage

```release-note
none
```
2017-12-04 17:14:14 -08:00
Hemant Kumar 514f219c22 cloud-provider needs cluster-role to apply taint to the node
When volume is stuck in attaching state on AWS, cloud-provider
needs to taint the node. But the node can not be tainted
without proper access.
2017-12-04 10:57:21 -05:00
Li Yi 44877d87cb Fix typo
Change-Id: Ie8a4e9cf510fe2f7e7445af03476a0e7759a0360
Signed-off-by: Li Yi <denverdino@gmail.com>
2017-12-04 21:16:31 +08:00
Kubernetes Submit Queue 050956b08e
Merge pull request #56533 from vladimirvivien/csi-featuregate-fix
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>.

CSI - Fix feature gate bug and add bootstrap RBAC rules

**What this PR does / why we need it**:
This PR addresses show-stopper bug https://github.com/kubernetes/kubernetes/issues/56532.  It fixes the faulty feature gate logic and adds RBAC rules for kube-controller-manager and kubelet that allows `VolumeAttachment` API operations against the api-server.

**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 #56532, #56667 

**Special notes for your reviewer**:

**Release note**:
```release-note
NONE
```
2017-12-03 07:54:04 -08:00
Kubernetes Submit Queue 2b98a976fb
Merge pull request #53647 from wenlxie/githubupstream.master.fixinterpodantiaffinity
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 inter-pod anti-affinity issue

This is used to fix:
https://github.com/kubernetes/kubernetes/issues/50813
2017-12-03 07:13:08 -08:00
Harry Zhang b3bb74e3a3 Update generated bazel 2017-12-02 22:24:17 +08:00
Harry Zhang e4055c0df2 Add pvc as part of equivalence hash
Use factory to generat get equivalence pod func
2017-12-02 22:24:17 +08:00
Harry Zhang af243f4824 Fix PV counter predicate in eclass 2017-12-02 22:24:17 +08:00
Vladimir Vivien 179d8e108e CSI - feature gate fix, gated RBAC rules, csi nodeID label
This commit tracks chages to fix blocking bugs such as feature gates, rbac rules, usage
of csi nodeID to derive attachment ID.
2017-12-02 05:54:54 -05:00
wackxu aac60b6cbb delete a node from its cache if it gets node not found error 2017-12-02 09:34:25 +08:00
Bruno Miguel Custodio 0a5a1f1cb4
fix wording in kube-scheduler warning 2017-12-01 17:00:05 +00:00
wenlxie 82e02cc986 fix inter-pod anti-affinity issue 2017-12-01 19:32:21 +08:00
Dan Winship ac336a6eb2 Add rbac policies for NetworkPolicy 2017-11-30 17:09:52 -05:00
Cao Shufeng 184eb83162 remove extra level check of glog 2017-11-30 15:58:18 +08:00
Cao Shufeng 3ef8ab4d70 Heap is not thread safe in scheduling queue 2017-11-30 14:04:28 +08:00
Michelle Au c26debecef Return no volume match if prebound PV node affinity doesn't match node 2017-11-29 17:29:58 -08:00
Cao Shufeng 33f6625a84 fix scheduling queue unit test
This change makes sure the Pop() test finish completely.
2017-11-28 17:40:35 +08:00
Avesh Agarwal b571001999 Implement resource limit priority function. This function checks if the input pod's
resource limits are satisfied by the input node's allocatable resources or not.
If yes, the node is assigned a score of 1, otherwise the node's score is not changed.
2017-11-27 12:53:47 -05:00
Cao Shufeng 888580e032 clean up failure domain from InterPodAffinityPriority 2017-11-27 13:13:12 +08:00
Slava Semushin b1ae1d67b2 admission_test.go(TestAdmitPreferNonmutating): simplify test by replacing shouldPassAdmit by a constant value. 2017-11-24 17:12:53 +01:00
Slava Semushin 2b95212ad3 admission_test.go(TestAdmitPreferNonmutating): simplify test by replacing expectedPodUser by a constant value. 2017-11-24 17:12:48 +01:00
Gavin 58ed69a9c8 put pod controllerref to metadata 2017-11-24 15:04:19 +08:00
pospispa b1b1d31247 Add policy for the PVC Protection Controller
It watches PVCs and Pods and updates PVCs.
2017-11-23 12:25:14 +01:00
pospispa a06901a868 Admission Controller PVC Finalizer Plugin
This admission plugin puts finalizer to every created PVC. The finalizer is
removed by PVCProtectionController when the PVC is not referenced by any
pods and thus the PVC can be deleted.
2017-11-23 11:46:28 +01:00
Jan Safranek 0a96a75cea Remove PVCLister and use informer directly. 2017-11-23 10:04:42 +01:00
Jan Safranek 19caa9c50d Skip pods that refer to PVCs that are being deleted
Scheduler should ignore pods that refer to PVCs that either do not exist or
are being deleted.
2017-11-23 10:01:23 +01:00
Kubernetes Submit Queue d42af03d8a
Merge pull request #56118 from gnufied/implement-ebs-resize
Automatic merge from submit-queue (batch tested with PRs 56249, 56118, 56255, 56252, 56256). 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>.

Implement ebs resize

Implement EBS disk resizing. 

xref - kubernetes/features#284


```release-note
Add support for resizing EBS disks
```
2017-11-23 00:23:21 -08:00
Kubernetes Submit Queue 82c88982c0
Merge pull request #56178 from bsalamat/pdb
Automatic merge from submit-queue (batch tested with PRs 55952, 49112, 55450, 56178, 56151). 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 PodDisruptionBudget support in pod preemption

**What this PR does / why we need it**:
This PR adds the logic to make scheduler preemption aware of PodDisruptionBudget. Preemption tries to avoid preempting pods whose PDBs are violated by preemption. If preemption does not find any other pods to preempt, it will preempt pods despite violating their PDBs.

**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 #53913

**Special notes for your reviewer**:

**Release note**:

```release-note
Add PodDisruptionBudget support during pod preemption
```

ref/ #47604

/sig scheduling
2017-11-22 21:48:48 -08:00
tanshanshan 9727cd0636 declare in front 2017-11-23 11:50:04 +08:00
Kubernetes Submit Queue db2a08bc32
Merge pull request #52767 from NickrenREN/rbd-resize
Automatic merge from submit-queue (batch tested with PRs 52767, 55065, 55148, 56228, 56221). 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 resize support for ceph RBD

Add resize support for ceph RBD
**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: part of [#657](https://github.com/kubernetes/community/pull/657)

**Special notes for your reviewer**:

**Release note**:
```release-note
Add resize support for ceph RBD
```

WIP, need to add fs resize,
assign to myself first

/assign @NickrenREN
2017-11-22 19:49:32 -08:00
Hemant Kumar 8c49d1db02 Implement disk resizing for AWS
Update bazel files
2017-11-22 21:38:54 -05:00
Kubernetes Submit Queue 4904037645
Merge pull request #55569 from x1957/fixtypo
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>.

fixtypo

**What this PR does / why we need it**:
fixtypo
**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
```
2017-11-22 17:21:11 -08:00
Kubernetes Submit Queue 7dd41577e3
Merge pull request #55815 from gnufied/implement-node-fs-resize
Automatic merge from submit-queue (batch tested with PRs 55545, 55548, 55815, 56136, 56185). 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>.

Implement node fs resize

Implement kubelet side resizing of file system.

xref - https://github.com/kubernetes/features/issues/284 

```release-note
Implement kubelet side file system resizing. Also implement GCE PD resizing
```
2017-11-22 16:52:29 -08:00
Kubernetes Submit Queue 215844219b
Merge pull request #55643 from tallclair/psp-scale
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>.

[PodSecurityPolicy] Optimize authorization check

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

Authorizing PodSecurityPolicy use may involve a remote call, and can be slow. Rather than authorizing the user / SA for every policy in the cluster, only test authz for the policies under which the pod is valid.

This is a big improvement in the case where there are a lot of policies for which the pod is not valid (benchmark below), but should also help when the pod is valid under other policies, as it allows the authorization to short-circuit on the first accepted policy.

**Benchmark:**
Highlight from scale testing (see https://docs.google.com/document/d/1IIcHHE_No1KMAybW5krIphdN325eGa2sxF2eqg2YAPI/edit for the full results). These were run with 1000 policies under which the pods were not valid, and had no role bindings.

| | method | resource | 50th percentile | 90th percentile | 99th percentile
| -- | -- | -- | -- | -- | --
| 1.8 HEAD | POST | pods | 8.696784s | 20.497659s | 22.472421s
| 1.8 With fix | POST | pods | 25.454ms | 29.068ms | 85.817ms

(I didn't benchmark master, but expect the difference to be more drastic, since the authorization is run twice - for both Admit and Validate)

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

**Special notes for your reviewer**:
The validation errors are no longer totally accurate, as they may include errors from PSPs that the user/pod isn't authorized to use. However, I think this is a worthwhile tradeoff. If this is a big concern, we could authorize all policies in the case where none admitted /validated the pod.

**Release note**:
```release-note
Improved PodSecurityPolicy admission latency, but validation errors are no longer limited to only errors from authorized policies.
```
2017-11-22 15:47:54 -08:00
Hemant Kumar 7be94c4b06 Implement resizing support for GCE
Fix GCE attacher test
Update bazel files
2017-11-22 16:24:58 -05:00
Kubernetes Submit Queue 6a889ec37f
Merge pull request #55039 from msau42/local-binding-4
Automatic merge from submit-queue (batch tested with PRs 51321, 55969, 55039, 56183, 55976). 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>.

Topology aware volume scheduler and PV controller changes

**What this PR does / why we need it**:
Scheduler and PV controller changes to support volume topology aware scheduling, as specified in kubernetes/community#1168

**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 #54435

**Special notes for your reviewer**:
* I've split the PR into logical commits to make it easier to review
* The remaining TODOs I plan to address next release unless you think it needs to be done now

**Release note**:
```release-note
Adds alpha support for volume scheduling, which allows the scheduler to make PersistentVolume binding decisions while respecting the Pod's scheduling requirements.  Dynamic provisioning is not supported with this feature yet.

Action required for existing users of the LocalPersistentVolumes alpha feature:
* The VolumeScheduling feature gate also has to be enabled on kube-scheduler and kube-controller-manager.
* The NoVolumeNodeConflict predicate has been removed.  For non-default schedulers, update your scheduler policy.
* The CheckVolumeBinding predicate has to be enabled in non-default schedulers.
```

@kubernetes/sig-storage-pr-reviews @kubernetes/sig-scheduling-pr-reviews
2017-11-22 11:59:55 -08:00
Hemant Kumar 1b76b0b2ff Allow node to update PVC's status
Implement node policy feature gates
Add tests for node policy update
2017-11-22 14:32:50 -05:00
Tim Allclair 9673235583
Optimize PSP authorization 2017-11-22 11:13:07 -08:00
Bobby (Babak) Salamat a0ef9cd09a Autogenerated files 2017-11-22 09:46:26 -08:00
Bobby (Babak) Salamat 3d4ae31d91 Add PDB support during pod preemption 2017-11-22 09:46:26 -08:00
NickrenREN 6f7a1983ef Support ceph rbd resize 2017-11-22 19:48:02 +08:00
Kubernetes Submit Queue 2a18a2aadf
Merge pull request #55103 from ConnorDoyle/remove-oir
Automatic merge from submit-queue (batch tested with PRs 55103, 56036, 56186). 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 opaque integer resources (deprecated in v1.8)

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

* Remove opaque integer resources (OIR) support from the code base. This feature was deprecated in v1.8 and replaced by Extended Resources (ER).

**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 #55102

**Release note**:

```release-note
Remove opaque integer resources (OIR) support (deprecated in v1.8.)
```
2017-11-22 00:27:27 -08:00
Kubernetes Submit Queue b18d86d5cc
Merge pull request #51498 from NickrenREN/pvc-resize-cinder
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>.

Implement volume resize for cinder

**What this PR does / why we need it**:
resize for cinder
xref: [resize proposal](https://github.com/kubernetes/community/pull/657)

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: xref https://github.com/kubernetes/community/pull/657
Follow up: #49727

**Special notes for your reviewer**:

**Release note**:
```release-note
Implement volume resize for cinder
```

wip, assign to myself first

/assign @NickrenREN
2017-11-21 23:40:37 -08:00
Michelle Au a84e5b9613 update build files 2017-11-21 23:19:44 -08:00
Michelle Au 5871b501ac Add assume/bind volume functions to scheduler 2017-11-21 23:19:44 -08:00
Michelle Au 094841c62e Add predicate to find volume matches 2017-11-21 23:19:44 -08:00
Michelle Au 01a8772111 Scheduler volume cache plumbing and predicate invalidation 2017-11-21 23:19:43 -08:00
Cao Shufeng f3c4ef835b remove useless const 2017-11-22 11:41:31 +08:00
Kubernetes Submit Queue 25ebf875b4
Merge pull request #55812 from deads2k/admission-17-external
Automatic merge from submit-queue (batch tested with PRs 55812, 55752, 55447, 55848, 50984). 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>.

Make versioned types for webhook admission config

Versioned webhook admission config type as promised in https://github.com/kubernetes/kubernetes/pull/54414.  

@kubernetes/sig-api-machinery-pr-reviews 
@ericchiang as promised.  fyi.

```yaml
kind: AdmissionConfiguration
apiVersion: apiserver.k8s.io/v1alpha1
plugins:
- name: GenericAdmissionWebhook
  configuration:
    kind: WebhookAdmission
    apiVersion: apiserver.config.k8s.io/v1alpha1
    kubeConfigFile: /path/to/my/file
```

`ADMISSION_CONTROL_CONFIG_FILE=../foo.yaml hack/local-up-cluster.sh`
2017-11-21 17:57:29 -08:00
Kubernetes Submit Queue 5d3aae0192
Merge pull request #56083 from yguo0905/sched-log
Automatic merge from submit-queue (batch tested with PRs 56128, 56004, 56083, 55833, 56042). 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>.

Suppress the warning when a pod in binding cannot be expired

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

I have a scheduler extender, which implements the `Bind` call and takes several minutes to respond to that call. The scheduler log was full of the following error.

```
W1120 10:23:09.691188   99720 cache.go:442] Couldn't expire cache for pod default/xxx. Binding is still in progress.
```

The TTL for a pod to be expired in the scheduler cache is 30 seconds. But it's also possible that the binding (which is done asynchronously) can take longer than 30 seconds.
2cbb07a439/plugin/pkg/scheduler/factory/factory.go (L143)

The go routine that checks whether a pod has been expired is triggered every second.
2cbb07a439/plugin/pkg/scheduler/schedulercache/cache.go (L33)

So, it will print the the following warning every seconds until the pod gets expired.
2cbb07a439/plugin/pkg/scheduler/schedulercache/cache.go (L442-L443)

I think it's a valid for the binding to take more than one second, so we should downgrade this to an info to avoid polluting the scheduler log.

**Release note**:
```release-note
None
```

/sig scheduling
/assign @bsalamat 
/cc @vishh
2017-11-21 17:04:56 -08:00
Kubernetes Submit Queue 34b258ca4b
Merge pull request #55933 from bsalamat/starvation3
Automatic merge from submit-queue (batch tested with PRs 54316, 53400, 55933, 55786, 55794). 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 support to take nominated pods into account during scheduling to avoid starvation of higher priority pods

**What this PR does / why we need it**:
When a pod preempts lower priority pods, the preemptor gets a "nominated node name" annotation. We call such a pod a nominated pod. This PR adds the logic to take such nominated pods into account when scheduling other pods on the same node that the nominated pod is expected to run. This is needed to avoid starvation of preemptor pods. Otherwise, lower priority pods may fill up the space freed after preemption before the preemptor gets a chance to get scheduled.

**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 #54501

**Special notes for your reviewer**: This PR is built on top of #55109 and includes all the changes there as well.

**Release note**:

```release-note
Add support to take nominated pods into account during scheduling to avoid starvation of higher priority pods.
```

/sig scheduling
ref/ #47604
2017-11-21 15:04:28 -08:00
David Eads ccd4f4a4b6 make admission config scheme configurable 2017-11-21 15:23:16 -05:00
Kubernetes Submit Queue aca386059d
Merge pull request #55938 from sttts/sttts-compositional-admission-metrics
Automatic merge from submit-queue (batch tested with PRs 55938, 56055, 53385, 55796, 55922). 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>.

admission: make admission metrics compositional

Metrics emission of admission plugins and the admission chain can be implemented compositionally, i.e. completely independently from the chain logic. This PR does that, moves the whole metrics code into a sub-package to contain complexity. The plumbing logic for the emitted metrics finally is cleanly done in the apiserver bootstrapping code, instead of being totally interleaved with the core admission logic.

Ratio:
- considerably less complexity
- admission plugins are compositional, including the chain. We cannot assume that there is only one chain at the outside of the admission plugin structure. Downstream projects might have more complex admission chains, i.e. multiple chain object nested.
- addition of metrics is plumbing and should be in the apiserver plumbing code. This makes it much easier to reason about the security critical admission chain.

Follow-up of #55183 and based on #55919.
2017-11-21 07:43:40 -08:00
NickrenREN af108fb938 implement cinder resize 2017-11-21 15:55:49 +08:00
Bobby (Babak) Salamat eda3df8732 Autogenerated files 2017-11-20 22:17:06 -08:00
Bobby (Babak) Salamat e3a0e0eb40 fixup! Add logic to account for pods nominated to run on nodes, but are not running yet. Add tests for the new logic. 2017-11-20 22:17:06 -08:00
Bobby (Babak) Salamat 8a17ae241d Add logic to account for pods nominated to run on nodes, but are not running yet.
Add tests for the new logic.
2017-11-20 22:17:05 -08:00
Yang Guo 035e73b6c3 Suppress warning when a pod in binding cannot be expired 2017-11-20 16:16:42 -08:00
Eric Chiang 21ab4d0c9b rbac bootstrap policy: add selfsubjectrulesreviews to basic-user 2017-11-20 14:39:05 -08:00
Kubernetes Submit Queue b3f7ad7407
Merge pull request #55839 from mindprince/extended-resource-toleration
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 ExtendedResourceToleration admission controller.

/kind feature
/sig scheduling
/area hw-accelerators

There's elaborate discussion on this in #55080. In short, we would like to enable cluster operators and/or cloud providers to create dedicated nodes with extended resources (like GPUs, FPGAs etc.) that are reserved for pods requesting such resources. [Taints is the kubernetes concept to create dedicated nodes.](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/#example-use-cases) If the cluster operator or cloud provider wants to create dedicated node pools, they are expected to taint the nodes containing extended resources with the key equal to the name of the resource and effect equal to NoSchedule. If they do that, only pods that have a toleration for such a taint can be scheduled there. To make it easy for the user, this admission controller when enabled, automatically adds a toleration with key `example.com/device`, operator `Exists` and effect `NoSchedule` if an extended resource of name `example.com/device` is requested.

**Release note**:
```release-note
Add ExtendedResourceToleration admission controller. This facilitates creation of dedicated nodes with extended resources. If operators want to create dedicated nodes with extended resources (like GPUs, FPGAs etc.), they are expected to taint the node with extended resource name as the key. This admission controller, if enabled, automatically adds tolerations for such taints to pods requesting extended resources, so users don't have to manually add these tolerations. 
```
2017-11-20 12:28:36 -08:00
Kubernetes Submit Queue d0301aa6e8
Merge pull request #54208 from resouer/rm-alpha
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>.

Move of unreachable taint key out of alpha

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

Move of unreachable taint key out of alpha, which already happened in community doc.

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

**Special notes for your reviewer**:
Please see #54198 for the context of this inconsistency.

**Release note**:

```release-note
Move unreachable taint key out of alpha. 
Please note the existing pods with the alpha toleration should be updated by user himself to tolerate the GA taint.
```
2017-11-20 10:50:17 -08:00
Dr. Stefan Schimanski baba0c827b admission: make metrics compositional and move to metrics sub-package 2017-11-20 15:32:38 +01:00
Joe Betz d82ae45a4c #55183 follow up: Reinstate admission chain composition and ns test 2017-11-20 15:13:23 +01:00
Dr. Stefan Schimanski e19257f2ec admission/webhook: move webhook initializer into plugin 2017-11-20 09:28:42 +01:00
Bobby (Babak) Salamat 79ac37d8b3 Autogenerated files 2017-11-19 11:32:14 -08:00
Bobby (Babak) Salamat daf8492bc5 Added a new scheduling queue based on priority queue. 2017-11-19 11:29:23 -08:00
Kubernetes Submit Queue ab203e54ed
Merge pull request #51192 from guangxuli/scheduler_priority_functions_map_reduce
Automatic merge from submit-queue (batch tested with PRs 51192, 55010). 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>.

Refactoring of priority function(CaculateSpreadPriority) by using map/reduce pattern

**What this PR does / why we need it**:
Ref #24246. exactly ref https://github.com/kubernetes/kubernetes/issues/51455, the PR aim to unify priority functions(deprecated) by using map/reduce pattern.
This is the first step, my todo list(WIP):
- interpod-affnity priority funciton refactoring 
- the priority funcitons register pattern
- deprecated priority function definition and all related logic. etc.

**Which issue this PR fixes**:

no issue, just unify the priority functions pattern.

**Special notes for your reviewer**:
none
**Release note**:
none
2017-11-19 05:22:23 -08:00
Gavin 8fa59aa9b0 address review comments 2017-11-19 13:29:21 +08:00
Rohit Agarwal 3c4c85f212 Add ExtendedResourceToleration admission controller. 2017-11-18 16:47:51 -08:00
Kubernetes Submit Queue 5033548574
Merge pull request #55379 from lichuqiang/admission_fix
Automatic merge from submit-queue (batch tested with PRs 54556, 55379, 55881, 55891, 55705). 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>.

Ensure config file exists before loading configuration in imagePolicyWebhook

**What this PR does / why we need it**:
ensure config file exists before loading configuration in imagePolicyWebhook

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

**Release note**:

```release-note
NONE
```
2017-11-18 07:53:41 -08:00
Kubernetes Submit Queue 3ec7487c0f
Merge pull request #55263 from anfernee/refactor_reduce
Automatic merge from submit-queue (batch tested with PRs 55254, 55525, 50108, 54674, 55263). 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 Priority Reduce functions

- Reducing the duplicated reduce function by introducing a reduce
  function generator that generates common reduce functions.
- Remove logs from reduce function, so it's purely calculating scores.
- Optimize the reduce functions by removing unnecessary conversion to
  float64.

**Release note**:
```release-note
None
```
2017-11-17 13:34:17 -08:00
Harry Zhang e380c215d1 Add GA toleration key and leave alpha ones untouched 2017-11-17 22:07:05 +08:00
Kubernetes Submit Queue a00b766ab0
Merge pull request #54134 from chentao1596/plugin-pkg-scheduler-util-non-zero-unit-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>.

Adding unit tests to methods of 'scheduler/algorithm/priorities/util'

What this PR does / why we need it:

 1) Adding unit tests to methods of 'non_zero.go'
 2) Adding unit tests to methods of 'util.go'
 3) Adding/Modifing unit tests to methods of 'topologies.go'

thank you!
2017-11-17 01:13:03 -08:00
Harry Zhang df8c92ac12 Replace node's alpha taint key with GA 2017-11-17 15:35:35 +08:00
Connor Doyle 80ac705ef3 Removed opaque integer resources. 2017-11-16 10:47:40 -08:00
lichuqiang f77e154dbb ensure config file exists before loading configuration in imagePolicyWebhook 2017-11-16 23:27:56 +08:00
Gavin 71a0350239 httpserver should be close since the issue has been fixed 2017-11-16 15:03:08 +08:00
Rohit Agarwal 7119fe227c Fix TestForgivenessAdmission.
This test would never fail because Annotations were empty in all cases!

This was missed when Tolerations were moved from Annotations to be part of Pod.Spec in #38957.
2017-11-15 21:54:24 -08:00
Kubernetes Submit Queue c339a54b53
Merge pull request #55659 from CaoShuFeng/duplicated_import
Automatic merge from submit-queue (batch tested with PRs 53780, 55663, 55321, 52421, 55659). 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 duplicated import

**Release note**:
```release-note
NONE
```
2017-11-15 09:30:40 -08:00
Kubernetes Submit Queue b623026d2a
Merge pull request #52421 from WIZARD-CXY/fixpredicate
Automatic merge from submit-queue (batch tested with PRs 53780, 55663, 55321, 52421, 55659). 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 hostip and protocol to the hostport predicates

**What this PR does / why we need it**:
This PR adds "hostIP and protocol" to scheduler hostport predicate procedure
**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #
fix #51950 
**Special notes for your reviewer**:
- [x] basic implementation, need review
- [x] e2e test
- [x] update doc (will be done in seperate PR)

**Release note**:

```release-note
add hostIP and protocol to the original hostport predicates procedure in scheduler.
```
2017-11-15 09:30:36 -08:00
Joe Betz 2643c6ae3e Fix admission metrics to track mutating/validating correctly
Also update admission test mocks to better reflect typical usage and fix broken tests.
2017-11-14 10:46:50 -08:00
Joe Betz 9d13d1baec Add system namespaces to admission metrics. Add tests and leverage test code from PR#55086 2017-11-14 10:46:43 -08:00
Cao Shufeng 86968e44d0 remove duplicated import 2017-11-14 17:18:17 +08:00
Kubernetes Submit Queue 560a3109ca
Merge pull request #55486 from sttts/sttts-psp-admission-annotation
Automatic merge from submit-queue (batch tested with PRs 54005, 55127, 53850, 55486, 53440). 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>.

admission: don't update psp annotation on update

Follow-up of https://github.com/kubernetes/kubernetes/pull/54689.

Related to https://github.com/kubernetes/kubernetes/issues/55435 as istio-like initializer-based container injection cannot contribute to SC mutations.

```release-note
The PodSecurityPolicy annotation `kubernetes.io/psp` on pods is only set once on create.
```
2017-11-13 16:45:29 -08:00
Kubernetes Submit Queue 2fc108b8b2
Merge pull request #53850 from dougm/api-fixed-int
Automatic merge from submit-queue (batch tested with PRs 54005, 55127, 53850, 55486, 53440). 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>.

Enforce use of fixed size int types in the API

Changes 'int' to 'int32', enforced by import_known_versions_test

Follow up to PR #53402



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

This PR changes a few fields within the API from 'int' to 'int32' and is now enforced by import_known_versions_test.  We need this so integer fields are the same size regardless of $GOARCH.

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

**Special notes for your reviewer**:

**Release note**:

```release-note
```
2017-11-13 16:45:26 -08:00
Kubernetes Submit Queue f575c55589
Merge pull request #54005 from deads2k/rbac-02-aggregation
Automatic merge from submit-queue (batch tested with PRs 54005, 55127, 53850, 55486, 53440). 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>.

aggregate cluster roles

xref https://github.com/kubernetes/community/pull/1219 https://github.com/kubernetes/features/issues/502

This is a pull with API types, a controller, and a demonstration of how to move admin, edit, and view.  Once we agree on the shape, I'll 


I added 
```yaml
aggregationRule:
  clusterRoleSelectors:
  - matchLabels:
      rbac.authorization.k8s.io/aggregate-to-admin: true
```
to the `ClusterRole`.  A controller then goes and gathers all the matching ClusterRoles and sets the `rules` to the union of matching cluster roles.

@kubernetes/sig-auth-pr-reviews 

```release-note
RBAC ClusterRoles can now select other roles to aggregate
```
2017-11-13 16:45:20 -08:00
Doug MacEachern 7950609b31 Enforce use of fixed size int types in the API
Changes 'int' to 'int32', enforced by import_known_versions_test

Follow up to PR #53402
2017-11-13 11:28:59 -08:00
Dr. Stefan Schimanski 3d5849fd54 admission: don't update psp annotation on update 2017-11-13 17:10:17 +01:00
Slava Semushin a4a3c7938a CreateContainerSecurityContext: rename; modify its arguments intead of returning a copy. 2017-11-13 16:02:03 +01:00
Slava Semushin a31a14924d CreatePodSecurityContext: rename; modify its arguments instead of returning a copy. 2017-11-13 16:00:42 +01:00
David Eads 032e136e38 add type assertions to admission plugins 2017-11-13 09:20:31 -05:00
David Eads e42a0bab5c split limitranger admission 2017-11-13 09:20:31 -05:00
David Eads f34fb9b0ab handle clusterrole migration 2017-11-13 08:18:00 -05:00
Kubernetes Submit Queue fe5b8fac86
Merge pull request #52148 from wackxu/addmtcase
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 case  in metadata_test.go

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

Add test case in metadata_test.go

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

**Release note**:

```release-note
NONE
```
2017-11-13 00:50:11 -08:00
Yuhao Fang 12fc5a5612 fixtypo 2017-11-13 10:26:31 +08:00
Kubernetes Submit Queue ecdf31d56c
Merge pull request #55221 from CaoShuFeng/priority
Automatic merge from submit-queue (batch tested with PRs 54987, 55221, 54099, 55144, 54215). 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>.

not calculate new priority when user update other spec of a pod

motivation of this change:
If we update the priority, pod validation mechanism will prevent this update
request, this is not expected.

**Release note**:
```
Priority admission controller: not calculate new priority when user update a pod
```
2017-11-10 14:51:25 -08:00
Dr. Stefan Schimanski 1e79dfb959 Update generated code 2017-11-10 18:26:46 +01:00
Dr. Stefan Schimanski 72809a08b9 deepcopy: remove deepcopy register tags 2017-11-10 18:25:26 +01:00
Kubernetes Submit Queue a43c6e41d5
Merge pull request #55291 from hzxuzhonghu/admission-initializer
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>.

remove redundant code in admission initializer

**What this PR does / why we need it**:
remove unused return error in `k8s.io\kubernetes\staging\src\k8s.io\apiserver\pkg\admission\initializer\initializer.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
```
2017-11-10 05:38:08 -08:00
Cao Shufeng 1440949dc6 not calculate new priority when user update pods
motivation of this change:
If we update the priority, pod validation mechanism will prevent this update
request, this is not expected.
2017-11-10 16:10:51 +08:00
chenxingyu 954c97fe6d add e2e test on the hostport predicates 2017-11-10 15:44:23 +08:00
chenxingyu 2d44ef9dfa add hostip protocol to the hostport predicates and make unit test adapt to the code change 2017-11-10 15:41:52 +08:00
Dr. Stefan Schimanski b9efab0eb2 admission: split PodSecurityPolicy into mutating and validating part 2017-11-09 15:41:25 +01:00
Kubernetes Submit Queue c2a5a79ed6
Merge pull request #55252 from deads2k/admission-15-save-SA
Automatic merge from submit-queue (batch tested with PRs 53651, 55252). 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 serviceaccount admission into mutation and validation

Splits the SA admission plugin into mutation and validation halves.

I had some trouble with e2e tests before, so this got split out of another pull.
2017-11-09 06:18:11 -08:00
Gavin bed435deca compute pod selectors in priority meta data producer 2017-11-09 20:21:17 +08:00
Gavin 4aa92bac73 Refactoring of priority function(CaculateSpreadPriority) by using map/reduce pattern 2017-11-09 20:21:13 +08:00
Dr. Stefan Schimanski bec617f3cc Update generated files 2017-11-09 12:14:08 +01:00
Dr. Stefan Schimanski 012b085ac8 pkg/apis/core: mechanical import fixes in dependencies 2017-11-09 12:14:08 +01:00
Dr. Stefan Schimanski d13b936a2a pkg/apis/core: fixup conversion func names in dependencies 2017-11-09 12:14:07 +01:00
Kubernetes Submit Queue 4886a7091b
Merge pull request #55311 from CaoShuFeng/scheduler-trivial
Automatic merge from submit-queue (batch tested with PRs 53747, 54528, 55279, 55251, 55311). 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>.

[trivil] fix comment in kube-scheduler

**Release note**:
```
NONE
```
2017-11-08 19:31:15 -08:00
Kubernetes Submit Queue 412271d4d3
Merge pull request #55251 from deads2k/admission-13-toleration
Automatic merge from submit-queue (batch tested with PRs 53747, 54528, 55279, 55251, 55311). 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 podtolerations admission to mutate and validate separately

Updates the podtolerations admission plugin to mutate and validate separately.  This also fixes the bug where the toleration whitelist isn't respected for memory pressure.

```release-note-action-required
The `node.kubernetes.io/memory-pressure` taint now respects the configured whitelist.  If you need to use it, you'll have to add it to the whitelist.
```
2017-11-08 19:31:12 -08:00
Kubernetes Submit Queue 17f7183e74
Merge pull request #55172 from hongshibao/master
Automatic merge from submit-queue (batch tested with PRs 54493, 52501, 55172, 54780, 54819). 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 divide by zero issue in calculating spread priority for zones

```release-note
NONE
```
2017-11-08 15:41:18 -08:00
Kubernetes Submit Queue 648cc300b9
Merge pull request #54854 from kawych/hpa_roles
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>.

Allow HPA to get custom metrics

**What this PR does / why we need it**:
This PR allows HPA to read custom metrics.

**Release note**:
```release-note
Allow HPA to read custom metrics.
```
2017-11-08 13:16:37 -08:00
Yongkun Anfernee Gui 4be6a60df2 Refactor Priority Reduce functions
- Reducing the duplicated reduce function by introducing a reduce
  function generator that generates common reduce functions.
- Remove logs from reduce function, so it's purely calculating scores.
- Optimize the reduce functions by removing unnecessary conversion to
  float64.
2017-11-08 10:00:23 -08:00
Cao Shufeng 612b334fb9 [trivil] fix comment in kube-scheduler 2017-11-08 17:42:46 +08:00
Kubernetes Submit Queue 33f873dbbe
Merge pull request #55262 from liggitt/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>.

Fix 'Schedulercache is corrupted' error

Fixes #50916

If an Assume()ed pod is Add()ed with a different nodeName, the podStates view of the pod is not corrected to reflect the actual nodeName. On the next Update(), the scheduler observes the mismatch and process exits.

```release-note
Fixed 'Schedulercache is corrupted' error in kube-scheduler
```
2017-11-07 23:23:33 -08:00
hzxuzhonghu 9d1e6d3e2c remove redundant code in admission initializer 2017-11-08 10:54:06 +08:00
Jordan Liggitt a366e6ced0
Fix 'Schedulercache is corrupted' error 2017-11-07 18:49:49 -05:00
Kubernetes Submit Queue e1de2ad507
Merge pull request #52562 from ironcladlou/kube-scheduler-config
Automatic merge from submit-queue (batch tested with PRs 53592, 52562, 55175, 55213). 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 kube-scheduler config API, command, and server setup

Refactor the kube-scheduler configuration API, command setup, and server setup according to the guidelines established in #32215 and using the kube-proxy refactor (#34727) as a model of a well factored component adhering to said guidelines.

* Config API: clarify meaning and use of algorithm source by replacing modality derived from bools and string emptiness checks with an explicit AlgorithmSource type hierarchy.
* Config API: consolidate client connection config with common structs.
* Config API: split and simplify healthz/metrics server configuration.
* Config API: clarify leader election configuration.
* Config API: improve defaulting.
* CLI: deprecate all flags except `--config`.
* CLI: port all flags to new config API.
* CLI: refactor to match kube-proxy Cobra command style.
* Server: refactor away configurator.go to clarify application wiring.
* Server: refactor to more clearly separate wiring/setup from running.

Fixes https://github.com/kubernetes/kubernetes/issues/52428.

@kubernetes/api-reviewers 
@kubernetes/sig-cluster-lifecycle-pr-reviews 
@kubernetes/sig-scheduling-pr-reviews 

/cc @ncdc @timothysc @bsalamat

```release-note
The kube-scheduler command now supports a `--config` flag which is the location of a file containing a serialized scheduler configuration. Most other kube-scheduler flags are now deprecated.
```
2017-11-07 11:21:19 -08:00
Kubernetes Submit Queue 26986e8407
Merge pull request #55058 from deads2k/admission-11-split-doubles
Automatic merge from submit-queue (batch tested with PRs 53273, 55058, 55237, 50140). 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 some admission plugins into mutation and validation halves

Splits the podnodeselector, serviceaccount, and priority admission plugins into validating and mutating admission plugins.

@kubernetes/sig-api-machinery-pr-reviews
2017-11-07 09:39:39 -08:00
Kubernetes Submit Queue d33077526a
Merge pull request #53273 from mikedanese/authtristate
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 support for short-circuit deny in union authorizer

This change has no behavioral changes.

Fixes https://github.com/kubernetes/kubernetes/issues/51862

```release-note
Add support for the webhook authorizer to make a Deny decision that short-circuits the union authorizer and immediately returns Deny. 
```
2017-11-07 09:25:37 -08:00
David Eads d701834c80 split serviceaccount admission into mutation and validation 2017-11-07 12:12:28 -05:00
David Eads 84e6251046 update podtolerations admission to mutate and validate separately 2017-11-07 11:56:12 -05:00
Dan Mace efb2bb71cd Refactor scheduler config API
Refactor the kube-scheduler configuration API, command setup, and server
setup according to the guidelines established in #32215 and using the
kube-proxy refactor (#34727) as a model of a well factored component
adhering to said guidelines.

* Config API: clarify meaning and use of algorithm source by replacing
modality derived from bools and string emptiness checks with an explicit
AlgorithmSource type hierarchy.
* Config API: consolidate client connection config with common structs.
* Config API: split and simplify healthz/metrics server configuration.
* Config API: clarify leader election configuration.
* Config API: improve defaulting.
* CLI: deprecate all flags except `--config`.
* CLI: port all flags to new config API.
* CLI: refactor to match kube-proxy Cobra command style.
* Server: refactor away configurator.go to clarify application wiring.
* Server: refactor to more clearly separate wiring/setup from running.

Fixes #52428.
2017-11-07 09:41:39 -05:00
Dan Mace 25ca287707 Update generated files 2017-11-07 09:41:35 -05:00
Kubernetes Submit Queue 32b761edf3
Merge pull request #54871 from anfernee/clean
Automatic merge from submit-queue (batch tested with PRs 55114, 52976, 54871, 55122, 55140). 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>.

haveSame is suboptimal, fix it as well as the name

**What this PR does / why we need it**: Make the util function simpler, also faster by reducing a for loop.

**Special notes for your reviewer**:

**Release note**:
```release-note
None
```
2017-11-06 23:19:18 -08:00
hongshibao 2141b9edd5 Fix divide by zero issue in calculating spread priority for zones 2017-11-06 23:39:05 +08:00
David Eads 2c671614df split some admission plugins into mutation and validation halves 2017-11-06 09:07:00 -05:00
Kubernetes Submit Queue aed9ad4b08
Merge pull request #54778 from stewart-yu/addexplain
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 comment for preempt sunction.

**What this PR does / why we need it**:
Add explain for preempt sunction.

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-11-04 15:42:20 -07:00
Mike Danese 12125455d8 move authorizers over to new interface 2017-11-03 13:46:28 -07:00
Kubernetes Submit Queue 6fe3a4d82a
Merge pull request #55000 from deads2k/admission-10-split
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>.

make easy validation admission plugins into validators

This switches "easy" admission plugins that need to be validators to be validators.  I also did one simple plugin to do both mutation and validation for practice.

@kubernetes/sig-api-machinery-pr-reviews @caesarxuchao
2017-11-03 06:33:17 -07:00
David Eads 75c448dbc7 make easy validation admission plugins into validators 2017-11-03 07:54:39 -04:00
Yongkun Anfernee Gui 5d268eb1d3 haveSame is suboptimal, fix it as well as the name 2017-11-02 22:50:32 -07:00
Kubernetes Submit Queue 2084f7f4f3
Merge pull request #54488 from lichuqiang/plugin_base
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 admission handler for device resources allocation

**What this PR does / why we need it**:
Add admission handler for device resources allocation to fail fast during pod creation

**Which issue this PR fixes** 
fixes #51592

**Special notes for your reviewer**:
@jiayingz Sorry, there is something wrong with my branch in #51895. And I think the existing comments in the PR might be too long for others to view. So I closed it and opened the new one, as we have basically reach an agreement on the implement :)
I have covered the functionality and unit test part here, and would set about the e2e part ASAP

/cc @jiayingz @vishh @RenaudWasTaken 

**Release note**:

```release-note
NONE
```
2017-11-02 17:24:06 -07:00
Kubernetes Submit Queue 40212c17cd
Merge pull request #54484 from sttts/sttts-split-psp
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>.

admission: wire through validating-only admission

Based on https://github.com/kubernetes/kubernetes/pull/54232.

This is important and required for beta because it affects the shape of the webhook admission plugins that are going to be produced and is needed to make sure that our existing chain continues to properly verify and protect the API objects based on their final state after webhook admission mutators run.

We discussed this in the October 11 API machinery call with @erictune and @caesarxuchao and we agreed to do this as a requirement for beta. See this part of the recording: https://www.youtube.com/watch?v=mrgDPHyr4VY#t=325 .
2017-11-02 04:02:34 -07:00
Kubernetes Submit Queue e989ca4e63
Merge pull request #54812 from aveshagarwal/master-pod-toleration-restrictions-issues
Automatic merge from submit-queue (batch tested with PRs 54800, 53898, 54812, 54921, 53558). 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>.

Allow override of cluster level (default, whitelist) tolerations by namespace level empty (default, whitelist) tolerations.

Currently In PodTolerationRestriction admission plugin, if namespace level default and whitelist of tolerations are nil or empty, they do not override cluster level default and whitelist tolerations. 

This PR fixes the plugin to not override cluster level tolerations only when namespace level toleration are nil. IOW, if namespace level toleration are empty, they override cluster level tolerations. To be more clear, if following annotations are set to empty, they override cluster level tolerations.
 
``` 
scheduler.alpha.kubernetes.io/defaultTolerations : ""
scheduler.alpha.kubernetes.io/tolerationsWhitelist: ""
```

This behavior is inline with PodNodeSelector admission plugin too.

@sjenning @derekwaynecarr 

**Release Note**:

```release-note
In PodTolerationRestriction admisson plugin, if namespace level tolerations are empty, now they override cluster level tolerations. 
```
2017-11-02 03:14:21 -07:00
Dr. Stefan Schimanski aedcf681b3 admission: rename Validate{ -> Initialization}, Validat{ingAdmit -> e} 2017-11-02 09:29:55 +01:00
Dr. Stefan Schimanski 2452afffe0 admission: wire create+update validation func into kube registries 2017-11-02 09:29:16 +01:00
Dr. Stefan Schimanski 74b4223ab8 admission: complete plumbing of validation admission 2017-11-02 08:45:41 +01:00
Dr. Stefan Schimanski 970d2553cc admission: { -> Mutating}Admit(admission.Attributes) 2017-11-02 08:45:41 +01:00
lichuqiang ebd445eb8c add admission handler for device resources allocation 2017-11-02 09:17:48 +08:00
Yongkun Anfernee Gui 8465625bd7 Optimize the suboptimal image locality algorithm 2017-11-01 10:18:59 -07:00
Avesh Agarwal 13289d2218 Allow override of cluster level (default, whitelist) tolerations by namespace level empty (default, whitelist) tolerations. 2017-11-01 10:47:52 -04:00
Karol Wychowaniec 69d81c926a Allow HPA to get custom metrics 2017-10-31 11:46:07 +01:00
Stewart-YU bc2845ee08 Add explain for preempt sunction. 2017-10-31 08:27:52 +08:00
Kubernetes Submit Queue 7a944a69d6
Merge pull request #54485 from sttts/sttts-unify-admission-constructors
Automatic merge from submit-queue (batch tested with PRs 54761, 54748, 53991, 54485, 46951). 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>.

admission: unify plugin constructors

It's common in Go to return the actual object in constructors, not **one interface**
it implements. This allows us to implement multiple interfaces, but only have
one constructor. As having private types in constructors, we export all plugin structs, of course with private fields.

Note: super interfaces do not work if there are overlapping methods.
2017-10-30 15:38:33 -07:00
Dr. Stefan Schimanski ce6ecbbc54 Remove all api.Scheme references by using explicit package aliases 2017-10-30 19:54:02 +01:00
Kubernetes Submit Queue 9c35982e1a
Merge pull request #54691 from wackxu/priadm
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 wrong group for priorityclasses

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

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

**Special notes for your reviewer**:

assgin @bsalamat 

**Release note**:

```release-note
NONE
```
2017-10-30 10:31:03 -07:00
Dr. Stefan Schimanski 131905cdb8 admission: unify plugin constructors 2017-10-30 16:56:38 +01:00
Kubernetes Submit Queue 7c96feb298
Merge pull request #54047 from kuramal/my
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>.

Optimize Repeated registration of AlgorithmProvider when ApplyFeatureGates

**What this PR does / why we need it**:
modified ApplyFeatureGates() just add/del features, cancel the register of all AlgorithmProvider.

 there is Repeated registration of all AlgorithmProvider when ApplyFeatureGates() runs;
AlgorithmProvider have already registered when  package defaults loaded;
I think ApplyFeatureGates() is just add/del features, it needn't  register all AlgorithmProvider again
**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #

**Special notes for your reviewer**:

**Release note**:

```/release-note-none
```
2017-10-29 20:42:48 -07:00
wackxu 2430c24c61 update wrong group for priorityclasses 2017-10-28 10:35:41 +08:00
Kubernetes Submit Queue 27ef37a32d
Merge pull request #54320 from derekwaynecarr/quota-update
Automatic merge from submit-queue (batch tested with PRs 54331, 54655, 54320, 54639, 54288). 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>.

Ability to do object count quota for all namespaced resources

**What this PR does / why we need it**:
- Defines syntax for generic object count quota `count/<resource>.<group>`
- Migrates existing objects to support new syntax with old syntax
- Adds support to quota all standard namespace resources 
- Updates the controller to do discovery and replenishment on those resources
- Updates unit tests
- Tweaks admission configuration around quota
- Add e2e test for replicasets (demonstrate dynamic generic counting)

```
$  kubectl create quota test --hard=count/deployments.extensions=2,count/replicasets.extensions=4,count/pods=3,count/secrets=4
resourcequota "test" created
$ kubectl run nginx --image=nginx --replicas=2
$ kubectl describe quota
Name:                         test
Namespace:                    default
Resource                      Used  Hard
--------                      ----  ----
count/deployments.extensions  1     2
count/pods                    2     3
count/replicasets.extensions  1     4
count/secrets                 1     4
```

**Special notes for your reviewer**:
- simple object count quotas no longer require writing code
- deferring support for custom resources pending investigation about how to share caches with garbage collector.  in addition, i would like to see how this integrates with downstream quota usage in openshift.

**Release note**:
```release-note
Object count quotas supported on all standard resources using `count/<resource>.<group>` syntax
```
2017-10-27 15:42:24 -07:00
Kubernetes Submit Queue 7d628db7cb
Merge pull request #54657 from anfernee/sched
Automatic merge from submit-queue (batch tested with PRs 54635, 54250, 54657, 54696, 54700). 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 pods in genericScheduler

**What this PR does / why we need it**: source code cleanup. less confusion.

**Special notes for your reviewer**:

**Release note**:

```release-note
None
```
2017-10-27 14:38:26 -07:00
Derek Carr 5b4ca14307 Update admission control framework for quota 2017-10-27 11:08:14 -04:00
Kubernetes Submit Queue 3a5eab236f Merge pull request #54538 from WIZARD-CXY/updatehostPort
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>.

delete the hostport from usedmap

**What this PR does / why we need it**:
delete the hostport record when pod is not on the host

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

Facilitate the further pr https://github.com/kubernetes/kubernetes/pull/52421. Because the code which detects the conflict between wantports and existingports is not quite clean now.
Besides remove the unused port from map will save the memory.

**Special notes for your reviewer**:

I and the original coder @k82cn agreed to make this change

**Release note**:

```release-note
NONE
```
2017-10-27 02:18:41 -07:00
Yongkun Anfernee Gui 6ef9cf4936 Remove unused pods in genericScheduler 2017-10-26 15:23:26 -07:00
David Eads 8c1fe1f61a move webhook admission to generic apiserver 2017-10-26 07:45:49 -04:00
Kubernetes Submit Queue 32847aab1d Merge pull request #51783 from jiulongzaitian/myfeature3
Automatic merge from submit-queue (batch tested with PRs 54081, 54271, 51783, 54600, 54594). 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>.

move getMaxVols function to predicates.go and add some NewVolumeCount…

…Predicate funcs

Signed-off-by: zhangjie <zhangjie0619@yeah.net>



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

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

**Special notes for your reviewer**:

**Release note**:

```release-note
move getMaxVols function to predicates.go and add some NewVolumeCountPredicate funcs
```
2017-10-26 02:43:48 -07:00
zhangjie 968df828a0 move getMaxVols function to predicates.go and change the params of NewMaxPDVolumeCountPredicate funcs
Signed-off-by: zhangjie <zhangjie0619@yeah.net>
2017-10-26 12:11:09 +08:00
chentao1596 222470684c Adding unit tests to methods of 'plugin/pkg/scheduler/algorithm/priorities/util' 2017-10-26 11:22:42 +08:00
kuramal a48cc26443 Optimize Repeated registration of AlgorithmProvider when ApplyFeatureGates
Add InsertPredicateKeyToAlgorithmProviderMap() and RemovePredicateKeyFromAlgorithmProviderMap() to insert/remove fit predicate key of all algorithmProviders which in algorithmProviderMap
Add Func RemovePredicateKeyFromAlgoProvider() AND InsertPredicateKeyToAlgoProvider() which can insert/remove fit predicate key to specific algorithmProvider
2017-10-26 10:10:48 +08:00
Kubernetes Submit Queue 17638ee018 Merge pull request #54414 from deads2k/admission-08-options
Automatic merge from submit-queue (batch tested with PRs 53760, 48996, 51267, 54414). 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 admission webhook to handle multiple auth domains

Fixes https://github.com/kubernetes/kubernetes/issues/54404

Adds some wiring to have the admission plugin accept a config file for per-apiserver configuration.

@kubernetes/sig-auth-api-reviews @deads2k @ericchiang @liggitt in particular
@kubernetes/sig-api-machinery-pr-reviews @lavalamp @caesarxuchao @sttts @cheftako

```release-note
generic webhook admission now takes a config file which describes how to authenticate to webhook servers
```
2017-10-25 17:37:11 -07:00
chenxingyu 195de933f1 delete the hostport from usedmap 2017-10-25 15:49:18 +08:00
Bobby (Babak) Salamat ccc62412a3 Autogenerated files 2017-10-24 16:04:58 -07:00
Bobby (Babak) Salamat 5497e893ae Change type of scheduling queue from cache.FIFO to a new interface 2017-10-24 16:04:58 -07:00
Haoran Wang 4b185b4db9 update scheduler to use schedulerName selector 2017-10-24 13:31:38 +08:00
Kubernetes Submit Queue 6a444673b9 Merge pull request #53914 from bsalamat/pdb
Automatic merge from submit-queue (batch tested with PRs 53903, 53914, 54374). 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 PodDisruptionBudget to scheduler cache.

**What this PR does / why we need it**:
This is the first step to add support for PodDisruptionBudget during preemption. This PR adds PDB to scheduler cache.

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

**Special notes for your reviewer**: None

**Release note**:

```release-note
Add PodDisruptionBudget to scheduler cache.
```

ref/ #53913
2017-10-23 12:27:06 -07:00
Kubernetes Submit Queue fd3878a59d Merge pull request #54333 from liggitt/webhook-service-resolver
Automatic merge from submit-queue (batch tested with PRs 54363, 54333). 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>.

Ensure port on resolved service host

The resolved host should include a port so it can be used by dialers directly. It's also not necessary to reparse the URL when constructing directly.

```release-note
NONE
```
2017-10-23 11:30:25 -07:00
David Eads fd4ab3e061 update admission webhook to handle multiple auth domains 2017-10-23 12:33:54 -04:00
Kubernetes Submit Queue 3812230f4d Merge pull request #48963 from Raffo/master
Automatic merge from submit-queue (batch tested with PRs 52792, 48963). 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 range for min value in imagepolicy admission 

**What this PR does / why we need it**:
This makes the range for imagepolicy admission work properly. Currently if we specify `1s` for the value of `AllowTTL` or `DenyTTL` in the configuration yaml, we get a message like the following: 

```
Error: failed to initialize plugins: Couldn't init admission plugin "ImagePolicyWebhook": valid value is between 1s and 30m0s, got 1s
```

This is due to a wrong comparison which is fixed in this PR. The rest of the PR just adds tests for this behaviour.
2017-10-21 15:10:12 -07:00
Bobby (Babak) Salamat efc151f46b Autogenerated files 2017-10-20 23:22:03 -07:00
Bobby (Babak) Salamat 9a5d058e5e Add PodDisruptionBudget to scheduler cache. 2017-10-20 23:22:02 -07:00
Jordan Liggitt d45f01e953
Ensure port on resolved service host 2017-10-20 23:01:11 -04:00
Bobby (Babak) Salamat ffa9ed60a8 Fix scheduler permission to patch pods 2017-10-20 18:04:37 -07:00
Kubernetes Submit Queue 10cafb8390 Merge pull request #54309 from liggitt/replicaset-permissions
Automatic merge from submit-queue (batch tested with PRs 52147, 54309). 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 bootstrap policy with replicaset/daemonset permissions in the apps API group

Resolves #54310

Bootstrap policy was not updated when replicasets and daemonsets got promoted to the apps group

```release-note
Resolves forbidden error when accessing replicasets and daemonsets via the apps API group
```
2017-10-20 14:58:14 -07:00
Jordan Liggitt 3789051726
Update bootstrap policy with replicaset/daemonset permissions in the apps API group 2017-10-20 12:59:39 -04:00
Kubernetes Submit Queue fe6258fb9b Merge pull request #54261 from yguo0905/sched-fix
Automatic merge from submit-queue (batch tested with PRs 54031, 54261). 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>.

Allow absent Weight if PrioritizeVerb is empty

The scheduler currently validates `ExtenderConfig.Weight` (the weight applied to `Prioritize`) even when `ExtenderConfig.PrioritizeVerb` is empty, which is not correct. A configuration without these two fields should be allowed. 

**Release note**:
```
None
```

/sig scheduling
2017-10-20 02:26:58 -07:00
Kubernetes Submit Queue 2523e3ebae Merge pull request #53759 from anfernee/sched-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>.

Make scheduler integration test faster

Not to wait for 30 seconds for every negative test case. This commit
also organizes the test code to make it more readable.

It cuts the test time from 450s to 125s.

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

**Special notes for your reviewer**:

**Release note**: 
```release-note
NONE
```
2017-10-19 16:50:58 -07:00
Yang Guo 1c60898bf5 Allow absent Weight if PrioritizeVerb is empty 2017-10-19 15:10:44 -07:00
David Eads 4e79357f9f default admission hook failure safely 2017-10-19 14:30:39 -04:00
David Eads 0859798e8e update admission webhook to accept client config 2017-10-19 09:52:58 -04:00
David Eads 33deaedaf6 add url path for admission webhooks 2017-10-19 08:06:38 -04:00
Kubernetes Submit Queue 66222c3dbe Merge pull request #53982 from tizhou86/schedulerUnitTest7
Automatic merge from submit-queue (batch tested with PRs 52753, 54034, 53982, 54209). 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>.

Make test case description more accurate.

**What this PR does / why we need it**:
Make test case description more accurate. This test case tests the GCE persistent disk instead of the general one, change the name to make it consistent with AWS/Azure/ISCSI test cases.

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

**Special notes for your reviewer**:
NONE

**Release note**:

```release-note
NONE
```
2017-10-19 02:45:22 -07:00
Kubernetes Submit Queue 65d9b4ef0b Merge pull request #51450 from lichuqiang/typo_fix
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 bug in admission test

tiny bug fix
2017-10-18 21:40:51 -07:00
Kubernetes Submit Queue 3f2ce7e557 Merge pull request #51458 from CaoShuFeng/use_map_in_admit
Automatic merge from submit-queue (batch tested with PRs 51310, 51458, 47636). 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 useless allocation of map

This one-element map is only used for checking api. Remove it and
simplify the code.

**Release note**:
```
NONE
```
2017-10-18 20:47:07 -07:00
Kubernetes Submit Queue fa21e531f9 Merge pull request #49305 from zhangxiaoyu-zidif/fix-err-output-for-admission-test
Automatic merge from submit-queue (batch tested with PRs 49305, 54158). 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 print for admission test

**What this PR does / why we need it**:
fix error print to make them easy to inspect.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #
NONE
**Special notes for your reviewer**:
NONE
**Release note**:

```release-note
NONE
```
2017-10-18 16:35:17 -07:00
Kubernetes Submit Queue b3a9b802da Merge pull request #53823 from deads2k/admission-01-allow-fail
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>.

allow fail close webhook admission

Webhook admission needs to allow failing closed.  Even in an alpha state, I don't want to be one DDOS away from having an exposed cluster.

/assign caesarxuchao
/assign sttts
2017-10-18 14:49:54 -07:00
Kubernetes Submit Queue 900c0761e3 Merge pull request #53722 from deads2k/rbac-01-allow-star
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>.

allow */subresource in rbac policy rules

xref #29698
xref #38756
xref #49504
xref #38810

Allow `*/subresource` format in RBAC policy rules to support polymorphic subresources like `*/scale` for HPA.

@DirectXMan12 fyi

```release-note
RBAC PolicyRules now allow resource=`*/<subresource>` to cover `any-resource/<subresource>`.   For example, `*/scale` covers `replicationcontroller/scale`.
```
2017-10-18 14:02:05 -07:00
Kubernetes Submit Queue 1bea47aaca Merge pull request #53896 from deads2k/admission-03-decode
Automatic merge from submit-queue (batch tested with PRs 47717, 53896). 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>.

decode admission responses into a fresh object

Something about the way the admission request object is built causes decoding into back into it to fail with 

```
W1013 14:10:42.457423    2960 admission.go:185] rejected by webhook namespacereservations.admission.online.openshift.io/apis/admission.online.openshift.io/v1alpha1/namespacereservations &{%!t(string=namespacereservations.admission.online.openshift.io/apis/admission.online.openshift.io/v1alpha1/namespacereservations) %!t(*errors.errorString=&{reflect.Value.Addr of unaddressable value})}: failed calling admission webhook "namespacereservations.admission.online.openshift.io/apis/admission.online.openshift.io/v1alpha1/namespacereservations": reflect.Value.Addr of unaddressable value
```

This simply creates a fresh object to decode into, which works fine for our usage and makes it possible to actually have the webhook call out to something.
2017-10-18 11:52:06 -07:00
David Eads f81b6004de allow fail close webhook admission 2017-10-18 14:28:02 -04:00
Kubernetes Submit Queue 2d914ee703 Merge pull request #53984 from sttts/sttts-legacyscheme
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>.

pkg/api: extract Scheme/Registry/Codecs into pkg/api/legacyscheme

This serves as

- a preparation for the pkg/api->pkg/apis/core move
- and makes the dependency to the scheme explicit when vizualizing
  left depenncies.

The later helps with our our efforts to split up the monolithic repo
into self-contained sub-repos, e.g. for kubectl, controller-manager
and kube-apiserver in the future.
2017-10-18 10:49:10 -07:00
Kubernetes Submit Queue f1b17e8896 Merge pull request #53995 from deads2k/admission-04-owner
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 deads to admission owners

/assign derekwaynecarr
2017-10-18 08:27:23 -07:00
Dr. Stefan Schimanski cad0364e73 Update bazel 2017-10-18 17:24:04 +02:00