Commit Graph

3776 Commits (fce3ad5198a1948a3667384b07a6e88771e77c8e)

Author SHA1 Message Date
Kubernetes Submit Queue a0f9412361
Merge pull request #62810 from liggitt/request-mapper
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 request context mapper

http.Request now allows setting/retrieving a per-request context, which removes the need for plumbing a request-context mapper throughout the stack

In addition to being way simpler, this has the benefit of removing a potentially contentious lock object from the handling path

This PR:
* removes RequestContextMapper
* converts context fetchers to use `req.Context()`
* converts context setters to use `req = req.WithContext(...)`
* updates filter plumbing in two places (audit and timeout) to properly return the request with modified context
* updates tests that used a fake context mapper to set the context in the request instead

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

```release-note
NONE
```
2018-04-23 13:01:14 -07:00
Kubernetes Submit Queue 939c0783e1
Merge pull request #62152 from smarterclayton/use_client_store
Automatic merge from submit-queue (batch tested with PRs 63001, 62152, 61950). 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>.

When bootstrapping a client cert, store it with other client certs

The kubelet uses two different locations to store certificates on
initial bootstrap and then on subsequent rotation:

* bootstrap: certDir/kubelet-client.(crt|key)
* rotation:  certDir/kubelet-client-(DATE|current).pem

Bootstrap also creates an initial node.kubeconfig that points to the
certs. Unfortunately, with short rotation the node.kubeconfig then
becomes out of date because it points to the initial cert/key, not the
rotated cert key.

Alter the bootstrap code to store client certs exactly as if they would
be rotated (using the same cert Store code), and reference the PEM file
containing cert/key from node.kubeconfig, which is supported by kubectl
and other Go tooling. This ensures that the node.kubeconfig continues to
be valid past the first expiration.

Example:

```
bootstrap:
  writes to certDir/kubelet-client-DATE.pem and symlinks to certDir/kubelet-client-current.pem
  writes node.kubeconfig pointing to certDir/kubelet-client-current.pem
rotation:
  writes to certDir/kubelet-client-DATE.pem and symlinks to certDir/kubelet-client-current.pem
```

This will also allow us to remove the wierd "init store with bootstrap cert" stuff, although I'd prefer to do that in a follow up.

@mikedanese @liggitt as per discussion on Slack today

```release-note
The `--bootstrap-kubeconfig` argument to Kubelet previously created the first bootstrap client credentials in the certificates directory as `kubelet-client.key` and `kubelet-client.crt`.  Subsequent certificates created by cert rotation were created in a combined PEM file that was atomically rotated as `kubelet-client-DATE.pem` in that directory, which meant clients relying on the `node.kubeconfig` generated by bootstrapping would never use a rotated cert.  The initial bootstrap certificate is now generated into the cert directory as a PEM file and symlinked to `kubelet-client-current.pem` so that the generated kubeconfig remains valid after rotation.
```
2018-04-23 12:34:14 -07:00
Clayton Coleman 368959346a
When bootstrapping a client cert, store it with other client certs
The kubelet uses two different locations to store certificates on
initial bootstrap and then on subsequent rotation:

* bootstrap: certDir/kubelet-client.(crt|key)
* rotation:  certDir/kubelet-client-(DATE|current).pem

Bootstrap also creates an initial node.kubeconfig that points to the
certs. Unfortunately, with short rotation the node.kubeconfig then
becomes out of date because it points to the initial cert/key, not the
rotated cert key.

Alter the bootstrap code to store client certs exactly as if they would
be rotated (using the same cert Store code), and reference the PEM file
containing cert/key from node.kubeconfig, which is supported by kubectl
and other Go tooling. This ensures that the node.kubeconfig continues to
be valid past the first expiration.
2018-04-23 10:23:01 -04:00
Kubernetes Submit Queue 9c25da64f0
Merge pull request #62649 from liggitt/loopback-routing
Automatic merge from submit-queue (batch tested with PRs 50899, 62649). 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 webhook service routing resolves kubernetes.default.svc correctly

Going through the normal endpoint resolve path isn't correct in multi-master scenarios

The auth wrapper is pulling from LoopbackClientConfig, the service resolver should do the same

```release-note
Fixes the kubernetes.default.svc loopback service resolution to use a loopback configuration.
```
2018-04-20 15:34:12 -07:00
Kubernetes Submit Queue 6da4355ad5
Merge pull request #62733 from soltysh/discovery_timeout
Automatic merge from submit-queue (batch tested with PRs 62876, 62733, 62827). 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>.

Set a default request timeout for discovery client

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1546117

Adds a default request timeout to requests made by the discovery client.
This prevents a command from hanging indefinitely due to one or multiple calls
to the apiserver taking longer than usual when when a --request-timeout flag value
has not been set.

/assign @deads2k @juanvallejo 

**Release note**:
```release-note
NONE
```
2018-04-20 13:39:11 -07:00
Jordan Liggitt 54c883f27b
Honor existing CA bundle and TLS server name in webhook client 2018-04-20 12:26:39 -04:00
Jordan Liggitt 6f65742474
ensure tls server name is used in transport 2018-04-20 12:26:38 -04:00
Jordan Liggitt d45fbce379
distinguish custom dialers in transport cache 2018-04-20 12:26:38 -04:00
Jordan Liggitt fe23fa3eee
Ensure service routing resolves kubernetes.default.svc correctly 2018-04-20 12:26:38 -04:00
Kubernetes Submit Queue bfae47ad87
Merge pull request #60709 from deads2k/client-02-fake-copy
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>.

deep copy fake client actions to avoid accidental mutation

I just got bit by this downstream.  Without a deep copy it is possible accidentally mutate the thing you created, thus invalidating your testing.  It's particularly nasty inside of a controller doing a loop on objects, making refs to them, and creating.  This works running in an actual process since we serialize and write, but fails unit tests since there is no serialization step.

@kubernetes/sig-api-machinery-bugs 

```release-note
NONE
```
2018-04-20 08:28:41 -07:00
Maciej Szulik 7bd48a7e23
Set a default request timeout for discovery client 2018-04-20 16:22:53 +02:00
Kubernetes Submit Queue 5dde701b87
Merge pull request #62412 from bhcleek/go1.10
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>.

generated code should pass go vet for go1.10

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

Update code generator and the code it generates to pass `go vet`.

go1.10 runs `go vet` whenever `go test` is run. Because of this, generated code for CRDs needs to pass `go vet`.

**Release note**:

```release-note
Code generated for CRDs now passes `go vet`.
```
2018-04-20 06:22:31 -07:00
Kubernetes Submit Queue a95d9f0e65
Merge pull request #62523 from wackxu/ldoc
Automatic merge from submit-queue (batch tested with PRs 59592, 62308, 62523, 62635, 62243). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

 update comments for local volume

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

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

**Special notes for your reviewer**:
/assign @jsafrane @msau42 

**Release note**:

```release-note
NONE
```
2018-04-19 14:50:21 -07:00
Kubernetes Submit Queue dffe94a0c1
Merge pull request #59592 from soltysh/roundtrip_tests
Automatic merge from submit-queue (batch tested with PRs 59592, 62308, 62523, 62635, 62243). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Roundtrip test helper for external types

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

**Special notes for your reviewer**:
/assign @deads2k @sttts 
Since you've asked for it in the original issue. The FIXME I've pointed out to is worth addressing, but I'd prefer to do it afterwards. Do we want to implement appropriate test for all the api groups from `k8s.io/api` ?

**Release note**:
```release-note
NONE
```
2018-04-19 14:50:13 -07:00
Van Tu e1cd5eeabc Update github.com/stretchr/testify to v1.2.1
cd $GOPATH/src/k8s.io/kubernetes
hack/godep-restore.sh
rm -rf Godeps
rm -rf vendor
hack/godep-save.sh
hack/update-staging-godeps.sh
2018-04-19 10:00:31 -04:00
Kubernetes Submit Queue efadf7b9e7
Merge pull request #61877 from mikedanese/depeid
Automatic merge from submit-queue (batch tested with PRs 62481, 62643, 61877, 62515). 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 deprecated ExternalID

This field has been deprecated since 1.1. After we remove it we can remove "self delete" from the node's permission set.

@kubernetes/api-reviewers 
@kubernetes/sig-auth-pr-reviews 

fixes https://github.com/kubernetes/kubernetes/issues/61966
part of https://github.com/kubernetes/community/pull/911

```release-note
Kubelets will no longer set `externalID` in their node spec.
```
2018-04-18 17:53:16 -07:00
Billie Cleek 95ad9009c3 regenerate fakes 2018-04-18 16:09:36 -07:00
Billie Cleek 44a9cc55b8 generate code that passes go vet
* Make sure sync.RWMutex values aren't copied.
2018-04-18 15:53:53 -07:00
Jordan Liggitt 8ea88a5092
Remove request context mapper 2018-04-18 17:03:31 -04:00
Antoine Pelisse 8341c48b1b apiserver: move patch tests to their own file 2018-04-18 10:56:45 -07:00
Mike Danese dbe49fc378 autogenerated 2018-04-18 10:20:23 -07:00
Mike Danese a242aeefed rename ExternaID to something that is obviously deprecated 2018-04-18 10:05:18 -07:00
Kubernetes Submit Queue 4bccf6a7aa
Merge pull request #60201 from sttts/sttts-unstructured-convert-to-version
Automatic merge from submit-queue (batch tested with PRs 60201, 62744). 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>.

apimachinery: normal conversion code path for Unstructured in ConvertToVersion

Preparation for https://github.com/kubernetes/kubernetes/pull/60113
2018-04-18 07:58:15 -07:00
Kubernetes Submit Queue fdbc9ef9a6
Merge pull request #62783 from sttts/sttts-apiserver-CONTRIBUTING.md
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 k8s.io/apiserver/CONTRIBUTING.md

Fixes https://github.com/kubernetes/apiserver/issues/37
2018-04-18 06:18:30 -07:00
Dr. Stefan Schimanski caf007b5bf Add k8s.io/apiserver/CONTRIBUTING.md 2018-04-18 14:09:10 +02:00
Kubernetes Submit Queue 96746166d9
Merge pull request #62734 from liggitt/log-malformed-webhook
Automatic merge from submit-queue (batch tested with PRs 62378, 62734). 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 webhook request error

Fixed https://github.com/kubernetes/kubernetes/issues/26606

```release-note
NONE
```
2018-04-18 04:24:13 -07:00
Kubernetes Submit Queue 42f6687a1c
Merge pull request #60536 from immutableT/transformer_metrics
Automatic merge from submit-queue (batch tested with PRs 62748, 60536, 62300, 62661, 62731). 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>.

Instrument transformer.go with latency metrics.

**What this PR does / why we need it**:
Instrument transformer.go with latency metrics - allowing to measure performance impact of adding KMS Providers.
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
"NONE"
```
2018-04-17 19:53:15 -07:00
Kubernetes Submit Queue 1112fa4484
Merge pull request #62748 from liggitt/default-gen
Automatic merge from submit-queue (batch tested with PRs 62748, 60536, 62300, 62661, 62731). 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 default generation for example packages

the example API packages were missing default generation tags, which meant that calls to the generated defaults were not satisfied in cross-build, which regenerates all files

follow-up to https://github.com/kubernetes/kubernetes/pull/62472

```release-note
NONE
```
2018-04-17 19:53:12 -07:00
Kubernetes Submit Queue 60141cdfd9
Merge pull request #59317 from CaoShuFeng/assert_Equal
Automatic merge from submit-queue (batch tested with PRs 62448, 59317, 59947, 62418, 62352). 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 assert.Equal argument order

Reference:
https://godoc.org/github.com/stretchr/testify/assert#Equal



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

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-04-17 16:31:17 -07:00
Jordan Liggitt 5e1872275a
generated changes 2018-04-17 16:19:21 -04:00
Jordan Liggitt f98572c698
Add default generation tags 2018-04-17 16:18:59 -04:00
Jordan Liggitt 55c66f79a6
Log webhook request error 2018-04-17 11:48:10 -04:00
Kubernetes Submit Queue 33f7d8618b
Merge pull request #62714 from CaoShuFeng/CaoShuFeng
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 CaoShuFeng as a reviewer of kube-apiserver

My contributions:
https://github.com/pulls?q=is%3Apr+author%3ACaoShuFeng+is%3Aclosed

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

**Special notes for your reviewer**:
/assign @deads2k @sttts @liggitt 
**Release note**:

```release-note
NONE
```
2018-04-17 05:48:20 -07:00
Dr. Stefan Schimanski 145167f908 Generated files 2018-04-17 11:44:29 +02:00
Dr. Stefan Schimanski 0bb9261eb8 sample-apiserver: add v1beta1 with advanced conversion example from v1alpha1 2018-04-17 11:43:58 +02:00
Cao Shufeng 4c97fd4590 add CaoShuFeng as a reviewer of kube-apiserver 2018-04-17 14:32:05 +08:00
wackxu 2f648ede63 add generate file 2018-04-17 10:35:51 +08:00
wackxu fde414601e update comments for local volume 2018-04-17 10:35:51 +08:00
immutablet bfcb3cd91f Instrument transformer.go with latency metrics. 2018-04-16 11:33:10 -07:00
Kubernetes Submit Queue ee4d90aaa6
Merge pull request #62505 from mtaufen/show-deprecated-help
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>.

Show help for deprecated Kubelet flags

We recently deprecated a bunch of Kubelet flags, which caused them to disappear from `--help` output. This PR unhides these flags, so that the deprecation notice is clearly visible in `--help`.

Fixes: #62009

```release-note
NONE
```

/cc @eparis
2018-04-14 12:21:01 -07:00
Michael Taufen b02f116172 update godeps to use latest pflag 2018-04-13 17:08:48 -07:00
Kubernetes Submit Queue 7ba97b9200
Merge pull request #62234 from liggitt/apigroup-partial-discovery
Automatic merge from submit-queue (batch tested with PRs 61306, 60270, 62496, 62181, 62234). 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>.

Handle partial group and resource responses consistently

GetAPIGroupResources tolerates partial discovery responses to provide as much information to the caller as possible.

Before skipping a particular error response, check whether the response was accompanied by partial group or resource data.

There's an existing TODO to propagate partial errors that I plan to address in a follow-up, but that had more ripples and I wanted to correct this first.

```release-note
NONE
```
2018-04-13 15:03:16 -07:00
Kubernetes Submit Queue 3fc6832ad6
Merge pull request #62496 from jennybuckley/service-port-docs
Automatic merge from submit-queue (batch tested with PRs 61306, 60270, 62496, 62181, 62234). 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 WebhookClientConfig documentation regarding service ports

**What this PR does / why we need it**:
Dynamic admission webhooks backed by services [will always use 443](https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/config/client.go#L133) no matter what ports are available. Our [current documentation](https://github.com/kubernetes/api/blob/master/admissionregistration/v1beta1/types.go#L257-L259) says that "If there is only one port open for the service, that port will be used."

This PR fixes that piece of documentation.
In the future we may wish to support specifying ports other than 443, but the documentation should be fixed first.

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

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

/sig api-machinery
2018-04-13 15:03:10 -07:00
Kubernetes Submit Queue a0a742c38b
Merge pull request #61210 from hzxuzhonghu/etcd-random-check
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>.

check etcd servers by a random order

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

Every time a health check is called on the APIServer via the /healthz endpoint, an etcd healthcheck is performed. Here makes servers check with a random order.

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-04-13 12:12:47 -07:00
Kubernetes Submit Queue 92065407b7
Merge pull request #62462 from jsafrane/private-mount-propagation
Automatic merge from submit-queue (batch tested with PRs 60476, 62462, 61391, 62535, 62394). 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>.

Private mount propagation

This PR changes the default mount propagation from "rslave" (newly added in 1.10) to "private" (default in 1.9 and before). "rslave" as default causes regressions, see below.

Value `"None"` has to be added to `MountPropagationMode` enum in API ("I don't want any propagation at all"), which translates to "private" on Linux. [We did not have use cases for it](https://github.com/kubernetes/community/pull/659#discussion_r131454319), but we have them now.

**Which issue(s) this PR fixes**
Fixes #62397, fixes #62396

**Special notes for your reviewer**:
CRI already has an option for private mount propagation in volumes, however it's called "PRIVATE", while Kubernetes API value is "None". I did not change PRIVATE to NONE to keep the interface stable. See `kubelet_pods.go`.

**Release note**:
```release-note
Default mount propagation has changed from "HostToContainer" ("rslave" in Linux terminology) to "None" ("private") to match the behavior in 1.9 and earlier releases. "HostToContainer" as a default caused regressions in some pods.
```


/sig storage
/sig node
2018-04-13 11:20:13 -07:00
jennybuckley 6994a36c4d Run hack/update-all.sh 2018-04-13 10:19:58 -07:00
jennybuckley 2cecd7d112 Update webhook client config docs regarding service ports 2018-04-13 10:08:30 -07:00
Kubernetes Submit Queue 9139d01c8f
Merge pull request #62374 from hzxuzhonghu/kubeapiserver-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 myself to kube-apiserver/apiserver reviewers

**Release note**:

```release-note
NONE
```
2018-04-13 07:50:07 -07:00
Kubernetes Submit Queue 1b4c4898cb
Merge pull request #61459 from hzxuzhonghu/etcdv3-dial-timeout
Automatic merge from submit-queue (batch tested with PRs 62324, 61459, 62475, 62476, 61914). 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>.

etcdv3 client: add dial timeout

dial timeout is necessary for a reliable system, this pr add it for establishing an etcd connection.

**Release note**:

```release-note
NONE
```
2018-04-12 13:18:08 -07:00
Kubernetes Submit Queue 9816b43188
Merge pull request #61198 from jpbetz/etcd-3.2-upgrade-reattempt
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 default etcd server to 3.2 for kubernetes 1.11

Repply #59836 but with latest etcd 3.2 patch version (3.2.18 which includes mvcc fix and leader election timeout fix) and default `--snapshot-count` to 10k to resolve performance regression in previous etcd 3.2 server upgrade attempt (https://github.com/kubernetes/kubernetes/issues/60589#issuecomment-372458578).

See https://github.com/kubernetes/kubernetes/issues/60589#issuecomment-372458578 for details on the root cause of the performance regression and scalability test results of setting `--snapshot-count` to 10k.

```release-note
Upgrade the default etcd server version to 3.2.18
```
@gyuho @shyamjvs @jdumars @timothysc
2018-04-12 10:46:42 -07:00