Commit Graph

1272 Commits

Author SHA1 Message Date
W. Trevor King
045dbe7ac1 client-go/rest: Fix "segments segment" comment typo
The typo landed with SubResource in adb75e1f (generated staging area,
2016-08-06, kubernetes/kubernetes#29147).

Kubernetes-commit: e42aab6430cbc9d14891e9aaada9ec8becf62273
2018-08-02 08:30:44 -07:00
Kubernetes Publisher
b95fa2e4f3 Merge pull request #67347 from juanvallejo/jvallejo/use-temp-file-config-tests
Automatic merge from submit-queue (batch tested with PRs 67347, 67307, 67358, 67364, 67385). 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 temp file for kubeconfig in test

Followup to https://github.com/kubernetes/kubernetes/pull/67093

Updates client_config_test to use a temporary file for kubeconfig.

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

cc @deads2k @soltysh

Kubernetes-commit: 46bfa1ab17afaffc584f560ee5c752ecbbad4f61
2018-08-16 13:35:57 +00:00
Kubernetes Publisher
744b11616f Merge pull request #66906 from tnozicka/rename-until
Automatic merge from submit-queue (batch tested with PRs 67071, 66906, 66722, 67276, 67039). 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>.

#50102 Task 1: Move apimachinery/pkg/watch.Until into client-go/tools/watch.UntilWithoutRetry

**What this PR does / why we need it**:
This is a split off from https://github.com/kubernetes/kubernetes/pull/50102 to go in smaller pieces.

Moves `apimachinery/pkg/watch.Until` into `client-go/tools/watch.UntilWithoutRetry` and adds context so it is cancelable.

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

**Dev release note**:
```dev-release-note
`apimachinery/pkg/watch.Until` has been moved to `client-go/tools/watch.UntilWithoutRetry`.
While switching please consider using the new `client-go/tools/watch.UntilWithSync` or `client-go/tools/watch.Until`.
```

/cc @smarterclayton @kubernetes/sig-api-machinery-pr-reviews
/milestone v1.12
/priority important-soon
/kind bug
(bug after the main PR which is this split from)

Kubernetes-commit: b6f0aed056ab94fef0b6f54e1ca1d66a5fc228b3
2018-08-16 13:34:54 +00:00
Kubernetes Publisher
791991630f Merge pull request #67178 from cblecker/cfssl
Automatic merge from submit-queue (batch tested with PRs 66602, 67178, 67207, 67125, 66332). 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 cfssl/cfssljson utilities

**What this PR does / why we need it**:
Vendors the `cfssl` and `cfssljson` tools. Updates `kube::util::ensure-cfssl` to use them.

**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 #66995, fixes #60070

**Special notes for your reviewer**:
1. Add cfssl/cfssljson ot the required bins for saving
2. Manually cloned/checked out the new dependencies to my gopath. `godep restore` doesn't pull them down because they aren't required or already in the `Godeps.json`. Used @BenTheElder's list here: https://github.com/kubernetes/kubernetes/issues/66995#issuecomment-410594532
3. `hack/godep-save.sh` to add the packages and dependencies to godep
4. Fixed two bugs when building:
  a. `golang.org/x/crypto` needed to be updated
  b. `github.com/cloudflare/cfssl` needed to be updated to 56268a613a so we can vendor their fork of `crypto/tls`, as we discard their modified vendored stdlib.
5. Update staging godeps
6. Update the `kube::util::ensure-cfssl` to install from vendor

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

Kubernetes-commit: 818e632c1fde5fb01bc8ccf9b9ee6201f33a28b4
2018-08-16 13:34:53 +00:00
Kubernetes Publisher
961ecfb9a2 Merge pull request #67093 from juanvallejo/jvallejo/improve-config-context-update
Automatic merge from submit-queue (batch tested with PRs 67161, 67093, 67077). 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 kubeconfig file modification time

In cases where there are few destination filenames for a given
amount of contexts, but a large amount of contexts, this patch
prevents reading and writing to the same file (or small number
of files) over and over again needlessly.

**Release note**:
```release-note
Decrease the amount of time it takes to modify kubeconfig files with large amounts of contexts
```

cc @deads2k

Kubernetes-commit: 3587aa4206ddf502540d388466985bb51fc4a0e6
2018-08-16 13:33:56 +00:00
juanvallejo
69308bcf06 use temp file for kubeconfig in test
Kubernetes-commit: 03af5089afb5d31707e7d91e55dfd6b157e6f8e1
2018-08-13 14:29:34 -04:00
Christoph Blecker
33d45c1319 Update staging godeps
Kubernetes-commit: c14a9c7c2be3f66efc62297598e4c1b98fedcb4c
2018-08-09 14:42:48 -07:00
juanvallejo
61141c1efe improve kubeconfig file modification time
Trades runtime complexity for spacial complexity when modifying
large amounts of contexts on a kubeconfig.

In cases where there are few destination filenames for a given
amount of contexts, but a large amount of contexts, this patch
prevents reading and writing to the same file (or small number
of files) over and over again needlessly.

Kubernetes-commit: d5651948cf1a14ed284b4708e2057e4cbc72bcbe
2018-08-07 15:13:57 -04:00
Kubernetes Publisher
bdfc4cfc12 Merge pull request #67024 from juanvallejo/jvallejo/add-cancel-req-discovery-rt
Automatic merge from submit-queue (batch tested with PRs 66958, 67024). 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 CancelRequest to discovery round-tripper

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

Make discovery roundtripper implement the RequestCanceler interface

cc @deads2k

Kubernetes-commit: a945b5d9281ac5cba5e4a2976a0747592c0cff87
2018-08-06 21:26:58 +00:00
juanvallejo
12e8bc7b09 add CancelRequest to discovery round-tripper
Kubernetes-commit: 07eae3a1725c65860d85956f4fda20293a8d0a9e
2018-08-06 11:51:13 -04:00
Kubernetes Publisher
02384dbe12 Merge pull request #66967 from deads2k/kubectl-09-naughty
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>.

stop adding internal types to external schemes

at some point someone starting internal types to external schemes in kubectl tests.  This fixes that mistake.

@kubernetes/sig-cli-maintainers
/assign @soltysh

```release-note
NONE
```

Kubernetes-commit: dab04dc6e0103c1778f047594e5405d433cff96c
2018-08-06 13:26:01 +00:00
Kubernetes Publisher
32a482af20 Merge pull request #66837 from deads2k/client-02-panic
Automatic merge from submit-queue (batch tested with PRs 66870, 66929, 66837). 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 panic fake SAR client expansion

if the object is nil, the type assertion fails.

@kubernetes/sig-api-machinery-bugs

```release-note
NONE
```

Kubernetes-commit: a2223e9a9281ca83fd85814c8e7c32b3c8fde53f
2018-08-06 13:25:27 +00:00
Kubernetes Publisher
d0ef5a1c7d Merge pull request #66929 from deads2k/client-03-wrapping-log
Automatic merge from submit-queue (batch tested with PRs 66870, 66929, 66837). 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 logging to find offending transports

When a transport can't be cancelled, we're notified, but we don't which transport is missing the ability.  This adds logging to give us a target type.

@kubernetes/sig-api-machinery-bugs
/assign @juanvallejo

since you hit it.

```release-note
NONE
```

Kubernetes-commit: 99f96511fdb8438f85ebeb4c22c929c97fabcbb6
2018-08-06 13:25:26 +00:00
Tomas Nozicka
1ab85cc3cc Update Bazel
Kubernetes-commit: 4d7747a5a374ab6ee173b99968b4311d967e1b6b
2018-08-06 14:32:36 +02:00
David Eads
03b9b1062a stop adding internal types to external schemes
Kubernetes-commit: 8a1eae451bb0c8eb651675cecb46db628208f003
2018-08-03 07:51:44 -04:00
Kubernetes Publisher
30599d9dba Merge pull request #66870 from apelisse/dry-run-client
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>.

dry-run: Update DynamicClient to pass Create/Update options

Change dynamic client to accept Create and Update options on Create/Update/Patch methods.

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

Kubernetes-commit: b90485560185085ae7a8ad3fab60cb417f7654bf
2018-08-02 17:00:29 -07:00
Kubernetes Publisher
453b064209 Merge pull request #66779 from deads2k/api-05-easy-unit
Automatic merge from submit-queue (batch tested with PRs 66850, 66902, 66779, 66864, 66912). 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 methods to apimachinery to easy unit testing

When unit testing, you often want a selective scheme and codec factory.  Rather than writing the vars and the init function and the error handling, you can simply do

`scheme, codecs := testing.SchemeForInstallOrDie(install.Install)`

@kubernetes/sig-api-machinery-misc
@sttts

```release-note
NONE
```

Kubernetes-commit: 4a54f3f0d6fe73bcced14442b60981819a1744e2
2018-08-06 13:25:25 +00:00
Kubernetes Publisher
b00d4d1d42 Merge pull request #65799 from dekkagaijin/fix-headers
Automatic merge from submit-queue (batch tested with PRs 66225, 66648, 65799, 66630, 66619). 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>.

Percent-encode illegal characters in user.Info.Extra keys

This percent-encodes characters in `X-Remote-Extra-` and `Impersonate-Extra-` keys which aren't valid for header names per [RFC 7230](https://tools.ietf.org/html/rfc7230#section-3.2.6) (plus "%" to avoid breaking keys which contain them). The API server then blindly unescapes these keys.

Reviewer note:
Old clients sending keys which were `%`-escaped by the user will have their values unescaped by new API servers. New clients sending keys containing illegal characters (or "%") to old API servers will not have their values unescaped. This version skew incompatibility is a compromise discussed in #63682.

Fixes #63682

PTAL @mikedanese

**Release note**:
```release-note
action required: the API server and client-go libraries have been fixed to support additional non-alpha-numeric characters in UserInfo "extra" data keys. Both should be updated in order to properly support extra data containing "/" characters or other characters disallowed in HTTP headers.
```

Kubernetes-commit: 6715f139292bfde5e4030e2e3f8077da04cc6d72
2018-08-06 13:24:39 +00:00
Kubernetes Publisher
7d948ea4ad Merge pull request #66648 from feiskyer/azure-sdk-update
Automatic merge from submit-queue (batch tested with PRs 66225, 66648, 65799, 66630, 66619). 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 Azure Go SDK to v19.0.0 and get availability zone for VirtualMachineScaleSetVM

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

Continue of #66242. This PR updates Azure Go SDK to v19.0.0 (with compute API 2018-04-01) and gets availability zones for VirtualMachineScaleSetVM.

**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
Azure Go SDK has been upgraded to v19.0.0 and VirtualMachineScaleSetVM now supports availability zones.
```

/sig azure
/assign @brendandburns @khenidak @andyzhangx

Kubernetes-commit: c2cbe86f7d647f8608c9963105fe297c9c5f4508
2018-08-06 13:24:39 +00:00
David Eads
5f3a23fd53 add logging to find offending transports
Kubernetes-commit: 8b61c5a08846221503ad039a53e3f38328c9c127
2018-08-02 15:14:27 -04:00
Tomas Nozicka
cbdb98d74d Rename Until to UntilWithoutRetry and move to using context so it's
cancelable

Kubernetes-commit: 3d4a02abb54244861f9f05b8db2fdfdaa2c6f67c
2018-08-02 14:11:59 +02:00
Tomas Nozicka
5764fa1b79 Move Until from apimachinery to client-go
Kubernetes-commit: ccb92f6ef867c9e2ede91b7877a492a161986623
2018-08-01 19:35:46 +02:00
Antoine Pelisse
29424b90cb dry-run: Update DynamicClient to pass Create/Update options
Kubernetes-commit: 71970d6475f6570d933fa9f22be2ebc20a9ace6f
2018-08-01 10:35:43 -07:00
David Eads
b46e3962ed generated
Kubernetes-commit: efb160c945587fbfdde3d7b24952cacb55d90450
2018-08-01 10:18:41 -04:00
David Eads
3e9a51baf5 make package name match all the import aliases
Kubernetes-commit: d3bd0eb1d5cefc25e4476d8dc086ebd90439ef4e
2018-08-01 10:01:32 -04:00
David Eads
5798b4e636 fix panic fake SAR client expansion
Kubernetes-commit: 13db7c77c968f95b8f5d7b4a041d8e89001e4f7f
2018-07-31 16:17:36 -04:00
Pengfei Ni
93515e7d7f Update staging Godeps
Kubernetes-commit: 4457947e114ae35a524fe9a1b0271607986ed082
2018-07-27 10:13:56 +08:00
Kubernetes Publisher
0b97d57a86 Merge pull request #66395 from awly/fix-kubelet-exec-plugin-startup
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 http.Transport if it already exists in ExecProvider

**What this PR does / why we need it**:
This unbreaks ExecPlugin. Without the change, we hit this error
https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/client-go/transport/transport.go#L32

**Release note**:
```release-note
Fix kubelet startup failure when using ExecPlugin in kubeconfig
```

Kubernetes-commit: cef2d325ee1be894e883d63013f75cfac5cb1246
2018-07-26 18:23:31 +00:00
Andrew Lytvynov
dd5f11e1e6 Set connrotation dialer via restclient.Config.Dialer
Instead of Transport. This fixes ExecPlugin, which fails if
restclient.Config.Transport is set.

Kubernetes-commit: 3357b5ecf42db9bcf6e54c9d2b6712cfbae077bf
2018-07-25 16:22:32 -07:00
Kubernetes Publisher
3db81bdd12 Merge pull request #66518 from deads2k/dynamic-02-ordie
Automatic merge from submit-queue (batch tested with PRs 66252, 66518). 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 missing OrDie variant for dynamic client construction

Generated clients have it and it is very handy for test cases.

```release-note
NONE
```

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

Kubernetes-commit: 6764a795869d2631eb75f222f776ec5a80b61e37
2018-07-24 10:21:32 +00:00
David Eads
875f881c7c add missing OrDie variant for dynamic client construction
Kubernetes-commit: 75e28b0dd48a3a2d90d1bbb8133114134c6d0528
2018-07-23 16:29:35 -04:00
Kubernetes Publisher
739dd8f9d4 Merge pull request #66249 from deads2k/cli-03-restmapper
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>.

fill in normal restmapping info with the legacy guess

@DirectXMan12 noted this here: https://github.com/kubernetes/kubernetes/issues/65718#issuecomment-401915805

The code does look wrong. This tries to fix it up

@kubernetes/sig-api-machinery-bugs

```release-note
NONE
```

Kubernetes-commit: 24fc97a82810671c76a7bc9fd57a9cd7719dcd37
2018-07-19 23:52:51 +00:00
Kubernetes Publisher
d6a5799477 Merge pull request #65771 from smarterclayton/untyped
Automatic merge from submit-queue (batch tested with PRs 65771, 65849). 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 a new conversion path to replace GenericConversionFunc

reflect.Call is very expensive. We currently use a switch block as part of AddGenericConversionFunc to avoid the bulk of top level a->b conversion for our primary types which is hand-written. Instead of having these be handwritten, we should generate them.

The pattern for generating them looks like:

```
scheme.AddConversionFunc(&v1.Type{}, &internal.Type{}, func(a, b interface{}, scope conversion.Scope) error {
  return Convert_v1_Type_to_internal_Type(a.(*v1.Type), b.(*internal.Type), scope)
})
```

which matches AddDefaultObjectFunc (which proved out the approach last year). The
conversion machinery should then do a simple map lookup based on the incoming types and invoke the function.  Like defaulting, it's up to the caller to match the types to arguments, which we do by generating this code.  This bypasses reflect.Call and in the future allows Golang mid-stack inlining to optimize this code.

As part of this change I strengthened registration of custom functions to be generated instead of hand registered, and also strengthened error checking of the generator when it sees a manual conversion to error out.  Since custom functions are automatically used by the generator, we don't really have a case for not registering the functions.

Once this is fully tested out, we can remove the reflection based path and the old registration methods, and all conversion will work from point to point methods (whether generated or custom).

Much of the need for the reflection path has been removed by changes to generation (to omit fields) and changes to Go (to make assigning equivalent structs easy).

```release-note
NONE
```

Kubernetes-commit: d2cc34fb07138deeacb220126e76a0cb279f340b
2018-07-19 19:53:34 +00:00
Kubernetes Publisher
8ffec625de Merge pull request #59383 from tanshanshan/fix-little3
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>.

Replace info log with warn log

**What this PR does / why we need it**:
Replace info log with warn log
**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 #59356

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```

Kubernetes-commit: 7f912af75ce4794b0cf089103a0e83f1f6a61d2f
2018-07-19 15:53:03 +00:00
Kubernetes Publisher
4e3d951df3 Merge pull request #66078 from deads2k/client-01-list
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 fake dynamic client listing bug

The fake dynamic client used for unit testing had a bug that prevented list from working.  Added a test and fixed the fake client.

@kubernetes/sig-api-machinery-bugs 
/assign @tnozicka 

```release-note
NONE
```

Kubernetes-commit: da1bb028304504cbe33e5dab42290e1e8ea12d14
2018-07-17 10:20:20 -07:00
Kubernetes Publisher
919235c0c3 Merge pull request #66256 from sigma/patch-2
Automatic merge from submit-queue (batch tested with PRs 66212, 66256, 66263, 66193). 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>.

client-go: fix error message spelling in rest config

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

Fixing spelling because it offends the eye.

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

**Special notes for your reviewer**:

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

Kubernetes-commit: bfba154715012b63a3fcc8320cc48986304f819c
2018-07-17 11:43:30 +00:00
Kubernetes Publisher
26fe45c84c Merge pull request #66254 from sigma/patch-1
Automatic merge from submit-queue (batch tested with PRs 66172, 66254). 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>.

client-go: update documentation for remotecommand.StreamOptions

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

The ability to explicitly define the supported protocols was removed in commit 12c7874c0d88e9099ab2a29915d26751f0d23c2a
Adjust documentation accordingly.

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

**Special notes for your reviewer**:

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

Kubernetes-commit: e09be82ad04107f81032b82a1e2452759001819f
2018-07-17 11:42:58 +00:00
Yann Hodique
334ce435af client-go: fix error message spelling in rest config
Kubernetes-commit: f0ca5c1376f28c2a6c2aebeab4b83ceb35a78817
2018-07-16 16:00:03 -07:00
Yann Hodique
58a34f32bd client-go: update documentation for remotecommand.StreamOptions
The ability to explicitly define the supported protocols was removed in commit 12c7874c0d88e9099ab2a29915d26751f0d23c2a
Adjust documentation accordingly.

Kubernetes-commit: f77060aa8da8256fa48412e7a0d9523245017dcb
2018-07-16 14:43:54 -07:00
David Eads
7aab051039 fill in normal restmapping info with the legacy guess
Kubernetes-commit: 0aa13d75021bcc80af73b3edaa3209ecd6ebe687
2018-07-16 13:38:43 -04:00
Kubernetes Publisher
5e5e185a9e Merge pull request #65737 from roycaihw/api-linter
Automatic merge from submit-queue (batch tested with PRs 64181, 65737). 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>.

API linter framework and namesMatch API rule

**What this PR does / why we need it**:
Bump kube-openapi dependency to use the [API linter framework](https://github.com/kubernetes/kube-openapi/pull/83) in k/k OpenAPI spec generation procedure.

Currently one API rule is enforced:
"Go field names must be CamelCase. JSON field names must be camelCase. Other than capitalization of the initial letter, the two should almost always match. No underscores nor dashes in either."

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

**Special notes for your reviewer**:
Most code change in this PR was generated (~1700 lines). Please see commits for detail.

**Release note**:

```release-note
NONE
```

/sig api-machinery
/cc @pwittrock @mbohlool

Kubernetes-commit: 614e3adda05c5d7189c8485ba7abe1ba7ee501a7
2018-07-14 05:25:44 +00:00
Kubernetes Publisher
a20933ff15 Merge pull request #65899 from sttts/sttts-self-signed-fixtures
Automatic merge from submit-queue (batch tested with PRs 65899, 65900). 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: use self-signed cert fixtures in integration test servers

Kubernetes-commit: 932766231342f1f7d2b8d3063b139c46a8bf9f2b
2018-07-13 21:27:26 +00:00
Kubernetes Publisher
f1995823ac Merge pull request #65594 from liggitt/node-csr-addresses-2
Automatic merge from submit-queue (batch tested with PRs 65052, 65594). 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>.

Derive kubelet serving certificate CSR template from node status addresses

xref https://github.com/kubernetes/features/issues/267
fixes #55633

Builds on https://github.com/kubernetes/kubernetes/pull/65587

* Makes the cloud provider authoritative when recording node status addresses
* Makes the node status addresses authoritative for the kube-apiserver determining how to speak to a kubelet (stops paying attention to the hostname label when determining how to reach a kubelet, which was only done to support kubelets < 1.5)
* Updates kubelet certificate rotation to be driven from node status
  * Avoids needing to compute node addresses a second time, and differently, in order to request serving certificates.
  * Allows the kubelet to react to changes in its status addresses by updating its serving certificate
  * Allows the kubelet to be driven by external cloud providers recording node addresses on the node status

test procedure:
```sh
# setup
export FEATURE_GATES=RotateKubeletServerCertificate=true
export KUBELET_FLAGS="--rotate-server-certificates=true --cloud-provider=external"

# cleanup from previous runs
sudo rm -fr /var/lib/kubelet/pki/

# startup
hack/local-up-cluster.sh

# wait for a node to register, verify it didn't set addresses
kubectl get nodes
kubectl get node/127.0.0.1 -o jsonpath={.status.addresses}

# verify the kubelet server isn't available, and that it didn't populate a serving certificate
curl --cacert _output/certs/server-ca.crt -v https://localhost:10250/pods
ls -la /var/lib/kubelet/pki

# set an address on the node
curl -X PATCH http://localhost:8080/api/v1/nodes/127.0.0.1/status \
  -H "Content-Type: application/merge-patch+json" \
  --data '{"status":{"addresses":[{"type":"Hostname","address":"localhost"}]}}'

# verify a csr was submitted with the right SAN, and approve it
kubectl describe csr
kubectl certificate approve csr-...

# verify the kubelet connection uses a cert that is properly signed and valid for the specified hostname, but NOT the IP
curl --cacert _output/certs/server-ca.crt -v https://localhost:10250/pods
curl --cacert _output/certs/server-ca.crt -v https://127.0.0.1:10250/pods
ls -la /var/lib/kubelet/pki

# set an hostname and IP address on the node
curl -X PATCH http://localhost:8080/api/v1/nodes/127.0.0.1/status \
  -H "Content-Type: application/merge-patch+json" \
  --data '{"status":{"addresses":[{"type":"Hostname","address":"localhost"},{"type":"InternalIP","address":"127.0.0.1"}]}}'

# verify a csr was submitted with the right SAN, and approve it
kubectl describe csr
kubectl certificate approve csr-...

# verify the kubelet connection uses a cert that is properly signed and valid for the specified hostname AND IP
curl --cacert _output/certs/server-ca.crt -v https://localhost:10250/pods
curl --cacert _output/certs/server-ca.crt -v https://127.0.0.1:10250/pods
ls -la /var/lib/kubelet/pki
```

```release-note
* kubelets that specify `--cloud-provider` now only report addresses in Node status as determined by the cloud provider
* kubelet serving certificate rotation now reacts to changes in reported node addresses, and will request certificates for addresses set by an external cloud provider
```

Kubernetes-commit: 337dfe0a9cde3894eb6a26f9184df659d54007c6
2018-07-12 09:27:33 +00:00
David Eads
4b43750b96 fix dynamic client listing bug
Kubernetes-commit: 60afd0ba81aeccb04169716c815348ceb424730d
2018-07-11 13:05:54 -04:00
Haowei Cai
874fbcf976 generated
Kubernetes-commit: 3cd919c9fbb902e5a595f0c0c644e45f6ca8750a
2018-07-10 17:53:09 -07:00
Kubernetes Publisher
0ec73abb06 Merge pull request #64664 from atlassian/error-handling-generated-client
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>.

Handle errors in generated client scheme

**What this PR does / why we need it**:
Adds missing error handling for schema construction code in generated clientsets.

**Which issue(s) this PR fixes**
Together with #64654 fixes #51457.

**Release note**:

```release-note
NONE
```
/kind bug
/sig api-machinery

Kubernetes-commit: 0e7376d9cb1ec74bcb3c10a664a330bc9d60df64
2018-07-09 17:26:53 +00:00
Kubernetes Publisher
a452c6c436 Merge pull request #65904 from deads2k/api-02-trackscheme
Automatic merge from submit-queue (batch tested with PRs 65946, 65904, 65913, 65906, 65920). 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>.

track schemes by name for error reporting

Getting an error message about a type not being in the scheme is hard to fix if you don't know which scheme is failing.  This adds a name to the scheme which can be set during creation or can be set based on the calling stack.  If you use the old constructor a name is generated for you based on the stack.  Something like "k8s.io/client-go/dynamic/scheme.go:28" for instance.

Also moves a typer to its point of use.  This was debt from previous refactors which I noticed going through.

@kubernetes/sig-api-machinery-misc
@sttts

```release-note
NONE
```

Kubernetes-commit: 8e2fdb32bc84103b15310a221a375470bf567bdc
2018-07-08 01:26:09 +00:00
David Eads
03f517daaf generated
Kubernetes-commit: 79d04f670929eb5bb3d4c9078111dab46eb20bb4
2018-07-06 11:44:26 -04:00
David Eads
21fd7d2b8a name runtime.Schemes so we can see which one fails
Kubernetes-commit: 340802b079dbf8d193f162d49663679bd7d24ef7
2018-07-06 09:18:05 -04:00
David Eads
5242ede50e move CRD server unstructured typer to point of use
Kubernetes-commit: d3731fe0988352ab98c1c9e05e4077b3358d3473
2018-07-06 09:17:37 -04:00