Commit Graph

833 Commits (5b55e1f8ed6c6cce9040c075cbfbb422fb495943)

Author SHA1 Message Date
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
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
David Eads 7dc7693e86 make quota reusable 2017-12-13 08:39:55 -05: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
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
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
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
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 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 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
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
NickrenREN 6f7a1983ef Support ceph rbd resize 2017-11-22 19:48:02 +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
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
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
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
Harry Zhang e380c215d1 Add GA toleration key and leave alpha ones untouched 2017-11-17 22:07:05 +08:00
lichuqiang f77e154dbb ensure config file exists before loading configuration in imagePolicyWebhook 2017-11-16 23:27:56 +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
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
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
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
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
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
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 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
hzxuzhonghu 9d1e6d3e2c remove redundant code in admission initializer 2017-11-08 10:54:06 +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
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
David Eads 2c671614df split some admission plugins into mutation and validation halves 2017-11-06 09:07:00 -05:00
Mike Danese 12125455d8 move authorizers over to new interface 2017-11-03 13:46:28 -07:00
David Eads 75c448dbc7 make easy validation admission plugins into validators 2017-11-03 07:54:39 -04: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
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
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
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
wackxu 2430c24c61 update wrong group for priorityclasses 2017-10-28 10:35:41 +08:00
Derek Carr 5b4ca14307 Update admission control framework for quota 2017-10-27 11:08:14 -04:00
David Eads 8c1fe1f61a move webhook admission to generic apiserver 2017-10-26 07:45:49 -04: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
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
Jordan Liggitt d45f01e953
Ensure port on resolved service host 2017-10-20 23:01:11 -04: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 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 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
Dr. Stefan Schimanski 7773a30f67 pkg/api/legacyscheme: fixup imports 2017-10-18 17:23:55 +02:00
Kubernetes Submit Queue 229cbf4b6d Merge pull request #54030 from dims/fix-go1.9-admission-webhook-test-failure
Automatic merge from submit-queue (batch tested with PRs 54030, 54041). 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 admission webhook test failure in go1.9

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

Go 1.9 has some better checks for SAN extensions, notably:
630e93ed2d

We recently added ServerName to the rest client TLSConfig:
186a0684d5 (diff-eb3573c6b11347dc3793c477726480efR262)

So we need to be sure that the ServerName "webhook-test.default.svc" is
present in the certificates that we generate."

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

Fixes #54020

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-10-17 21:26:00 -07:00
Slava Semushin 1a3a2d47c8 admission_test.go: remove unused createNamespaceForTest() and createSAForTest() functions. 2017-10-17 12:03:46 +02:00
Davanum Srinivas 98509a9d05 Fix admission webhook test failure in go1.9
Go 1.9 has some better checks for SAN extensions, notably:
630e93ed2d

We recently added ServerName to the rest client TLSConfig:
186a0684d5 (diff-eb3573c6b11347dc3793c477726480efR262)

So we need to be sure that the ServerName "webhook-test.default.svc" is
present in the certificates that we generate."
2017-10-16 21:10:54 -04:00
David Eads 926a615775 add deads to admission owners 2017-10-16 13:43:54 -04:00
Jordan Liggitt 8c5b01376a
PodSecurityPolicy: Order by name, prefer non-mutating policies, require *api.Pod, allow GC updates 2017-10-16 02:22:11 -04:00
Jordan Liggitt abc7c077e1
PodSecurityPolicy: avoid unnecessary mutation of supplemental groups 2017-10-16 02:21:10 -04:00
Jordan Liggitt b45b809f4c
PodSecurityPolicy: Do not mutate nil privileged field to false 2017-10-16 02:21:10 -04:00
Jeff Grafton aee5f457db update BUILD files 2017-10-15 18:18:13 -07:00
David Eads 9adcbd72fb decode admission responses into a fresh object 2017-10-13 10:48:58 -04:00
Kubernetes Submit Queue d6b18a96dd Merge pull request #53611 from p0lyn0mial/pass_scheme_to_admission_plugins
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>.

removes k8s.io/kubernetes/pkg/api dependency from the webhook plugin.

**What this PR does / why we need it**: removes `k8s.io/kubernetes/pkg/api` dependency from `webhook` plugin. The runtime.scheme can be injected to the webhook from the plugin initializer.

**Release note**:

```
NONE
```
2017-10-10 13:53:27 -07:00
Kubernetes Submit Queue 6154a9e16c Merge pull request #53477 from caesarxuchao/genenic-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>.

Move initializer plugin to the generic apiserver

* Moves `k8s.io/kuberentes/plugin/pkg/admission/initialization` to `k8s.io/apiserver/pkg/admission/plugin/initialization`
* Moves `k8s.io/kubernetes/pkg/kubeapiserver/admission/configuration` to `k8s.io/apiserver/pkg/admission/configuration`
* The initializer plugin used to depend on `k8s.io/kubernetes` because it does a type assertion of `api.Pod`. It tries to skip mirror pod. I converted that code to use the generic accessor pattern.
2017-10-10 09:46:00 -07:00
p0lyn0mial fa96700b76 removes k8s.io/kubernetes/pkg/api dependency from the webhook plugin. 2017-10-09 22:25:03 +02:00
Chao Xu bbac32c299 generated 2017-10-09 10:58:12 -07:00
Chao Xu 89a0511fcb move initializer to the generic apiserver
move k8s.io/kubernetes/plugin/pkg/admission/initialization to
k8s.io/apiserver/pkg/admission/plugin/initialization/initialization.go;
move k8s.io/kubernetes/pkg/kubeapiserver/admission/configuration to
k8s.io/apiserver/pkg/admission/configuration.
2017-10-09 10:57:00 -07:00
Kubernetes Submit Queue c1703a4998 Merge pull request #53343 from p0lyn0mial/move_newAdmissionReview_method_to_webhook
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>.

moves admission.v1alpha1.NewAdmissionReview method to webhook plugin

**What this PR does / why we need it**:
this is necessary, because the webhook plugin will be moved down to apiserver.

**Release note**:

```
NONE
```
2017-10-05 02:24:14 -07:00
p0lyn0mial 187171284a moves admission.v1alpha1.NewAdmissionReview to webhook plugin
this is necessary, because the webhook plugin will be moved down to apiserver.
2017-10-04 19:50:27 +02:00
p0lyn0mial 6b1f1d1414 removes Authorizer and ExternalClientSet from kubeapiserver's admission initializer. 2017-10-03 18:08:30 +02:00
p0lyn0mial 475493ced6 moved admission interfaces WantsClientCert, WantsAuthorizer and WantsExternalKubeClientSet to apiserver 2017-10-01 15:03:08 +02:00
Kubernetes Submit Queue 7c9e614cbb Merge pull request #52873 from ixdy/bazel-cleanup
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>..

bazel: build/test almost everything

**What this PR does / why we need it**: Miscellaneous cleanups and bug fixes. The main motivating idea here was to make `bazel build //...` and `bazel test //...` mostly work. (There's a few reasons these still don't work, but we're a lot closer.)

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```

/assign @BenTheElder @mikedanese @spxtr
2017-09-24 00:04:36 -07:00
Kubernetes Submit Queue f67e127a3b Merge pull request #52558 from jennybuckley/master
Automatic merge from submit-queue (batch tested with PRs 52831, 52764, 52763, 52673, 52558). 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 updating objects with empty pending initializers list

**What this PR does / why we need it**: When updating an object, an empty pending list should be treated as a nil initializer. This PR fixes a bug which prevented this functionality and also adds a test which will ensure this functionality is preserved.

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

**Special notes for your reviewer**:

/cc @caesarxuchao

**Release note**:

```release-note
Fixes an initializer bug where update requests which had an empty pending initializers list were erroneously rejected.
```
2017-09-23 22:57:57 -07:00
Kubernetes Submit Queue 7f3f986402 Merge pull request #52673 from p0lyn0mial/webhook_default_service_resolver
Automatic merge from submit-queue (batch tested with PRs 52831, 52764, 52763, 52673, 52558). 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>..

default service resolver for webhook admission

**What this PR does / why we need it**:
provides a default service resolver for webhook plugin. The rationale behind is that webhook plugins names can be resolved by a dns server working inside a cluster.


**Release note**:

```
NONE
```
2017-09-23 22:57:54 -07:00
Kubernetes Submit Queue 04673ab614 Merge pull request #52618 from dims/deprecate-pvl-admission-controller
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>..

deprecate warning for persistent volume admission controller

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

deprecate warning for persistent volume admission controller

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

Fixes #52617

**Special notes for your reviewer**:

**Release note**:

```release-note
PersistentVolumeLabel admission controller is now deprecated.
```
2017-09-21 22:04:55 -07:00
Jeff Grafton 02fb4200dc Use buildozer to delete licenses() rules 2017-09-21 15:53:22 -07:00
Jeff Grafton 532bd482df Use buildozer to remove deprecated automanaged tags 2017-09-21 15:53:22 -07:00
Davanum Srinivas cf3fe0b5d4 deprecate warning for persistent volume admission controller 2017-09-21 14:36:29 -04:00
jennybuckley 44ec189fb0 Fixed logic with updates in initializer plugin 2017-09-21 11:06:14 -07:00
p0lyn0mial 1e2c7fdd88 default service resolver for webhook admission
the rationale behind is that webhook plugins names can be resolved by a dns server working inside a cluster.
2017-09-20 17:37:11 +02:00
Kubernetes Submit Queue fb994df7e0 Merge pull request #51337 from php-coder/psp_star_in_allowed_caps
Automatic merge from submit-queue (batch tested with PRs 51337, 47080, 52646, 52635, 52666). 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.allowedCapabilities: add support for * to allow to request any capabilities

**What this PR does / why we need it**:
Prior this change there was no way to allow to pods to request any capabilities. Cluster admin had always specify a full list of capabilities explicitly. Because there are many of them, it gets tedious. This PR makes possible to use `*` to allow all possible capabilities. Non-paranoid (and lazy) cluster admins can use it. Those who are super strict and paranoid of course won't use it because `*` allows capabilities that don't exist today but may be introduced in the future.

"privileged" PSP in examples was modified to allow privileged users to use this feature.

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

**Special notes for your reviewer**:
This functional is already present in OpenShift: https://github.com/openshift/origin/pull/12875 and https://github.com/openshift/origin/pull/15135

**Release note**:
```release-note
PSP: add support for using `*` as a value in `allowedCapabilities` to allow to request any capabilities
```

CC @simo5 @pweil- @gyliu513 @liqlin2015
2017-09-19 17:31:04 -07:00
Hemant Kumar 780c531e86 Resize plugin should only check for increase in size
We should only check if user is trying to increase the volume.
2017-09-18 14:36:14 -04:00
Kubernetes Submit Queue 935726f109 Merge pull request #52452 from gnufied/fix-quota-on-update
Automatic merge from submit-queue (batch tested with PRs 52452, 52115, 52260, 52290)

Fix support for updating quota on update

This PR implements support for properly handling quota when resources are updated. We never take negative values and add them up.

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

cc @derekwaynecarr 

/sig storage

```release-note
Make sure that resources being updated are handled correctly by Quota system
```
2017-09-15 01:59:56 -07:00
Chao Xu 856a1db57a fix the webhook unit test; the server cert needs to have a valid CN;
fix a fuzzer;
2017-09-14 15:36:25 -07:00
Chao Xu 186a0684d5 plumb the proxyTransport to the webhook admission plugin;
set the ServerName in the config for webhook admission plugin.
2017-09-14 15:35:12 -07:00
Hemant Kumar 066fcf785e Implement support for updating resources 2017-09-13 21:05:44 -04:00
Slava Semushin 9015a82692 PodSecurityPolicy.allowedCapabilities: add support for using * to allow to request any capabilities.
Also modify "privileged" PSP to use it and allow privileged users to use
any capabilities.
2017-09-06 12:18:09 +02:00
David Eads 2572ea50e0 add permissions to workload controllers to block owners 2017-09-05 13:47:49 -04:00
David Eads 6d040812f0 check block owner ref on finalizers subresource 2017-09-05 11:29:52 -04:00
Hemant Kumar e78d433150 Implement necessary API changes
Introduce feature gate for expanding PVs
Add a field to SC
Add new Conditions and feature tag pvc update
Add tests for size update via feature gate
register the resize admission plugin
Update golint failures
2017-09-04 09:02:34 +02:00
staebler a4542ae528 Create an EventRateLimit admission control plug-in for the API Server.
The EventRateLimit plug-in limits the number of events that the API Server
will accept in a given time period. It allows for server-wide, per-namespace,
per-user,and per-source+object rate limiting.
2017-09-01 13:38:03 -04:00
Kubernetes Submit Queue 374e631626 Merge pull request #50757 from NickrenREN/local-storage-limitrange
Automatic merge from submit-queue

Add local ephemeral storage support in LimitRange

**Special notes for your reviewer**:
For a single local ephemeral storage resource

xref #43607 

**Release note**:
```release-note
Add local ephemeral storage support to LimitRange
```

/assign @jingxu97 
cc @ddysher
2017-08-30 13:12:23 -07:00
Dr. Stefan Schimanski 42b40ddc0f admission plugins: simplify deepcopy calls 2017-08-29 20:01:08 +02:00
Jordan Liggitt 658956f063
Feature gate initializers field 2017-08-28 11:11:48 -04:00
Cao Shufeng 83157370a1 remove useless allocation of map
This one-element map is only used for checking api. Remove it and
simplify the code.
2017-08-28 17:36:19 +08:00
lichuqiang d59368906a fix bug in admission test 2017-08-28 16:18:50 +08:00
Kubernetes Submit Queue 877ee91930 Merge pull request #51082 from caesarxuchao/repair-null-pending-initializer
Automatic merge from submit-queue (batch tested with PRs 50953, 51082)

Fix mergekey of initializers; Repair invalid update of initializers

Fix https://github.com/kubernetes/kubernetes/issues/51131

The PR did two things to make parallel patching `metadata.initializers.pending` possible:
* Add mergekey to initializers.pending
* Let the initializer admission plugin set the `metadata.intializers` to nil if an update makes the `pending` and the `result` both nil, instead of returning a validation error. Otherwise if multiple initializer controllers sending the patch removing themselves from `pending` at the same time, one of them will get a validation error.


```release-note
The patch to remove the last initializer from metadata.initializer.pending will result in metadata.initializer to be set to nil (assuming metadata.initializer.result is also nil), instead of resulting in an validation error.
```
2017-08-26 23:03:01 -07:00
Kubernetes Submit Queue 217513e27a Merge pull request #45294 from liggitt/proto-slices
Automatic merge from submit-queue

Remove null -> [] slice hack

Closes #44593

When 1.6 added protobuf storage, the storage layer lost the ability to persist slice fields with empty but non-null values.

As a workaround, we tried to convert empty slice fields to `[]`, rather than `null`. Compressing `null` -> `[]` was just as much of an API breakage as `[]` -> `null`, but was hoped to cause fewer problems in clients that don't do null checks.

Because of conversion optimizations around converting lists of objects, the `null` -> `[]` hack was discovered to only apply to individual get requests, not to a list of objects. 1.6 and 1.7 was released with this behavior, and the world didn't explode. 1.7 documented the breaking API change that `null` and `[]` should be considered equivalent, unless otherwise noted on a particular field.

This PR:

* Reverts the earlier attempt (https://github.com/kubernetes/kubernetes/pull/43422) at ensuring non-null json slice output in conversion
* Makes results of `get` consistent with the results of `list` (which helps naive clients that do deepequal comparisons of objects obtained via list/watch and get), and allows empty slice fields to be returned as `null`

```release-note
Protobuf serialization does not distinguish between `[]` and `null`.
API fields previously capable of storing and returning either `[]` and `null` via JSON API requests (for example, the Endpoints `subsets` field) can now store only `null` when created using the protobuf content-type or stored in etcd using protobuf serialization (the default in 1.6+). JSON API clients should tolerate `null` values for such fields, and treat `null` and `[]` as equivalent in meaning unless specifically documented otherwise for a particular field.
```
2017-08-26 13:35:29 -07:00
NickrenREN 934087a6dc Add test cases to test local ephemeral storage for limitrange 2017-08-26 22:26:00 +08:00
Jordan Liggitt c7defb806f
Generated files 2017-08-25 15:01:08 -04:00
Chao Xu 4928c8d1bf let resourcequota evaluator handle uninitialid pod and pvc 2017-08-24 14:50:03 -07:00
Chao Xu 14dc1d8cb1 generated 2017-08-24 13:35:26 -07:00
Chao Xu 1e837a9387 add unit test 2017-08-24 13:35:26 -07:00
Chao Xu fcd646d80e Let the initializer admission plugin set the metadata.intializers to nil
if an update makes the pendings and the result both nil
2017-08-24 11:23:51 -07:00
Kubernetes Submit Queue afabd09889 Merge pull request #50876 from enj/enj/f/owners_reviewer
Automatic merge from submit-queue

Add enj as reviewer to OWNERS

Adding myself as a reviewer for the following areas:

- API
- auth
- registry
- storage (etcd)

Signed-off-by: Monis Khan <mkhan@redhat.com>

**Release note**:

```release-note
NONE
```

@kubernetes/sig-api-machinery-pr-reviews
@kubernetes/sig-auth-pr-reviews
2017-08-18 05:42:07 -07:00
Monis Khan dd06794bc2
Add enj as reviewer to OWNERS
Adding myself as a reviewer for the following areas:

- API
- auth
- registry
- storage (etcd)

Signed-off-by: Monis Khan <mkhan@redhat.com>
2017-08-17 20:42:46 -04:00
Chao Xu bf6155b08c make admission plugins handle mutating spec of uninitialized pods 2017-08-17 12:51:09 -07:00
Kubernetes Submit Queue 55160e7cc1 Merge pull request #49322 from bsalamat/priority_admission
Automatic merge from submit-queue

Add Priority admission controller

**What this PR does / why we need it**: Add Priority admission controller. This admission controller checks creation and update of PriorityClasses. It also resolves a PriorityClass name of a pod to its integer value.

**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
Add Priority admission controller for monitoring and resolving PriorityClasses.
```

ref/ #47604
ref/ #48646
2017-08-15 03:13:15 -07:00
Kubernetes Submit Queue 9f902fef24 Merge pull request #50094 from sttts/sttts-no-importprefix
Automatic merge from submit-queue (batch tested with PRs 50094, 48966, 49478, 50593, 49140)

apimachinery: remove pre-apigroups import path logic

Replacing #50093.
2017-08-14 12:14:55 -07:00
Kubernetes Submit Queue f8eed144f5 Merge pull request #50180 from k82cn/k8s_42001-2
Automatic merge from submit-queue

Task 3: Add MemoryPressure toleration for no BestEffort pod.

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

**Release note**:
```release-note
After 1.8, admission controller will add 'MemoryPressure' toleration to Guaranteed and Burstable pods.
```
2017-08-14 10:51:17 -07:00
Kubernetes Submit Queue 03ea3eeff2 Merge pull request #47724 from FengyunPan/update-admission-control-arg
Automatic merge from submit-queue

Update admission control args in imagepolicy comment

Use '--admission-control-config-file' rather than
'--admission-controller-config-file'

**Release note**:
```release-note
NONE
```
2017-08-11 18:26:57 -07:00
Kubernetes Submit Queue cd4f6edf33 Merge pull request #47017 from zhangxiaoyu-zidif/fix-name-print-type
Automatic merge from submit-queue

Fix print type of podname

**What this PR does / why we need it**:
It is better to change it to %s. According to context and other prints of this file, pod name's print type are all %s, except this one.
Although it does not affect the result.

**Release note**:

```release-note
NONE
```
2017-08-11 15:52:35 -07:00
Jeff Grafton a7f49c906d Use buildozer to delete licenses() rules except under third_party/ 2017-08-11 09:32:39 -07:00
Jeff Grafton 33276f06be Use buildozer to remove deprecated automanaged tags 2017-08-11 09:31:50 -07:00
Dr. Stefan Schimanski 8728576236 apimachinery: remove pre-apigroups import prefix logic 2017-08-10 13:07:54 +02:00
Klaus Ma 03e4394938 Add MemoryPressure/DiskPressure toleration for no BestEffort pod. 2017-08-09 22:23:52 +08:00
Michael Taufen 443d58e40a Dynamic Kubelet Configuration
Alpha implementation of the Dynamic Kubelet Configuration feature.
See the proposal doc in #29459.
2017-08-08 12:21:37 -07:00
Bobby (Babak) Salamat bef83fbeb9 Addressed reviewer comments 2017-08-07 17:07:20 -07:00
Bobby (Babak) Salamat e25476a6ed autogenerated files 2017-07-31 10:16:35 -07:00
supereagle a1c880ece3 update generated deepcopy code 2017-07-31 22:33:00 +08:00
Bobby (Babak) Salamat de8689c99b Add priority admission controller 2017-07-27 18:44:40 -07:00
Kubernetes Submit Queue 9c3d0e8a96 Merge pull request #48224 from deads2k/controller-11-reflectormetrics
Automatic merge from submit-queue (batch tested with PRs 48224, 45431, 45946, 48775, 49396)

add reflector metrics

This adds metrics (optionally prometheus) to reflectors so that you can see when one reflector is behaving poorly and just how poorly its doing.

@eparis 

```release-note
Adds metrics for checking reflector health.
```
2017-07-25 11:06:47 -07:00
deads2k 151d39682e add reflector metrics 2017-07-25 09:01:37 -04:00
zhangxiaoyu-zidif b2e6cf2442 fix error print 2017-07-25 17:33:59 +08:00
Kubernetes Submit Queue 633079eb01 Merge pull request #47864 from droot/podpreset-conflict-fix
Automatic merge from submit-queue (batch tested with PRs 49444, 47864, 48584, 49395, 49118)

fixed conflict resolution behavior while apply podpresets

**What this PR does / why we need it**:
This fixes the PodPreset application behavior in case of conflicts occur during the merging of Pod's information with PodPreset's. More details are in issue #47861 

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

**Special notes for your reviewer**:
We are splitting the PodPreset application logic in two phases. In first phase, we try to detect the conflicts in information merging without modifying the Pod at all. If conflict occurs, then we reject the PodPresets injection. Incase of no conflicts, we apply the PodPresets and merge the information.

**Release note**:

```release-note
PodPreset is not injected if conflict occurs while applying PodPresets to a Pod.
```
2017-07-24 13:52:34 -07:00
Sunil Arora 4d5b96f94e fixed conflict resolution behavior while apply podpresets 2017-07-21 13:19:57 -07:00
Daniel Fernandes Martins 81ba522bbe Make NodeRestriction admission allow evictions for bounded pods 2017-07-20 14:20:03 -03:00
Kubernetes Submit Queue 1bb6b815e2 Merge pull request #49120 from jpeeler/podpreset-nonamespace
Automatic merge from submit-queue (batch tested with PRs 49120, 46755, 49157, 49165, 48950)

Modify podpreset lister to use correct namespace

Previously a pod with an empty namespace field submitted to a given namespace
was incorrectly matching preset labels in a different namespace.

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

Release note:
```release-note
Fix pod preset to ignore input pod namespace in favor of request namespace
```
2017-07-19 00:06:20 -07:00
Kubernetes Submit Queue 2492477f0d Merge pull request #49110 from xiangpengzhao/remove-annotation-affinity
Automatic merge from submit-queue (batch tested with PRs 49055, 49128, 49132, 49134, 49110)

Remove affinity annotations leftover

**What this PR does / why we need it**:
This is a further cleanup for affinity annotations, following #47869.

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

**Special notes for your reviewer**:
- I remove the commented test cases and just leave TODOs instead. I think converting these untestable test cases for now is not necessary. We can add new test cases in future.
- I remove the e2e test case `validates that embedding the JSON PodAffinity and PodAntiAffinity setting as a string in the annotation value work` because we have a test case `validates that InterPod Affinity and AntiAffinity is respected if matching` to test the same thing.

/cc @aveshagarwal @bsalamat  @gyliu513 @k82cn @timothysc 

**Release note**:

```release-note
NONE
```
2017-07-18 21:54:25 -07:00
Chao Xu 590793f9a7 generated 2017-07-18 15:20:05 -07:00
Chao Xu 57a96ca40a move admission/v1alpha1 to k8s.io/api 2017-07-18 13:26:20 -07:00
Jeff Peeler 74463e5e66 Modify podpreset lister to use correct namespace
Previously a pod with an empty namespace field submitted to a given namespace
was incorrectly matching preset labels in a different namespace.
2017-07-18 13:52:50 -04:00
xiangpengzhao d9d3396566 Remove affinity annotations leftover 2017-07-18 19:42:52 +08:00
Dr. Stefan Schimanski 8dd0989b39 Update generated code 2017-07-18 09:28:49 +02:00
Dr. Stefan Schimanski 39d95b9b06 deepcopy: add interface deepcopy funcs
- add DeepCopyObject() to runtime.Object interface
- add DeepCopyObject() via deepcopy-gen
- add DeepCopyObject() manually
- add DeepCopySelector() to selector interfaces
- add custom DeepCopy func for TableRow.Cells
2017-07-18 09:28:47 +02:00
Jacob Simpson 29c1b81d4c Scripted migration from clientset_generated to client-go. 2017-07-17 15:05:37 -07:00
Raffaele Di Fazio f1f25b8929
Fixes range for min value in imagepolicy admission 2017-07-14 22:19:37 +02:00
Kubernetes Submit Queue 80a0f555db Merge pull request #48748 from liggitt/node-restriction-message
Automatic merge from submit-queue (batch tested with PRs 48405, 48742, 48748, 48571, 48482)

Improve node restriction message

Help debug https://github.com/kubernetes/kubernetes/issues/48687#issuecomment-314224531

/assign @luxas
2017-07-12 08:05:20 -07:00
Jordan Liggitt e3e25df5df
Improve node restriction message 2017-07-10 22:44:24 -04:00
Tim Allclair a2f2e1d491 Name change: s/timstclair/tallclair/ 2017-07-10 14:05:46 -07:00
Chao Xu 60604f8818 run hack/update-all 2017-06-22 11:31:03 -07:00
Chao Xu e185f7e277 run hack/update-codegen.sh 2017-06-22 11:30:58 -07:00
Chao Xu cde4772928 run ./root-rewrite-all-other-apis.sh, then run make all, pkg/... compiles 2017-06-22 11:30:52 -07:00
Chao Xu f4989a45a5 run root-rewrite-v1-..., compile 2017-06-22 10:25:57 -07:00
mbohlool 70c4fe7f4f update generated files 2017-06-21 04:09:08 -07:00
mbohlool c91a12d205 Remove all references to types.UnixUserID and types.UnixGroupID 2017-06-21 04:09:07 -07:00
FengyunPan 8646f79aa2 Update admission control args
Use '--admission-control-config-file' rather than
'--admission-controler-config-file'
2017-06-18 21:49:07 +08:00
Chao Xu fa88d08172 remove retry logic in initializer AC configuration loader 2017-06-14 20:12:41 -07:00
Kubernetes Submit Queue 2939837923 Merge pull request #46808 from caesarxuchao/make-daniels-pr-dynamic
Automatic merge from submit-queue (batch tested with PRs 47204, 46808, 47432, 47400, 47099)

Make the generic webhook admission controller use the dynamic webhook config manager

Based on #46672 and #46388.

Only the last commit is unique.

* removed `SetWebhookSource` from the PluginInitializer
* implemented `SetExternalClientset` for the generic webhook admisson controller, initializing an ExternalWebhookConfigurationManager in the method.
2017-06-14 17:13:56 -07:00
Chao Xu 8dbeee50c7 generated 2017-06-14 10:20:33 -07:00
Chao Xu fb06bd823a make webhook ac use the configuration manager 2017-06-14 10:20:06 -07:00
Kubernetes Submit Queue 9f23149a52 Merge pull request #44965 from jpeeler/podpreset-exclusion-simple
Automatic merge from submit-queue

Allow pods to opt out of PodPreset mutation via an annotation on the pod

An annotation in the pod spec of the form:
podpreset.admission.kubernetes.io/PodPresetOptOut: "true"
Will cause the admission controller to skip manipulating the pod spec,
no matter the labelling.

This is an alternative implementation to pull #44163.

```release-note
Allow pods to opt out of PodPreset mutation via an annotation on the pod.
```
2017-06-08 22:57:34 -07:00
Kubernetes Submit Queue 4a01f44b73 Merge pull request #46988 from p0lyn0mial/rename_some_admission_pkg
Automatic merge from submit-queue (batch tested with PRs 46718, 46828, 46988)

Simply changed the names of packages of some admission plugins.

**What this PR does / why we need it**:
This PR simply changes the names of packages of some admission plugins so that they are not in conflict with admission pkg.

**Release note**:

```release-note
NONE
```
2017-06-06 11:43:20 -07:00
Kubernetes Submit Queue a552ee61a0 Merge pull request #46672 from smarterclayton/initializer_with_config
Automatic merge from submit-queue (batch tested with PRs 46967, 46992, 43338, 46717, 46672)

Select initializers from the dynamic configuration

Continues #36721

kubernetes/features#209
2017-06-05 20:27:50 -07:00
zhangxiaoyu-zidif 52b546eea1 Fix print type of podname 2017-06-06 11:11:58 +08:00
Kubernetes Submit Queue c8c4fff8be Merge pull request #46972 from liggitt/node-pod-delete-cache-miss
Automatic merge from submit-queue

Check live pod on cache miss before forbidding node deletion

Fixes #46971 flake
2017-06-05 17:43:04 -07:00
Clayton Coleman 772ab8e1b4
Load initializers from dynamic config
Handle failure cases on startup gracefully to avoid causing cascading
errors and poor initialization in other components. Initial errors from
config load cause the initializer to pause and hold requests. Return
typed errors to better communicate failures to clients.

Add code to handle two specific cases - admin wants to bypass
initialization defaulting, and mirror pods (which want to bypass
initialization because the kubelet owns their lifecycle).
2017-06-05 19:12:41 -04:00
p0lyn0mial d0e89577db Simply changed the names of packages of some admission plugins. 2017-06-05 22:23:42 +02:00
Jordan Liggitt 2106a2bbe5
Check live pod on cache miss before forbidding node deletion 2017-06-05 12:09:15 -04:00
Jeff Peeler 08a59530e1 Allow pods to opt out of PodPreset mutation
An annotation in the pod spec of the form:
podpreset.admission.kubernetes.io/exclude: "true"
Will cause the admission controller to skip manipulating the pod spec,
no matter the labelling.

The annotation for a podpreset acting on a pod has also been slightly
modified to contain a podpreset prefix:
podpreset.admission.kubernetes.io/podpreset-{name} = resource version

Fixes #44161
2017-06-05 11:56:30 -04:00
Kubernetes Submit Queue 09702160b0 Merge pull request #46264 from Q-Lee/annotate
Automatic merge from submit-queue (batch tested with PRs 46681, 46786, 46264, 46680, 46805)

Add annotation for image policy webhook fail open.

**What this PR does / why we need it**: there's no good way to audit log if binary verification fails open. Adding an annotation can solve that, and provide a useful tool to audit [non-malicious] containers.

**Release note**: add the annotation "alpha.image-policy.k8s.io/failed-open=true" to pods created when the image policy webhook fails open.

```release-note
Add the `alpha.image-policy.k8s.io/failed-open=true` annotation when the image policy webhook encounters an error and fails open.
```
2017-06-03 21:16:43 -07:00