Commit Graph

1125 Commits

Author SHA1 Message Date
Cao Shufeng 837b7e4418 partial fix crd patch failing
partial fixes https://github.com/kubernetes/kubernetes/issues/53379

Kubernetes-commit: 1e800350a2e05899f7435385bebe7fc101142d95
2017-11-03 16:06:14 +08:00
hzxuzhonghu 69a65358c5 update bazel
Kubernetes-commit: b845e26983741c5d12e621604b5e064e03d4fed1
2017-11-03 10:06:07 +08:00
hzxuzhonghu 755a845d5a update bazel and staging godep
Kubernetes-commit: 3c44e2a6167c349fb17c9741959ca24998ae3738
2017-11-02 19:36:01 +08:00
hzxuzhonghu 065ff42f34 gracefully shutdown apiserver after all non-long running requests finish
Kubernetes-commit: db4f0de28075f34bb4bfa8d821ad25cd3a7eba1f
2017-11-02 19:29:31 +08:00
Antoine Pelisse 6d6e2822d9 Update kube-openapi to use validation
Kubernetes-commit: 8f7262e819c58a6ee3f9315af37884b1fe0bfb44
2017-11-01 11:20:15 -07:00
Daniel Smith 51c2612984 Add URL beside service
Kubernetes-commit: a0cb2ce697c195d22daeef4fbe6545bdaba11e2f
2017-10-31 16:28:06 -07:00
hzxuzhonghu 45d6a78b3f cache admission webhook restClient
Kubernetes-commit: 42d9153a03e971453ccf8e46e149a20a9ff3d656
2017-10-31 19:08:29 +08:00
Kubernetes Publisher f9f51e2b63 Merge pull request #54795 from sttts/sttts-audit-shutdown-sync-revert
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>.

Revert: Shutdown http handlers before shutting down audit backend

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

Kubernetes-commit: 3096a32568a231743ef008a85f2e670e28d915ae
2017-10-30 09:47:35 -07:00
Kubernetes Publisher 6841e913a1 Merge pull request #54477 from nikhita/invalid-patch-code
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>.

apiserver: return 4xx for invalid patch

Fixes #54423

Currently, an invalid patch returns 500. The apiserver should return a 400 (`BadRequest`) or 422 (`Unprocessable Entity`).

**Release note**:

```release-note
NONE
```

Kubernetes-commit: 6659f2a7d894a404d59265a708a2d2bd03806e98
2017-12-07 04:30:11 +00:00
Dr. Stefan Schimanski eecedb2781 Revert "audit backend run shutdown gracefully after http handler finish"
This reverts commit f42686081bff88e44b339562c4927775f4439671.

Kubernetes-commit: f6a89df3fb719f4db565c7dade63575ccbdb3031
2017-10-30 15:26:51 +01:00
Dr. Stefan Schimanski 777cf3c0ef admission: unify plugin constructors
Kubernetes-commit: 131905cdb8b929f7c15f810e02ec9a45b306b769
2017-10-30 14:20:40 +01:00
Dr. Stefan Schimanski 8ae36bdf36 apiserver: remove scheme arg from NewUnsecuredEtcd3TestClientServer
Kubernetes-commit: 11d9dd8ceca2d8f6d00b36ebc4982a142f547d5d
2017-10-30 13:18:49 +01:00
Kubernetes Publisher b5a75d8847 Merge pull request #54769 from hzxuzhonghu/import-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 import path error

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

fix import warning.
"k8s.io/apiserver/pkg/admission/plugin/webhook" import packages that expects import "k8s.io/kubernetes/plugin/pkg/admission/webhook"

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

Kubernetes-commit: e5c732ee93853222dc2c2fedaa986054ae165b5b
2017-10-30 01:09:06 -07:00
Kubernetes Publisher 199394ed2d Merge pull request #53695 from hzxuzhonghu/audit-graceful-shutdown
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>.

Shutdown http handlers before shutting down audit backend

**What this PR does / why we need it**:
Currently, audit backend is shut down before http handlers stop processing requests, so some audit events can be dropped in case of batching webhook.

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

**Special notes for your reviewer**:

**Release note**:

```release-note
Shutdown http handlers in kube-apiserver before shutting down audit backend.
```

Kubernetes-commit: 7a6a58f4444c60a9b3fefe335a303f0c230d8f10
2017-12-07 04:30:10 +00:00
hzxuzhonghu 749c4d2360 fix import warning
Kubernetes-commit: fcf4a0e191449925148783517cfe7ade234a2510
2017-10-30 10:16:13 +08:00
Kubernetes Publisher 52d7687cc0 Merge pull request #54165 from caesarxuchao/webhook-e2e-test
Automatic merge from submit-queue (batch tested with PRs 54165, 53909). 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 an e2e test for admission webhook

Part of https://github.com/kubernetes/features/issues/492

The purpose of this test is making sure the webhooks get called, and the apiserver can communicate with the webhook.

We will expand the test cover more webhook features in followups.

The webhook used in the test rejects pods with container names "webhook-disallow". Will upload the source code of the example in a follow up PR.

Kubernetes-commit: 444d0c11153647d45b899b25a5dbbd3a5ea4a123
2017-10-27 17:39:21 -07:00
Kubernetes Publisher 60121e9302 Merge pull request #54655 from caesarxuchao/remove-nesting
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>.

Remove the nesting directory webhook/webhook

A mechanical change to remove the accidental nesting webhook/webhok directory.

@deads2k lgtm'ed the change and approved for self tagging over a slack chat.

Kubernetes-commit: 70b01d75d1289f27f3e952d1e784f39a2000a1de
2017-10-27 15:42:22 -07:00
Kubernetes Publisher bc81e99099 Merge pull request #50776 from kevin-wangzefeng/core-to-corev1-round2
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Use the core client with explicit version globally

**What this PR does / why we need it**:
As mentioned in #49535 and #50605, we want to have a global replace to use core client with explicit version.

**Which issue this PR fixes**: fixes #49535

**Special notes for your reviewer**:
The actual type of clientSet.Core() is already the same with clientSet.CoreV1(), so it should be safe replacement.
The places that clientSet.Core() are still in use are identified by IDE "find usages", and changes are made with one time global replace. Hopefully there will be none left after this PR merged.
Let me know if this PR is too big to review, I can split it into some smaller ones.

/cc @kubernetes/sig-api-machinery-pr-reviews
/cc @k82cn @sttts

**Release note**:

```release-note
none
```

Kubernetes-commit: d8ec716f4d7cabc8fa1fc825b20feffe105e99a9
2017-12-07 04:30:08 +00:00
Janet Kuo 201480baa2 Add hook information when rejecting a request
Kubernetes-commit: 948bd7bbc18b343161120b365c089528f8fc0550
2017-10-27 14:59:54 -07:00
Chao Xu 512274139c add NamespaceSelector to the api
business logic in webhook plugin and unit test

add a e2e test for namespace selector

Kubernetes-commit: 7006d224bebb5a1aee9c70387a8584e0a0e8b10f
2017-10-27 14:42:09 -07:00
Davanum Srinivas b690ae9379 Fix TestCRD Flake
The DestroyFunc functions returned by generic.NewRawStorage is never
called when we do a StartTestServer() in the test suite. For a quick
hack for now, added TrackStorageCleanup/RegisterStorageCleanup and
CleanupStorage. Note that unless TrackStorageCleanup is called (which
is called only from the test suite) the other two methods are
no-ops essentially. So no change in behavior at runtime. This vastly
brings down the number of goroutines that are left behind when this
test is executed and should reduce if not eliminate the flakiness
of TestCRD

Kubernetes-commit: 00bcbd1311af711f70c771d790137b93ce48309a
2017-10-27 10:59:52 -04:00
Kubernetes Publisher 7001bc4df8 Merge pull request #54513 from deads2k/admission-09-move
Automatic merge from submit-queue (batch tested with PRs 49865, 53731, 54013, 54513, 51502). 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 webhook admission to generic apiserver

This builds on https://github.com/kubernetes/kubernetes/pull/54414.

It moves the admission webhook into the generic apiserver.  It also allows the injection of a server managed way to override the rest.Config used for a particular service.  This makes for an easier point to allow auto-configuration of the kube-apiserver to loopback to itself as a special case for kubernetes.default.svc.

@kubernetes/sig-api-machinery-pr-reviews

```release-note
the generic admission webhook is now available in the generic apiserver
```

Kubernetes-commit: 9ec88d0d45a7273bfbac70ad51279112eeeda00a
2017-10-27 08:53:22 +00:00
Jordan Liggitt 198ca9b2e0 Use GVK from storage in API registration
Kubernetes-commit: 5913fccada6097c984b168ab15c243a8b20876e5
2017-10-27 04:29:04 -04:00
Jordan Liggitt 8ea8479b92 Specify correct subresource discovery info
Kubernetes-commit: 729a0da155871de445ea2116cf6457e29e313d08
2017-10-27 04:22:39 -04:00
Cao Shufeng d3301ca8d8 [advanced audit]add a policy wide omitStage
Kubernetes-commit: d75c0f0e21af8229ed3147e9a798441221c03574
2017-10-27 10:01:01 +08:00
Chao Xu 3843f2885c remove the nesting directory webhook/webhook
Kubernetes-commit: ca8131877ad4fcab76388360e04ff9eb05af41a4
2017-10-26 14:19:49 -07:00
Kubernetes Publisher 3b8c9fae4a Merge pull request #54600 from marun/enable-federation-vendoring
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>.

Update to latest kube-openapi and kazel

- update vendored kube-openapi to include https://github.com/kubernetes/kube-openapi/pull/14
 - update hash of repo infra used for bazel generation so kazel includes https://github.com/kubernetes/repo-infra/pull/48

This is the final step in enabling federation to generate openapi code for itself and vendored kube (#54335).

/sig multicluster testing

Kubernetes-commit: 3f5f9c3df96618f6fc447fc98d9fc7ba97b0e333
2017-10-26 12:22:35 +00:00
Kubernetes Publisher 01867f68f4 Merge pull request #52717 from FengyunPan/remove-LbassV1
Automatic merge from submit-queue (batch tested with PRs 52717, 54568, 54452, 53997, 54237). 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>.

[OpenStack]Remove the LbaasV1 of OpenStack cloud provider

The Neutron LbaasV1 has been declared obsolete, LbaasV2 is a
better choice.
So let's remove the codes of LbaasV1, only support LbaasV2.
xref: #52609
Reference OpenStack doc:
https://docs.openstack.org/mitaka/networking-guide/config-lbaas.html

**Special notes for your reviewer**:
/assign @dims
/assign @anguslees

**Release note**:
```release-note
Remove the LbaasV1 of OpenStack cloud provider, currently only support LbaasV2.
```

Kubernetes-commit: b2b31ada149fb688aea0d62cd58e5416d5fd337b
2017-10-26 12:22:00 +00:00
Kubernetes Publisher 7926573bc1 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
```

Kubernetes-commit: 17638ee0183ea69d02cd76e078e95c0ad033a0a6
2017-10-26 12:21:25 +00:00
Kubernetes Publisher a51bf85fc8 Merge pull request #54399 from nikhita/staging-add-readme-license
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 README and LICENSE to staging repos

Addresses https://github.com/kubernetes/kubernetes/issues/54398.

We should use the staging files instead of having some files
authoritative in the external repo. Otherwise, we complicate the
publishing process as it has to know which files come from the latter.

`README.md` and `LICENSE` are authoritative in external repos.
We should move them to staging.

**Release note**:

```release-note
NONE
```

Kubernetes-commit: 7b588817caa6ae9b763fca798f88ed4a0c21d6aa
2017-10-26 12:21:24 +00:00
Kubernetes Publisher ab0820408a Merge pull request #54287 from hzxuzhonghu/audit-stage-1
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>.

audit backend run before http server start and register presShutdown …

…hook

**What this PR does / why we need it**:
1. audit backend run before http server start , prevent coming request audit blocking

2.  audit backend use preShutdownHook.

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```

Kubernetes-commit: 192bb6262b5a73438d958408f91d198384c3f497
2017-10-26 12:21:24 +00:00
Kubernetes Publisher 920a596ded Merge pull request #54400 from kubernetes/revert-53128-godeps_fix_grpc_data_race
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>.

Revert "update gRPC to pick up data race fix"

Reverts kubernetes/kubernetes#53128

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

cc @kubernetes/sig-api-machinery-bugs @wojtek-t @dixudx

Kubernetes-commit: bc69c92de15c2457b3566bbede5b363328e0d640
2017-10-26 12:21:23 +00:00
Kubernetes Publisher b65e9288bd Merge pull request #54181 from apelisse/update-kube-openapi
Automatic merge from submit-queue (batch tested with PRs 54199, 54181, 54196). 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 openapi to use kube-openapi code

**What this PR does / why we need it**: OpenAPI code has moved to `github.com/kubernetes/kube-openapi`. Let's use that code as a dependency, since now it's duplicated.

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

**Special notes for your reviewer**:

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

No user visible changes. Just code moving around.

Kubernetes-commit: 507790c9c6f50b580b4409b5ac93b10a24570819
2017-10-26 12:20:47 +00:00
Kubernetes Publisher c4aba925c2 Merge pull request #53442 from deads2k/server-02-nesteddecoding
Automatic merge from submit-queue (batch tested with PRs 53916, 53442). 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 nested encoder and decoder to admission config

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

Adds the required nested object encoder/decoder pairs for admission config extensions.

@sttts

Kubernetes-commit: 0736c55776ad272731ff9c27aae2a2bbd010f3ee
2017-10-26 12:20:11 +00:00
Kubernetes Publisher 38ff7e4b02 Merge pull request #53128 from dixudx/godeps_fix_grpc_data_race
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 gRPC to pick up data race fix

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

**Special notes for your reviewer**:

**Release note**:

```release-note
update gRPC to v1.6.0 to pick up data race fix grpc/grpc-go#1316
```

Kubernetes-commit: 70960a5ed785c64df837139a783f89901d7891f1
2017-10-26 12:20:10 +00:00
Kubernetes Publisher fbfe66b173 Merge pull request #54156 from deads2k/admission-06-restclient
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 admission webhook to accept client config

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

This plumbs a complete client through the plugin initializer for admission webhooks.  It achieves parity with our existing webhooks and provides flexibility if people want to do something special or different.  Easy things are easy, hard things are possible.  This does not change behavior for kube-apiserver.

@kubernetes/sig-auth-api-reviews @kubernetes/sig-api-machinery-bugs

Kubernetes-commit: f07b359e5bd5af8947b32309865dada7043d59e3
2017-10-26 12:19:23 +00:00
Kubernetes Publisher 7bb71de6e3 Merge pull request #53821 from rrati/apiserver-clean-shutdown
Automatic merge from submit-queue (batch tested with PRs 54145, 53821). 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>.

Added PreStopHooks to apiserver to allow clean shutdown.

BootStrapController now registers a PreStopHook to clean up the kubernetes service endpoints.  The PreStopHooks allow the apiserver to shutdown cleanly under a controlled shutdown case.  The BootStrapController's PreStopHook will clean up after itself by removing the apiserver from the list of IPs in the kubernetes service.

fixes #53438

Kubernetes-commit: 78ada62c3086f3d2e743b6e7cc696e390a619585
2017-10-26 12:19:22 +00:00
Maru Newby bbd267be4d Update vendored kube-openapi to latest
Kubernetes-commit: fae7a7a1e3041a88be38ab614368bc2f08925114
2017-10-25 18:09:39 -07:00
Kevin 41430fda7c use core client with explicit version globally
Kubernetes-commit: 4c8539cece2f0a6e6974b30d00c7341e10320bc5
2017-10-25 23:54:32 +08:00
Dr. Stefan Schimanski 2e26d56a03 Update bazel
Kubernetes-commit: 35bb6823ea94c98622397f7cb270c6a67070e70d
2017-10-24 15:52:41 +02:00
Dr. Stefan Schimanski 45afa13373 admission: rename Validate{ -> Initialization}, Validat{ingAdmit -> e}
Kubernetes-commit: aedcf681b32618be3cf9ad40eeb039f1bb26c5ae
2017-10-27 17:09:39 +02:00
Dr. Stefan Schimanski 3eeded3a29 admission: wire create+update validation func into kube registries
Kubernetes-commit: 2452afffe09e1ced9487e5a701beb1443a92b741
2017-10-24 15:33:28 +02:00
David Eads 3cb246ace6 move webhook admission to generic apiserver
Kubernetes-commit: 8c1fe1f61a1de754a2cfed1966f4a1f8024ca618
2017-10-24 08:48:05 -04:00
Dr. Stefan Schimanski 441ac63056 admission: complete plumbing of validation admission
Kubernetes-commit: 74b4223ab80fa3bbf326ac1073ef28f0b8daa304
2017-10-24 14:08:34 +02:00
Nikhita Raghunath 6f448f398c apiserver: return 4xx for invalid patch
Add interpretPatchError to return appropriate http code
(400 or 422) according to the error type.

We add this function in apiserver because we don't want
to mention the http code in apimachinery. The apimachinery
code is also used in kubectl. The client should not return
a server error.

Add a test to validate the http error code and error message.

Kubernetes-commit: e0a2168ecbf8b4e43f932a32fa55cd55215123cc
2017-10-24 17:26:03 +05:30
Dr. Stefan Schimanski 118e16448c admission: split MutationInterface out of Interface
Kubernetes-commit: d4f48c931383f35e5e1a227a4291b8c0503e2433
2017-10-24 11:24:04 +02:00
David Eads 4c7d4a45ad update admission webhook to handle multiple auth domains
Kubernetes-commit: fd4ab3e061ff44515d5107e1ae3e9d6469d956aa
2017-10-23 09:35:08 -04:00
Dr. Stefan Schimanski a8fb04360a admission: { -> Mutating}Admit(admission.Attributes)
Kubernetes-commit: 970d2553cca466c1236f1e91b3161cb1a69dbdd2
2017-10-23 14:26:38 +02:00
Shyam JVS 27d82c910d Revert "update gRPC to pick up data race fix"
Kubernetes-commit: d515f0e3d2a2b3afc53fc839d6df6f34ed76c3bf
2017-10-23 13:23:48 +02:00
Nikhita Raghunath 90dbe47a1a Add README and LICENSE to staging repos
We should use the staging files instead of having some files
authoritative in the external repo. Otherwise, we complicate the
publishing process as it has to know which files come from the latter.

README.md and LICENSE are authoritative in external repos.
We should move them to staging.

Kubernetes-commit: 0e466262743f9fd115573b91bc71e9690f0eccf7
2017-10-23 16:39:02 +05:30