Commit Graph

1118 Commits

Author SHA1 Message Date
Kubernetes Publisher 126b0eccc3 Merge pull request #54780 from CaoShuFeng/patch-twice
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>.

partial fix crd patch failing

partial fix https://github.com/kubernetes/kubernetes/issues/53379

**Release note**:
```
NONE
```

Kubernetes-commit: 255a1be780448c07f8e3397caef8faa11ddfc027
2017-12-07 04:31:20 +00:00
Kubernetes Publisher 9a82dd46b2 Merge pull request #55175 from sttts/sttts-lock-registry-cleanup
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>.

apiserver: protect registry cleanup against concurrent access

The mechanism uses global state during testing. Better protect it and fail early when a race is happening.

Related to https://github.com/kubernetes/kubernetes/issues/54095

Kubernetes-commit: 47d1973c18e278621b8843ab9d18f8eb348d224c
2017-12-07 04:31:20 +00:00
Kubernetes Publisher 2bdf465dd6 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.
```

Kubernetes-commit: d33077526af1e22c4d7124836a987ce108c1533b
2017-12-07 04:31:19 +00:00
Kubernetes Publisher 98daf58abc Merge pull request #55157 from sttts/sttts-etcd3-scheme
Automatic merge from submit-queue (batch tested with PRs 55061, 55157, 55231). 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: remove scheme arg from NewUnsecuredEtcd3TestClientServer

Not necessary anymore.

Kubernetes-commit: eb578813cba0e835c1079c5b1b570c16e8a3dd47
2017-12-07 04:31:18 +00:00
Kubernetes Publisher 0a8a7c7bce Merge pull request #54786 from shiywang/bump-protobuf
Automatic merge from submit-queue (batch tested with PRs 55093, 54966, 55047, 54971, 54786). 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>.

vendor update: github.com/golang/protobuf

When I'm working on PR: https://github.com/kubernetes/kubernetes/pull/54782, I met a problem here: https://github.com/golang/protobuf/issues/372, which I think we need to update our vendor of protobuf
and I ask Dr. Stefan for suggestion, here is our coversation

shiywang [5:09 PM]
hi, Dr. Stefan i'm sorry to bother, I have a simple question, I was working on a pr which need to use protobuf custom field, and I run into this problem here: https://github.com/golang/protobuf/issues/372  which I think is due to our codebase's protobuf vendor is too old `vendor/github.com/golang/protobuf`,  do you think I can update that vendor to lastest one ?  also I noticed there's also an extend package called `vendor/github.com/gogo/protobuf/proto` what's the releationship between those two ?  which one should I update ?

sttts
[5:11 PM]
hi

[5:11]
don't know much about the proto internals either, @claytonc is probably the only one

[5:12]
create a vendor/github.com/golang/protobuf bump PR and assign it to him

shiywang [5:12 PM]
sounds good, thank you sir

so
/assign @smarterclayton
for suggestion, thanks

```release-note
NONE
```

Kubernetes-commit: 5b7ce60fcebea445b7852d8dc2bce141a2bd7a3a
2017-12-07 04:31:18 +00:00
Dr. Stefan Schimanski 563bb7b931 Update generated code
Kubernetes-commit: 1e79dfb959896f2e51be87ecef491452bd17724c
2017-11-09 12:27:20 +01:00
Dr. Stefan Schimanski a32fcea8bb deepcopy: remove deepcopy register tags
Kubernetes-commit: 72809a08b94650bc8988db37be3a2ee4c6ccd113
2017-11-09 12:40:14 +01:00
Dr. Stefan Schimanski fa51e5900d apimachinery: Remove cloner from scheme
Kubernetes-commit: b5b62c68318be79a665257c260ea9f9bbb6d6318
2017-11-09 12:27:06 +01:00
Joe Betz f3058e0b10 Fix admission metrics to track mutating/validating correctly
Also update admission test mocks to better reflect typical usage and fix broken tests.

Kubernetes-commit: 2643c6ae3e7b7bc09e1d3eb695a438b190123083
2017-11-08 17:26:31 -08:00
Dr. Stefan Schimanski d10f10b8ac pkg/apis/core: mechanical import fixes in dependencies
Kubernetes-commit: 012b085ac870d359131f4251213bf2fff1d15aa0
2017-11-08 23:34:54 +01:00
hzxuzhonghu c37db061da remove redundant code in admission initializer
Kubernetes-commit: 9d1e6d3e2cc25db8e07db446d00390059c8264f8
2017-11-08 10:54:06 +08:00
mbohlool db766abbf7 Update generated files for MutatingWebhookConfiguration
Kubernetes-commit: 4568e0530c53df81d1bbd5e700daca041a1d8439
2017-11-07 17:29:01 -08:00
mbohlool 2aa55c4d47 Add MutatingWebhookConfiguration type
Kubernetes-commit: fc5a613c17c81fdda54158d58a19bd6089ae9882
2017-11-07 12:49:19 -08:00
mbohlool e57a4d504d Update generated files
Kubernetes-commit: cb43840492b383f4e1b87d7108d51c6439e1dad5
2017-11-07 12:42:06 -08:00
mbohlool 3846cb803e Rename ExternalAdmissionHookConfiguration to ValidatingWebhookConfiguration
Kubernetes-commit: 9ddea83a2ce0937cf0fc8f8c35614bb18e74cfad
2017-11-07 12:46:54 -08:00
Michael Taufen 8d690cc5cb ColonSeparatedMultimapStringString: allow multiple Set invocations with default override
The first call to Set will clear the map before adding entries;
subsequent calls will simply append to the map.
This makes it possible to override default values with a command-line
option rather than appending to defaults,
while still allowing the distribution of key-value pairs across
multiple flag invocations.

For example: `--flag "a:hello" --flag "b:again" --flag "b:beautiful"
--flag "c:world"` results in `{"a": ["hello"], "b": ["again",
"beautiful"], "c": ["world"]}`

Kubernetes-commit: 6e49ac382bbd43e5a3f648607f8005bdf0237317
2017-11-07 09:15:26 -08:00
Dr. Stefan Schimanski 204da0b2db apiserver: add validating admission tests
- in endpoint tests
- in generic registry
- in patch handler
- in admission chain

Kubernetes-commit: c558d2a3517fafdb704edd2c00b6df6738786959
2017-11-07 10:40:43 +01:00
Joe Betz a1e35e7bfe Add system namespaces to admission metrics. Add tests and leverage test code from PR#55086
Kubernetes-commit: 9d13d1baece20fc611176aad3b6f39ccf9fa4b36
2017-11-06 17:48:59 -08:00
cheftako 556a83dbf9 Admission request/response handling
AdmissionResponse allows mutating webhook to send apiserver a json patch
to mutate the object.
This reflects the imperative nature of AdmissionReview. It adds
AdmissionRequest and AdmissionResponse in place of status/spec.
The AdmissionResponse the allows the mutating webhook
to send back a json path with the mutated version of the requested
object.
Fixed the integration test to clean up properly.
Switched test image to 1.8v5 to reflect API changes.
Make sure to cache test framework client for cleaup test code.
Switched to pointer for patch type.
Factored in @liggitt's feedback.
Factored in @lavalamp's feedback.

Kubernetes-commit: dac3c2e168784bbcf1cbfef8bf5430101e191715
2017-11-06 15:41:26 -08:00
Kubernetes Publisher f260745b82 Merge pull request #54734 from janetkuo/webhook-error
Automatic merge from submit-queue (batch tested with PRs 53645, 54734, 54586, 55015, 54688). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Improve webhook error message

**What this PR does / why we need it**:
Currently, apiserver only prints message of review status returned by a rejecting webhook controller. If the message is empty, users will see this in event message: 
`create Pod <pod-name> failed error:<empty-string>`. Hook name should be included in the error message as well.

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

**Special notes for your reviewer**: @kubernetes/sig-api-machinery-bugs 

**Release note**:

```release-note
NONE
```

Kubernetes-commit: 3625a32d449b32ee5f9f32738ea06ddaf95cbccc
2017-11-06 15:33:37 -08:00
Kubernetes Publisher baff305a6c Merge pull request #55169 from sttts/sttts-cache-stop-race
Automatic merge from submit-queue (batch tested with PRs 55169, 54990). 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: fix Cacher.Stop() race

Kubernetes-commit: 7966af637ed34b40e73b9a3c361a614e9ce3fc86
2017-12-07 04:30:52 +00:00
Kubernetes Publisher d5c7d449a9 Merge pull request #55115 from CaoShuFeng/crd_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>.

[trival]remove duplicated code from unit test

**Release note**:
```
NONE
```

Kubernetes-commit: 462d5ed1067d14f68c4bdaeb9469c37eab0172ea
2017-12-07 04:30:51 +00:00
Kubernetes Publisher 656d3dafc2 Merge pull request #55052 from hzxuzhonghu/admission-handler
Automatic merge from submit-queue (batch tested with PRs 51401, 54056, 54977, 55017, 55052). 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 admission handler and add UT

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

remove Redundant code, and add UT case.

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

```

Kubernetes-commit: 85a6ec7b610454d046589ed0610209b832188e42
2017-12-07 04:30:50 +00:00
Kubernetes Publisher 37dd570a2f Merge pull request #54643 from mtaufen/structure-manifest-url-header
Automatic merge from submit-queue (batch tested with PRs 52367, 53363, 54989, 54872, 54643). 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>.

Lift embedded structure out of ManifestURLHeader field

Related: #53833

```release-note
It is now possible to set multiple manifest url headers via the Kubelet's --manifest-url-header flag. Multiple headers for the same key will be added in the order provided. The ManifestURLHeader field in KubeletConfiguration object (kubeletconfig/v1alpha1) is now a map[string][]string, which facilitates writing JSON and YAML files.
```

Kubernetes-commit: 3a15fdbe7e1ceefa59d7cc41ac6d65998cef1b1a
2017-12-07 04:30:50 +00:00
Kubernetes Publisher 703a17eb2a Merge pull request #54957 from apelisse/update-kube-openapi
Automatic merge from submit-queue (batch tested with PRs 55004, 54957). 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 kube-openapi to use validation

**What this PR does / why we need it**: Moves openapi validation code to kube-openapi, so that we can move the rest of the code to apimachinery repository, so that later we can use it from both the client and the 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 #Nothing

**Special notes for your reviewer**:

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

Kubernetes-commit: 55e216f56eac0082acc6be655d9ae09cf9ba38a8
2017-12-07 04:30:49 +00:00
Kubernetes Publisher c9df2bdd6c 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 .

Kubernetes-commit: 40212c17cdf4d7bc2a45c495cf0d37ebab032578
2017-12-07 04:30:17 +00:00
Kubernetes Publisher 375f5ba17b Merge pull request #53558 from nikhita/cr-strategic-merge-patch
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>.

Fix error for strategic merge patch of custom resources

Fixes #50037.

We need the go struct tags `patchMergeKey` and `patchStrategy` for fields that support a strategic merge patch. For native resources, we can easily figure out these tags since we know the fields.

Because custom resources are decoded as Unstructured and because we're missing the metadata about how to handle each field in a strategic merge patch, we can't find the go struct tags. Hence, we can't easily  do a strategic merge for custom resources.

So we should fail fast and return an error.

**Release note**:

```release-note
NONE
```

/cc @sttts @deads2k @ncdc

Kubernetes-commit: 7aed66305127904a874289a1c78f5b5d5ad6b80c
2017-12-07 04:30:16 +00:00
Kubernetes Publisher 4590a3380f Merge pull request #53048 from kubermatic/log-healthz-check-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>.

Log error when a healthz check fails

**What this PR does / why we need it**:
Currently we only tell a user that a healthz check failed but we don't display the explicit error of the failed check. This is fine, but we should log the error to make debugging easier.

```release-note
Log error of failed healthz check
```

Kubernetes-commit: 816f2f460531cc1b2ed999962b64f930a7fc39fd
2017-12-07 04:30:15 +00:00
Kubernetes Publisher dfe8e14639 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.

Kubernetes-commit: 7a944a69d64841472347056c7b54c5b264bed17b
2017-12-07 04:30:15 +00:00
Kubernetes Publisher 73d9488042 Merge pull request #53991 from sttts/sttts-no-api-scheme
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>.

Cosmetical cleanup after pkg/api/legacyscheme move

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

- Fix and update comment with api.Scheme
- Remove all api.Scheme references by using explicit package aliases

Kubernetes-commit: 2a4c9be41978a6e54f0d8ed30c94b320ed40958e
2017-12-07 04:30:14 +00:00
Kubernetes Publisher c68ef826a7 Merge pull request #54704 from dims/try-clean-up-stores
Automatic merge from submit-queue (batch tested with PRs 53796, 54666, 54516, 54625, 54704). 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 TestCRD Flake

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

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

**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: d7567cd6c7599dd6701890a4cb5575fe959c948d
2017-12-07 04:30:13 +00:00
Kubernetes Publisher dc5f59979b Merge pull request #54683 from liggitt/subresource-gvk
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 subresource discovery and versioning

Fixes https://github.com/kubernetes/kubernetes/issues/54684
Related to https://github.com/kubernetes/kubernetes/pull/54586

Allows distinct subresource group/version/kind to be used for each version (gives us a path to move to autoscaling/v1 for apps, or policy/v1 for eviction, etc)

Added tests to ensure scale subresources have expected discovery info, and that the object returned matches discovery, and that the endpoint accepts the advertised version

```release-note
Fixes discovery information for scale subresources in the apps API group
```

Kubernetes-commit: 0c1f25fc1ba118ade226dad74052e4e45a16bcb6
2017-12-07 04:30:13 +00:00
Joe Betz f2028cc5a5 Add admission metrics
Kubernetes-commit: 3940e4f0533a7ee8e50ec939cdcb44c33d4a0ae9
2017-11-06 14:14:33 -08:00
Rohit Agarwal 3135d2c6df Update cAdvisor.
Also update golang.org/x/sys because of google/cadvisor#1786

Kubernetes-commit: fe5ef1b4949de93cf4efec7e8643057d367c2946
2017-11-06 13:54:48 -08:00
Dr. Stefan Schimanski 5a09150509 apiserver: protect registry cleanup against concurrent access
Kubernetes-commit: a246d6f1d13d1215e6556c5c419a7cb0e7afccab
2017-11-06 18:31:40 +01:00
Dr. Stefan Schimanski 0d9d3201c2 apiserver: fix Cacher.Stop() race
Kubernetes-commit: a30c0f477d9d4813a08e0abdc7b9029bd4a29287
2017-11-06 15:37:07 +01:00
Di Xu ed8f1885d6 change DefaultGarbageCollectionPolicy to DeleteDependents for workload controllers
Kubernetes-commit: 344fe56ed30c0b83ab0a01e3b1344ecea3925863
2017-11-06 17:12:57 +08:00
Chao Xu f88f0f12a1 Reorganize the admission webhook code.
Moved client and kubeconfig related code to webhook/config;
Moved the rule matcher to webhook/rules;
Left TODOs saying we are going to move some other common utilities;
Other code is moved to webhook/validation.

Kubernetes-commit: 1adfacc7eb41da109e970a9c2985fd55b4cbbdfd
2017-11-05 18:11:47 -08:00
foxyriver dbacfae1f8 stop timer
Kubernetes-commit: cdc4aca9a3d53e21cca4b784718732a9a0852084
2017-11-06 09:51:39 +08:00
Cao Shufeng 35655c329b [trival]remove duplicated code from unit test
Kubernetes-commit: acb90b6547e0d8304a0f75bf21b9769c5186cf5d
2017-11-05 15:02:41 +08:00
Shiyang Wang bbac18937d update staging files
Kubernetes-commit: 1b3059d1acf3e2d882e7e34439b0b1dc8f9da5d5
2017-11-04 15:04:14 +08:00
Chao Xu 9dda7d3efb let validation webhook convert objects to the external version before sending them
Kubernetes-commit: ab053a224d27aa48ea4b34ba7591cfd72c3f567d
2017-11-03 16:49:56 -07:00
hzxuzhonghu 164593bb0a refactor admission handler and add UT
Kubernetes-commit: ac7ca5bd0a3e5448a3d3ce89aeffa028f026b5ca
2017-11-03 16:40:15 +08:00
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