Commit Graph

4153 Commits (3f581dc265949622d71e843a653fabe76db3774f)

Author SHA1 Message Date
Haowei Cai a14f423ebb generated 2018-05-21 18:04:54 -07:00
Haowei Cai 2acbe87156 mark ServerAddressByClientCIDRs as optional 2018-05-21 17:47:25 -07:00
Kubernetes Submit Queue 6d510f52f2
Merge pull request #63409 from mtaufen/kc-validation-feature-gates
Automatic merge from submit-queue (batch tested with PRs 63881, 64046, 63409, 63402, 63221). 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>.

Kubelet config: Validate new config against future feature gates

This fixes an issue with KubeletConfiguration validation, where the             
feature gates set by the new config were not taken into account.                
                                                                                
Also fixes a validation issue with dynamic Kubelet config, where flag           
precedence was not enforced prior to dynamic config validation in the           
controller; this prevented rejection of dynamic configs that don't merge        
well with values set via legacy flags. 

Fixes #63305 

```release-note
NONE
```
2018-05-21 17:05:34 -07:00
Kubernetes Submit Queue f5fb740f06
Merge pull request #59414 from mbohlool/test_cycle
Automatic merge from submit-queue (batch tested with PRs 59414, 64096). 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 cyclic dependency of apiserver test for OpenAPI test

Fixes #41748

```release-note
NONE
```
2018-05-21 12:14:07 -07:00
Kubernetes Submit Queue 5c7add3c75
Merge pull request #64069 from ibrasho-forks/fix-error-message
Automatic merge from submit-queue (batch tested with PRs 64069, 64087). 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 message

**What this PR does / why we need it**:
This PR fixes a minor mistake in an error message in `Equalities.DeepEqual`. I've tried to trace this mistake but could not find out where it originated.

**Release note**:
```release-note
NONE
```
2018-05-21 10:48:14 -07:00
mbohlool 9e94cf72a8 Update bazel 2018-05-20 22:19:06 -07:00
mbohlool e979b16987 Fix cyclic dependency of apiserver test for OpenAPI test 2018-05-20 22:19:06 -07:00
Kubernetes Submit Queue b87105aebd
Merge pull request #64004 from mbohlool/apiservice_order
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>.

Sort API Services by Kube-Version order

Sort API services based on kube-version format. If the version does not have kube-version format.

kube-version format: `v[MajorVersion]((alpha|beta)[minorVersion])?`
e.g. v1alpha1, v4, v21beta12

Sort base on:
Version type first: GA>Beta>Alpha
Major version then Minor version (if exists).

```release-note
APIServices with kube-like versions (e.g. v1, v2beta1, etc.) will be sorted appropriately within each group. 
```
2018-05-20 20:43:24 -07:00
Michael Taufen 647e90341c Kubelet config: Validate new config against future feature gates
This fixes an issue with KubeletConfiguration validation, where the
feature gates set by the new config were not taken into account.

Also fixes a validation issue with dynamic Kubelet config, where flag
precedence was not enforced prior to dynamic config validation in the
controller; this prevented rejection of dynamic configs that don't merge
well with values set via legacy flags.
2018-05-20 13:15:59 -07:00
Mehdy Bohlool cc87ba3a12 Generated files 2018-05-20 01:40:05 -07:00
Mehdy Bohlool 97ada15fbe Sort API Services by Kube-Version order 2018-05-20 01:40:04 -07:00
Ibrahim AshShohail 73f4cd89af
Fix error message in Equalities.DeepEqual
Signed-off-by: Ibrahim AshShohail <me@ibrasho.com>
2018-05-20 02:22:09 +03:00
Kubernetes Submit Queue 7909712ca5
Merge pull request #60464 from roycaihw/loadconfig
Automatic merge from submit-queue (batch tested with PRs 63598, 63913, 63459, 63963, 60464). 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 raises error on duplicated name in kubeconfig

(for NamedCluster, NamedContext, NamedUser, NamedExtension)



**What this PR does / why we need it**:
Client should detect duplicated name when loading `name-value` based lists in kubeconfig: `users`, `clusters`, `contexts`. Currently if there are multiple value with same name, `client-python` will pick the first one, while `client-go` will pick the last.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
ref: kubernetes-client/python#445, kubernetes-client/python-base#47

**Special notes for your reviewer**:

**Release note**:

```release-note
kubectl and client-go now detects duplicated name for user, cluster and context when loading kubeconfig and reports error 
```

/sig api-machinery

cc @brendandburns @mbohlool
2018-05-19 06:49:27 -07:00
Kubernetes Submit Queue 4810b9ba67
Merge pull request #63913 from deads2k/controller-10-event
Automatic merge from submit-queue (batch tested with PRs 63598, 63913, 63459, 63963, 60464). 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 event ref determination for apigroups

The event ref determination was never updated to handle apigroups so it has been returning only a group (not a version).

@kubernetes/sig-apps-bugs 

```release-note
event object references with apiversion will now report an apiversion.
```
2018-05-19 06:49:16 -07:00
Kubernetes Submit Queue 4b0b91ae31
Merge pull request #63598 from nikhita/subresources-to-beta
Automatic merge from submit-queue (batch tested with PRs 63598, 63913, 63459, 63963, 60464). 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>.

apiextensions: promote CustomResourcesSubresources to beta

Fixes #62786

This PR promotes the CustomResourcesSubResources feature to beta and makes it enabled by default.

**Release note**:

```release-note
Subresources for custom resources is now beta and enabled by default. With this, updates to the `/status` subresource will disallow updates to all fields other than `.status` (not just `.spec` and `.metadata` as before). Also, `required` can be used at the root of the CRD OpenAPI validation schema when the `/status` subresource is enabled.
```

/assign sttts deads2k 
/sig api-machinery
/area custom-resources
2018-05-19 06:49:12 -07:00
Haowei Cai 4e114fd65b generated 2018-05-18 18:42:39 -07:00
Haowei Cai cd13c41dde Add GET PATCH support for two /status:
apiservices/status under apiregistration.k8s.io
certificatesigningrequests/status under certificates.k8s.io
2018-05-18 18:31:27 -07:00
Haowei Cai e9454a383b Raise error on duplicate name in kubeconfig
for NamedCluster, NamedContext, NamedUser, NamedExtension
2018-05-18 17:56:46 -07:00
Mikhail Mazurskiy 5e8e570dbd
Use Dial with context 2018-05-19 08:14:37 +10:00
David Eads b2be8953b1 fix event ref determination for apigroups 2018-05-18 11:36:57 -04:00
Kubernetes Submit Queue 23d3b6fc79
Merge pull request #63716 from JacobTanenbaum/healthz
Automatic merge from submit-queue (batch tested with PRs 63920, 63716, 63928, 60553, 63946). 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 InstallPathHandler which allows for more then one path to be associated with health checking.

Currently it is only possible to have one group of checks which must all pass for the handler to report success.
Allowing multiple paths for these checks allows use of the same machinery for other kinds of checks, i.e. readiness.



**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-05-18 01:07:14 -07:00
Kubernetes Submit Queue c13bd2bec2
Merge pull request #63957 from hzxuzhonghu/rm-UID-ctx
Automatic merge from submit-queue (batch tested with PRs 63871, 63927, 63966, 63957, 63844). 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 UID mutation from request.context

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

remove UID mutation from request.context, which is no use currently.

Fixes #59775

**Special notes for your reviewer**:

**Release note**:

```release-note
Remove UID mutation from request.context.
```
2018-05-17 13:40:25 -07:00
Kubernetes Submit Queue b3837d004a
Merge pull request #63469 from wojtek-t/allow_list_and_watch_secrets
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Allow for listing & watching individual secrets from nodes

This PR:
- propagates value of `metadata.name` field from fieldSelector to `name` field in RequestInfo (for list and watch requests)
- authorizes list/watch for requests for single secrets/configmaps coming from nodes

As an example:
```
/api/v1/secrets/namespaces/ns?fieldSelector=metadata.name=foo =>
  requestInfo.Name = "foo",
  requestInfo.Verb = "list"
/api/v1/secrets/namespaces/ns?fieldSelector=metadata.name=foo&watch=true =>
  requestInfo.Name = "foo",
  requestInfo.Verb = "list"
```

```release-note
list/watch API requests with a fieldSelector that specifies `metadata.name` can now be authorized as requests for an individual named resource
```
2018-05-17 07:09:43 -07:00
xuzhonghu 84678b2882 update bazel 2018-05-17 11:58:26 +08:00
xuzhonghu 7ea612db16 remove request context.WithUID 2018-05-17 11:58:26 +08:00
Andrew Lytvynov 85a61ff3aa Extract connection rotating dialer into a package
This will be re-used for exec auth plugin to rotate connections on
credential change.
2018-05-16 10:30:53 -07:00
Kubernetes Submit Queue baad3d4159
Merge pull request #63875 from deads2k/client-10-timeout
Automatic merge from submit-queue (batch tested with PRs 63875, 63817). 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>.

make TestGetServerGroupsWithTimeout more reliable

Stops overriding a global variable in a test and tolerates a different kind of timeout message you can see.

/assign @soltysh
2018-05-16 08:26:12 -07:00
Kubernetes Submit Queue 2fcac6abf2
Merge pull request #63314 from mtaufen/dkcfg-structured-status
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Move to a structured status for dynamic kubelet config

This PR updates dynamic Kubelet config to use a structured status, rather than a node condition. This makes the status machine-readable, and thus more useful for config orchestration. 

Fixes: #56896

```release-note
The status of dynamic Kubelet config is now reported via Node.Status.Config, rather than the KubeletConfigOk node condition.
```
2018-05-15 19:41:36 -07:00
Kubernetes Submit Queue 0e42990eee
Merge pull request #63880 from sttts/sttts-move-scheme-ref-obj-to-smp
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>.

apimachinery: move schema reference object into smp patcher

The schema reference object is only used in the strategic merge patch code path. This PR moves the creation there.

This PR is a preparation to make the patcher compatible with the UnstructuredObjectConverter without internal types. It will allow us to return an error on missing kinds at https://github.com/kubernetes/kubernetes/pull/63830#discussion_r188171025.
2018-05-15 18:50:48 -07:00
Kubernetes Submit Queue 49e9322d4f
Merge pull request #63861 from deads2k/client-09-clean
Automatic merge from submit-queue (batch tested with PRs 63589, 63644, 63861, 63872, 63847). 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 service.deletecollection since the server doesn't support it

Updates the generated service client to match the API available.

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

```release-note
NONE
```
2018-05-15 17:09:14 -07:00
Kubernetes Submit Queue b726b2ef5d
Merge pull request #63589 from hanxiaoshuai/cleanup0509
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>.

clean unused code in restmapper_test.go

**What this PR does / why we need it**:
clean unused code in restmapper_test.go
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:
/kind cleanup
**Release note**:

```release-note
NONE
```
2018-05-15 16:49:43 -07:00
wojtekt c69165d503 Autogenerated code 2018-05-15 21:38:54 +02:00
wojtekt a4c35f31f2 Fix fakeclient List 2018-05-15 21:36:19 +02:00
Kubernetes Submit Queue a3d79c39f4
Merge pull request #63705 from sttts/sttts-cr-validation-multiple-errors
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>.

apiextensions: normalize CR validation to return multiple errors

Deduplicated and use of the `allErrs` pattern we have elsewhere.
2018-05-15 12:26:22 -07:00
Michael Taufen fcc1f8e7b6 Move to a structured status for dynamic Kubelet config
Updates dynamic Kubelet config to use a structured status, rather than a
node condition. This makes the status machine-readable, and thus more
useful for config orchestration.

Fixes: #56896
2018-05-15 11:25:12 -07:00
Kubernetes Submit Queue f2ea83bef8
Merge pull request #63550 from juanvallejo/jvallejo/move-cached-discovery
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

move cached_discovery to client-go/discovery

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

Moves the cmd/util CachedDiscoveryClient to client-go

cc @soltysh @deads2k
2018-05-15 10:47:01 -07:00
Dr. Stefan Schimanski 9745d6c119 apiextensions: only create patch reference object for smp path 2018-05-15 19:45:48 +02:00
David Eads e7620e814a make TestGetServerGroupsWithTimeout more reliable 2018-05-15 12:47:23 -04:00
Kubernetes Submit Queue bd0d093701
Merge pull request #63779 from wojtek-t/number_of_watchers_metrics
Automatic merge from submit-queue (batch tested with PRs 63792, 63495, 63742, 63332, 63779). 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 a metrics of number of registered watchers in apiserver
2018-05-15 09:04:32 -07:00
Kubernetes Submit Queue 944e07480f
Merge pull request #63742 from thockin/kill-tolerate-unready-annotation
Automatic merge from submit-queue (batch tested with PRs 63792, 63495, 63742, 63332, 63779). 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>.

Actually support service `publishNotReadyAddresses`

This was added and the annotation was deprecated, but it was never
implemented.

xref #63741

**Release note**:

```release-note
The annotation `service.alpha.kubernetes.io/tolerate-unready-endpoints` is deprecated.  Users should use Service.spec.publishNotReadyAddresses instead.
```
2018-05-15 09:04:24 -07:00
David Eads eb438b088c generated 2018-05-15 11:31:00 -04:00
David Eads 0c1c58846d stop generating service deletecollection 2018-05-15 11:30:59 -04:00
juanvallejo 57f308ae60 restore old cached client behavior 2018-05-15 10:37:53 -04:00
juanvallejo 4059355743 move cached_discovery to client-go/discovery 2018-05-15 10:20:56 -04:00
wojtekt f344c5c062 Requires single name for list and watch 2018-05-15 14:19:21 +02:00
Kubernetes Submit Queue d0f4a8fa17
Merge pull request #62695 from CaoShuFeng/duplicated_status
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>.

avoid duplicate status in audit events

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



**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**:
/assign @sttts @tallclair 

**Release note**:

```
Action required: When Response is a metav1.Status, it is no longer copied into the audit.Event status. Only the "status", "reason" and "code" fields are set.
```
2018-05-15 03:44:36 -07:00
Kubernetes Submit Queue 6aa6051fab
Merge pull request #63557 from apelisse/dry-run-path
Automatic merge from submit-queue (batch tested with PRs 63603, 63557, 62015). 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: Fail if dry-run query param is specified

Adds a dry-run query parameter now that does nothing but reject the request. The sooner we have this check in master, the safer it will be for clients to send dry-run requests that are not going to be applied nonetheless.

```release-note
Create a new `dryRun` query parameter for mutating endpoints. If the parameter is set, then the query will be rejected, as the feature is not implemented yet. This will allow forward compatibility with future clients; otherwise, future clients talking with older apiservers might end up modifying a resource even if they include the `dryRun` query parameter.
```
2018-05-15 02:07:41 -07:00
Kubernetes Submit Queue a1b54f3c99
Merge pull request #63100 from ravisantoshgudimetla/priority-beta-api
Automatic merge from submit-queue (batch tested with PRs 55511, 63372, 63400, 63100, 63769). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Create pkg/scheduling/apis/v1beta1 and move priorityClass to beta 

**What this PR does / why we need it**:
This is for creating pkg/apis/scheduling/v1beta1 so that priorityClasses could be moved to beta.

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

**Special notes for your reviewer**:
/cc @bsalamat @aveshagarwal 

**Release note**:

```release-note
The `PriorityClass` API is promoted to `scheduling.k8s.io/v1beta1`
```
2018-05-14 14:35:21 -07:00
Tim Hockin c038f60d04 Actually support service `publishNotReadyAddresses`
This was added and the annotation was deprecated, but it was never
implemented.
2018-05-14 14:19:54 -07:00
Antoine Pelisse 98613924ea apiserver: Fail if dry-run query param is specified 2018-05-14 11:20:57 -07:00
Eric Chiang 66f2622bb7
client-go: remove dep on pflag 2018-05-14 09:48:36 -07:00
wojtekt bdd9492da0 Track number of registered watchers in apiserver 2018-05-14 15:10:42 +02:00
Dr. Stefan Schimanski 5d66dc9338 apiextensions: normalize CR validation to return multiple errors 2018-05-14 10:16:19 +02:00
ravisantoshgudimetla f20bd00ab2 Generated 2018-05-12 02:01:09 -04:00
ravisantoshgudimetla 1db5990013 Move scheduling api to beta 2018-05-12 02:01:04 -04:00
Devdatta Kulkarni 3e22383a8a Added documentation of how client-go interfaces with custom controller code
**What this PR does / why we need it**:

The sample-controller makes extensive use of various mechanisms
available in the client-go library. For writing custom controllers/operators
it will be helpful if there is precise description of how the
client-go library works and how/where it interfaces with
custom controller code.

This patch adds documentation that sheds light on how (parts) of the
client-go library work and its interaction-points with
controller code. The documentation and the diagram comes from [1],
(link included here for reference purpose).

[1] https://medium.com/@cloudark/kubernetes-custom-controllers-b6c7d0668fdf

Contributing the diagram and the writeup was recommended by
by @sttts and @nikhita on https://github.com/kubernetes/sample-controller/issues/13

**Release note**:

```release-note
NONE
```
2018-05-11 17:04:03 -05:00
Kubernetes Submit Queue 92ba95c39c
Merge pull request #63446 from deads2k/client-08-remove-old
Automatic merge from submit-queue (batch tested with PRs 63367, 63718, 63446, 63723, 63720). 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>.

finish new dynamic client and deprecate old dynamic client

Builds on a couple other pulls.  This completes the transition to the new dynamic client.

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

```release-note
The old dynamic client has been replaced by a new one.  The previous dynamic client will exist for one release in `client-go/deprecated-dynamic`.  Switch as soon as possible.
```
2018-05-11 14:49:16 -07:00
Kubernetes Submit Queue 769b7dadca
Merge pull request #63619 from roycaihw/get-crd-status
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>.

CRD Status subresource support get+update+patch

CRD Status previously only supports PUT and returns 405 on GET and PATCH

/assign @sttts 
/sig api-machinery

**Release note**:

```release-note
CustomResourceDefinitions Status subresource now supports GET and PATCH
```
2018-05-11 13:26:50 -07:00
David Eads fd044d152e fix dynamic client name 2018-05-11 13:12:09 -04:00
Haowei Cai 0386e9bf75 Add GET PATCH support for crd status 2018-05-11 09:20:53 -07:00
Jacob Tanenbaum 2082a0f428 Add InstallPathHandler which allows for more then one path to be associated with health checking.
Currently it is only possible to have one group of checks which must all pass for the handler to report success.
Allowing multiple paths for these checks allows use of the same machinery for other kinds of checks, i.e. readiness.
2018-05-11 11:06:50 -04:00
Kubernetes Submit Queue 233b267392
Merge pull request #63667 from hzxuzhonghu/wait-informer-synced
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>.

sample-apiserver admission wait for informer sync before serving

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

sample-apiserver admission wait for informer sync before serving

**Release note**:

```release-note
NONE
```
2018-05-11 05:13:36 -07:00
David Eads d8924bc1c9 move old dynamic client to deprecated-client 2018-05-11 08:00:46 -04:00
David Eads 82e32d2a32 add subresource support for the dynamic client 2018-05-11 08:00:03 -04:00
Kubernetes Submit Queue 82abc961b9
Merge pull request #63703 from hzxuzhonghu/fix-typo
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 typo in apiextentions apiserver

the comment should be apiextentions apiserver

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-05-11 04:20:53 -07:00
Kubernetes Submit Queue afd93b6e46
Merge pull request #63185 from hanxiaoshuai/fixbug0426
Automatic merge from submit-queue (batch tested with PRs 63246, 63185). 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 checks validation MinRequestTimeout of ServerRunOptions

**What this PR does / why we need it**:
add checks validation MinRequestTimeout of ServerRunOptions
**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**:
I think we should check MinRequestTimeout > 0 (like  RequestTimeout), in Validate() of ServerRunOptions. If it is not necessary, close this PR.Thanks
**Release note**:

```release-note
NONE
```
2018-05-11 03:30:13 -07:00
xuzhonghu 0c77bcd3ea fix typo 2018-05-11 17:17:16 +08:00
Kubernetes Submit Queue e59ae29fbc
Merge pull request #63468 from jeffchanjunwei/master
Automatic merge from submit-queue (batch tested with PRs 59727, 63468). 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 annotation of APIGroupInfo

**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-05-10 20:50:19 -07:00
Kubernetes Submit Queue 7eb88f11d2
Merge pull request #59727 from wgliang/master.time
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>.

should use time.Since instead of time.Now().Sub

**What this PR does / why we need it**:
should use time.Since instead of time.Now().Sub

**Special notes for your reviewer**:
2018-05-10 20:29:40 -07:00
Jeff Chan f8386d5b0f
Merge branch 'master' into master 2018-05-11 10:03:32 +08:00
xuzhonghu ec30ad48b8 sample-apiserver admission wait for informer sync before serving 2018-05-11 09:23:39 +08:00
Kubernetes Submit Queue 0bdb73c05d
Merge pull request #62194 from AdamDang/patch-1
Automatic merge from submit-queue (batch tested with PRs 62665, 62194, 63616, 63672, 63450). 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>.

Correct the returned message

Line 73 and line 103:
return fmt.Errorf("expected ResponseBody to be nil, got non-nill '%s'", events[i].ResponseObject.Raw)
"non-nill" should be changed to "non-nil"
2018-05-10 12:56:16 -07:00
Kubernetes Submit Queue 7e75a09db6
Merge pull request #63613 from deads2k/cli-52-builderclient
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>.

 construct resource.Builder from kubeconfig flags

updates the resource.Builder to be constructed from the kubeconfig flags struct/interface that we now have.

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

```release-note
NONE
```
2018-05-10 09:03:11 -07:00
Kubernetes Submit Queue 9dcbdc3d45
Merge pull request #60200 from dixudx/clientgo_openstack_config
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>.

read openstack auth config from client config

**What this PR does / why we need it**:
> // TODO: read/persist client configuration(OS_XXX env vars) in config

/sig openstack

**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 @dims
**Release note**:

```release-note
read openstack auth config from client config
```
2018-05-10 08:15:45 -07:00
David Eads 1f5357034b construct resource.Builder from kubeconfig flags 2018-05-10 09:42:15 -04:00
Nikhita Raghunath 0e32006109 update generated files 2018-05-10 18:24:04 +05:30
Nikhita Raghunath 3ed5cc3954 Promote CustomResourcesSubresources to beta 2018-05-10 18:24:04 +05:30
Kubernetes Submit Queue e63f25902c
Merge pull request #63587 from sttts/sttts-crd-test-conflict-errs
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>.

apiextensions: handle CRD conflict errs in integration tests

In the integration tests we assume that no other party modifies CRDs while the test is updating them repeatedly. Due to semantic changes for CRD conditions (https://github.com/kubernetes/kubernetes/pull/63068) and the introduction of `status.storedVersions` (https://github.com/kubernetes/kubernetes/pull/63518), this assumption will not hold true in the future. This PR prepares the test to handle conflict errors gracefully.
2018-05-10 03:28:54 -07:00
Dr. Stefan Schimanski 5b78c3a41d 6capiextensions: handle CRD conflict errs in integration tests 2018-05-10 10:45:29 +02:00
Kubernetes Submit Queue d42df4561a
Merge pull request #61976 from atlassian/ticker-with-stop
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() for Ticker to enable leak-free code

**What this PR does / why we need it**:
I wanted to use the clock package but the `Ticker` without a `Stop()` method is a deal breaker for me.

**Release note**:
```release-note
NONE
```
/kind enhancement
/sig api-machinery
2018-05-09 19:06:56 -07:00
Kubernetes Submit Queue b2fe2a0a6d
Merge pull request #59847 from mtaufen/dkcfg-explicit-keys
Automatic merge from submit-queue (batch tested with PRs 63624, 59847). 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>.

explicit kubelet config key in Node.Spec.ConfigSource.ConfigMap

This makes the Kubelet config key in the ConfigMap an explicit part of
the API, so we can stop using magic key names.
    
As part of this change, we are retiring ConfigMapRef for ConfigMap.


```release-note
You must now specify Node.Spec.ConfigSource.ConfigMap.KubeletConfigKey when using dynamic Kubelet config to tell the Kubelet which key of the ConfigMap identifies its config file.
```
2018-05-09 17:55:13 -07:00
Kubernetes Submit Queue 662f543ebf
Merge pull request #63593 from justinsb/typo_in_envelope_error_message
Automatic merge from submit-queue (batch tested with PRs 63593, 63539). 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 typo in envelope transform error message

genvelope -> envelope

```release-note
NONE
```
2018-05-09 14:49:11 -07:00
Kubernetes Submit Queue ca92b73a65
Merge pull request #63602 from deads2k/cli-54-categories
Automatic merge from submit-queue (batch tested with PRs 59284, 63602). 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>.

 category expansion can only come from the server

A couple release ago we moved category expansion to the server instead of hardcoding it in the client.  Similar to restmappings, there is no valid client-side expansion anymore, so this removes the code that hardcoded the list and moves the category expansion to the same package as our discovery based restmappers.

@kubernetes/sig-cli-maintainers 

```release-note
NONE
```
2018-05-09 13:51:13 -07:00
Kubernetes Submit Queue d89471c4b5
Merge pull request #59284 from Addepar/fix-empty-null-patch
Automatic merge from submit-queue (batch tested with PRs 59284, 63602). 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>.

Exclude keys containing empty patches in the final patch

**What this PR does / why we need it**: 
This minimizes the 3-way JSON merge patch generated when calculating the patch necessary to send to the server. It does this by removing empty maps created from deleting keys in the keepOrDeleteNullInObj method.

This is not only a slight performance improvement (less PATCH requests) but also necessary when working with custom resources that have RBAC restrictions.

**Which issue(s) this PR fixes**: N/A

**Special notes for your reviewer**: N/A

**Release note**:

```release-note
NONE
```
2018-05-09 13:51:09 -07:00
David Eads ad87219b2c category expansion can only come from the server 2018-05-09 15:05:58 -04:00
David Eads 37f6cb7230 move category expansion types to restmapper package 2018-05-09 15:03:09 -04:00
Kubernetes Submit Queue 234939dced
Merge pull request #63502 from liggitt/parallel-discovery
Automatic merge from submit-queue (batch tested with PRs 62354, 62934, 63502). 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>.

Run resource discovery in parallel

best viewed ignoring whitespace (https://github.com/kubernetes/kubernetes/pull/63502/files?w=1)

on high-latency connections, serializing resource discovery requests across group versions can take significant amounts of time. this parallelizes the network request portion of the discovery call

xref #63368 

```release-note
NONE
```
2018-05-09 09:30:15 -07:00
Justin Santa Barbara 8f87e5c7da Fix typo in envelope transform error message 2018-05-09 09:36:29 -04:00
Kubernetes Submit Queue ca76734126
Merge pull request #63533 from sttts/sttts-required-with-status-subresource
Automatic merge from submit-queue (batch tested with PRs 59034, 63565, 63533). 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>.

apiextensions: allow "required" at root with status subresource

In the subresources alpha we intentionally disallowed anything than `properties` at the root of the validation schema in order to allow us to project it to the .status subtree. By doing this we also disallowed `required` at the root which is necessary to enforce e.g. a spec to be set. This PR fixes this.

Moreover, it fixes that the restriction is only enforced when the status subresource is actually enabled. Before this PR we were enforcing the restriction as soon as the feature gate was enabled, leading to a backwards incompatible change.

```release-note
Allow "required" to be used at the CRD OpenAPI validation schema when the /status subresource is enabled.
```

There was an issue reporting the bug. But cannot find it.
2018-05-09 05:13:15 -07:00
Kubernetes Submit Queue 3663dc757e
Merge pull request #63565 from roycaihw/bump-kube-openapi-dep
Automatic merge from submit-queue (batch tested with PRs 59034, 63565, 63533). 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>.

Bump kube-openapi dependency

picks: https://github.com/kubernetes/kube-openapi/pull/67
ref: https://github.com/kubernetes/kubernetes/issues/63494

**Release note**:

```release-note
NONE
```
2018-05-09 05:13:12 -07:00
hangaoshuai 61cb6df4d7 clean unused code in restmapper_test.go 2018-05-09 19:37:48 +08:00
Kubernetes Submit Queue f5f13cc5d1
Merge pull request #63385 from CaoShuFeng/customresource_status
Automatic merge from submit-queue (batch tested with PRs 63537, 63385). 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>.

[CustomResourceSubresources] fix status subresource

This change make the codes consistent with the document.
Fixes: https://github.com/kubernetes/kubernetes/issues/63359



**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**:
/assign @nikhita 
**Release note**:

```release-note
When updating /status subresource of a custom resource, only the value at the `.status` subpath for the update is considered.
```
2018-05-09 04:03:06 -07:00
Kubernetes Submit Queue 5d6997ad02
Merge pull request #63537 from fisherxu/returnErr
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>.

Return error when has no RequestInfo in handlerchain

**What this PR does / why we need it**:
we should return error when has no RequestInfo.
**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-05-09 03:37:33 -07:00
Dr. Stefan Schimanski 1558da15f1 apiextensions: allow "required" at root with status subresource 2018-05-09 10:25:44 +02:00
Jordan Liggitt d037b0893f
Run resource discovery in parallel 2018-05-08 23:24:34 -04:00
Haowei Cai 18fd392c13 generated 2018-05-08 17:36:05 -07:00
Michael Taufen c41cf55a2c explicit kubelet config key in Node.Spec.ConfigSource.ConfigMap
This makes the Kubelet config key in the ConfigMap an explicit part of
the API, so we can stop using magic key names.

As part of this change, we are retiring ConfigMapRef for ConfigMap.
2018-05-08 15:37:26 -07:00
David Eads c5445d3c56 simplify api registration 2018-05-08 18:33:50 -04:00
David Eads 7b4f97aca3 generated 2018-05-08 18:32:44 -04:00
Kubernetes Submit Queue a848537dbb
Merge pull request #63070 from hanxiaoshuai/fix0424
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>.

Refactor hard code in rest_test.go

**What this PR does / why we need it**:
Refactor hard code in rest_test.go
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-05-08 14:07:08 -07:00
Kubernetes Submit Queue c27335fe3e
Merge pull request #63507 from deads2k/cli-50-tidyup
Automatic merge from submit-queue (batch tested with PRs 63291, 63490, 60445, 63507, 63524). 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 client based restmappers to client-go

Moves the client-based restmappers to client-go where everyone who needs them can have access.


```release-note
the shortcuts which were moved server-side in at least 1.9 have been removed from being hardcoded in kubectl
```

@kubernetes/sig-cli-maintainers @kubernetes/sig-api-machinery-pr-reviews
2018-05-08 13:16:23 -07:00
Kubernetes Submit Queue 8203d35ea8
Merge pull request #60445 from oracle/for/upstream/master/60444
Automatic merge from submit-queue (batch tested with PRs 63291, 63490, 60445, 63507, 63524). 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>.

Fixes fake client generation for non-namespaced subresources

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

Fixes code generation for non-namespaced subresources fake clients. 

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

**Special notes for your reviewer**:

**Release note**:

```dev-release-note
Fixes fake client generation for non-namespaced subresources
```

/cc @mfojtik @liggitt 

I'm not sure the best way to add tests for this. Any pointers?
2018-05-08 13:16:19 -07:00
fisherxu 483ce1b1f3 should return error when has no RequestInfo 2018-05-08 23:09:18 +08:00
David Eads b96d03f023 generated 2018-05-08 08:11:57 -04:00
David Eads dd97a7bc59 move client based restmappers to client-go 2018-05-08 08:11:56 -04:00
Cao Shufeng e8ad2300d1 [CustomResourceSubresources] fix status subresource
This change make the codes consistent with the document.
Fixes: https://github.com/kubernetes/kubernetes/issues/63359
2018-05-08 18:34:17 +08:00
hangaoshuai de1f2c8310 Refactor hard code in rest_test.go 2018-05-08 15:42:06 +08:00
Kubernetes Submit Queue d9ba054901
Merge pull request #62443 from WanLinghao/crd_column_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>.

kubectl get CRD resources with --server-print=true column name error

**What this PR does / why we need it**:
Here's a bunch of kubectl get command execution and their outputs.
my-crd is the user-define CRD resource.
1. 
```
kubectl get pod --all-namespaces --server-print=true

NAMESPACE   NAME    READY   STATUS  RESTARTS   AGE
test-ns    test-pod  1/1    running     1      15m

```
2. 
```
kubectl get my-crd --all-namespaces --server-print=false

NAMESPACE   NAME      AGE
test-ns    test-crd    21m
```

3.
```
kubectl get my-crd --all-namespaces --server-print=true

NAMESPACE   NAME        CREATED AT
test-ns    test-crd         21m
```

Here's the problem
1. Example 3 isn't consistent with example 1 and 2
2. CREATED AT 21m doesn't make sense

This patch fix this.




**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-05-07 19:16:38 -07:00
Kubernetes Submit Queue f4b2452654
Merge pull request #63481 from hzxuzhonghu/rm-GOMAXPROCS
Automatic merge from submit-queue (batch tested with PRs 63460, 63481). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

remove redundant runtime.GOMAXPROCS

Since golang 1.5, `By default, Go programs run with GOMAXPROCS set to the number of cores available;`
If env `GOMAXPROCS `, it uses default `runtime.NumCPU()`. So set again is redundant.

cc @deads2k 

**Release note**:

```release-note
NONE
```
2018-05-07 06:48:07 -07:00
Kubernetes Submit Queue 52017b600b
Merge pull request #63460 from appscode/fix-admission
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>.

Don't panic if admission options is nil

Since [1.10 release](https://github.com/kubernetes/apiserver/blob/release-1.10/pkg/server/options/recommended.go#L43) admission options are enabled by default . This was not the case in 1.9 release. Admission plugins seem unnecessary for a webhook server. This change is needed so that disabling admission options don't cause panic.

```release-note
NONE
```

@deads2k @sttts 

ref: https://github.com/openshift/generic-admission-server/pull/14
2018-05-07 06:35:14 -07:00
Kubernetes Submit Queue 239d612983
Merge pull request #55476 from sttts/sttts-sample-apiserver-standalone
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: document how to run sample-apiserver standalone outside the cluster

This PR documents how to run the sample-apiserver outside of a cluster for development.

tl/dr: local client CA with `system:masters` group membership. Then authorization is skipped.
2018-05-07 05:36:55 -07:00
Kubernetes Submit Queue 0918155dc5
Merge pull request #62981 from atlassian/uint64-remove
Automatic merge from submit-queue (batch tested with PRs 61154, 62981). 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 incomplete uint64 support from JSON unmarshaling

**What this PR does / why we need it**:
Removes `uint64` support from JSON unmarshaling because:
- [unsigned types should not be used](https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#primitive-types);
- big numbers (53+ bits) cannot be properly round tripped via JSON in most languages.

**Which issue(s) this PR fixes**
Fixes #62769.

**Special notes for your reviewer**:
This is an alternative approach to https://github.com/kubernetes/kubernetes/pull/62775.

**Release note**:
```release-note
NONE
```
/kind bug
/sig api-machinery
/cc @sttts
2018-05-07 05:14:05 -07:00
Kubernetes Submit Queue 89542d9ec9
Merge pull request #61154 from hanxiaoshuai/bugfix0314
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>.

catch err when Watch testResource failed in func TestWatchCallNonNamespace

**What this PR does / why we need it**:
catch err when Watch testResource failed in func TestWatchCallNonNamespace
**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 #
[#61155](https://github.com/kubernetes/kubernetes/issues/61155)
**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-05-07 05:08:06 -07:00
WanLinghao c86eff176c when get CRD resources with --server-print=true
the output looks like:

	NAMESPACE   NAME   CREATED AT
	default     test       2m

	Notice that the column CREATED AT 2m makes no sense.
	The correct column name here should be AGE.
	Which keeps the same with the situation when --server-print=false

	This patch fix this.
2018-05-07 19:57:07 +08:00
xuzhonghu 2d1e3e630c remove redudant runtime.GOMAXPROCS 2018-05-07 16:08:05 +08:00
jeffchanjunwei 62ec43a19b fix annotation of APIGroupInfo 2018-05-06 21:47:51 +08:00
tamal bc04c091c3 Don't panic is admission options is nil 2018-05-05 11:59:28 -07:00
Haowei Cai 294e00c669 Add conversion to properly parse query parameter propagationPolicy 2018-05-04 13:42:28 -07:00
Kubernetes Submit Queue 068b7befa9
Merge pull request #63421 from liggitt/discover-completions
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>.

Cache preferred resources, use in kubectl resource name autocomplete

Fixes #63145
Fixes https://github.com/kubernetes/kubectl/issues/357
Alternative to #61928 

* starts to unify preferred resource logic on top of ServerGroups()/ServerResourcesForGroupVersion() methods
* allows indicating a cached list of resources is acceptable when calling `kubectl api-resources` (default is still to rediscover)
* uses `kubectl api-resources` in bash completion

```sh
$ kubectl get [TAB][TAB]
apiservices.apiregistration.k8s.io                            networkpolicies.extensions
certificatesigningrequests.certificates.k8s.io                networkpolicies.networking.k8s.io
clusterrolebindings.rbac.authorization.k8s.io                 nodes
clusterroles.rbac.authorization.k8s.io                        persistentvolumeclaims
componentstatuses                                             persistentvolumes
configmaps                                                    poddisruptionbudgets.policy
controllerrevisions.apps                                      pods
cronjobs.batch                                                podsecuritypolicies.extensions
customresourcedefinitions.apiextensions.k8s.io                podsecuritypolicies.policy
daemonsets.apps                                               podtemplates
daemonsets.extensions                                         replicasets.apps
deployments.apps                                              replicasets.extensions
deployments.extensions                                        replicationcontrollers
endpoints                                                     resourcequotas
events                                                        rolebindings.rbac.authorization.k8s.io
events.events.k8s.io                                          roles.rbac.authorization.k8s.io
horizontalpodautoscalers.autoscaling                          secrets
ingresses.extensions                                          serviceaccounts
initializerconfigurations.admissionregistration.k8s.io        services
jobs.batch                                                    statefulsets.apps
limitranges                                                   storageclasses.storage.k8s.io
mutatingwebhookconfigurations.admissionregistration.k8s.io    validatingwebhookconfigurations.admissionregistration.k8s.io
namespaces                                                    volumeattachments.storage.k8s.io
```


```release-note
NONE
```
2018-05-04 10:08:53 -07:00
Kubernetes Submit Queue bc56947e8d
Merge pull request #63405 from dims/update-to-latest-gophercloud-may-3-2018
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 to latest Gophercloud

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

periodic update to latest gophercloud. The changes are as follows:
6da026c32e...781450b3c4

**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-05-04 09:03:44 -07:00
Jordan Liggitt 74b7cec0c6
Make ServerPreferred[Namespaced]Resources logic and caches consistent 2018-05-04 00:06:39 -04:00
Kubernetes Submit Queue 89e6895e1c
Merge pull request #63346 from roycaihw/bump-kube-openapi
Automatic merge from submit-queue (batch tested with PRs 61455, 63346, 63130, 63404). 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>.

Bump kube-openapi dependency

**What this PR does / why we need it**:
Pick up https://github.com/kubernetes/kube-openapi/pull/64

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```

/sig api-machinery
/cc @mbohlool @liggitt
2018-05-03 14:24:07 -07:00
Kubernetes Submit Queue 4e3efbe364
Merge pull request #61455 from liggitt/uid-conflict
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Deprecate repair-malformed-updates flag, move object meta mutation into BeforeCreate

closes #23297

```release-note
NONE
```
2018-05-03 13:41:07 -07:00
Davanum Srinivas ddfcf1e193 Update to latest Gophercloud
6da026c32e...781450b3c4
2018-05-03 16:37:01 -04:00
Kubernetes Submit Queue ab9f64afa9
Merge pull request #63213 from filmil/oidc-dist-claims
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>.

Implements OIDC distributed claims.

Next step to enable this feature is to enable claim caching.

A distributed claim allows the OIDC provider to delegate a claim to a
separate URL.  Distributed claims are of the form as seen below, and are
defined in the OIDC Connect Core 1.0, section 5.6.2.

See: https://openid.net/specs/openid-connect-core-1_0.html#AggregatedDistributedClaims

Example claim:

```
{
  ... (other normal claims)...
  "_claim_names": {
    "groups": "src1"
  },
  "_claim_sources": {
    "src1": {
      "endpoint": "https://www.example.com",
      "access_token": "f005ba11"
    },
  },
}
```

Example response to a followup request to https://www.example.com is a
JWT-encoded claim token:

```
{
  "iss": "https://www.example.com",
  "aud": "my-client",
  "groups": ["team1", "team2"],
  "exp": 9876543210
}
```

Apart from the indirection, the distributed claim behaves exactly
the same as a standard claim.  For Kubernetes, this means that the
token must be verified using the same approach as for the original OIDC
token.  This requires the presence of "iss", "aud" and "exp" claims in
addition to "groups".

All existing OIDC options (e.g. groups prefix) apply.

Any claim can be made distributed, even though the "groups" claim is
the primary use case.

Allows groups to be a single string due to
https://github.com/kubernetes/kubernetes/issues/33290, even though
OIDC defines "groups" claim to be an array of strings. So, this will
be parsed correctly:

```
{
  "iss": "https://www.example.com",
  "aud": "my-client",
  "groups": "team1",
  "exp": 9876543210
}
```

Expects that distributed claims endpoints return JWT, per OIDC specs.

In case both a standard and a distributed claim with the same name
exist, standard claim wins.  The specs seem undecided about the correct
approach here.

Distributed claims are resolved serially.  This could be parallelized
for performance if needed.

Aggregated claims are silently skipped.  Support could be added if
needed.



**What this PR does / why we need it**: Makes it possible to retrieve many group memberships by offloading to a dedicated backend for groups resolution.

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

**Special notes for your reviewer**:
There are a few TODOs that seem better handled in separate commits.

**Release note**:

```release-note
Lays groundwork for OIDC distributed claims handling in the apiserver authentication token checker.

A distributed claim allows the OIDC provider to delegate a claim to a
separate URL.  Distributed claims are of the form as seen below, and are
defined in the OIDC Connect Core 1.0, section 5.6.2.

For details, see: 
http://openid.net/specs/openid-connect-core-1_0.html#AggregatedDistributedClaims
```
2018-05-02 20:41:51 -07:00
Kubernetes Submit Queue 692b34825f
Merge pull request #63375 from liggitt/diff-limit
Automatic merge from submit-queue (batch tested with PRs 62657, 63278, 62903, 63375). 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 diff output includes the portion that differs

When using ObjectReflectDiff() on objects with long string fields, the
80 character limit on diffs will commonly hide the actual difference
between the fields and require that the dev change which diff function
is used to see what the issue was. This defeats the purpose of printing
the diff between objects.
2018-05-02 20:13:13 -07:00
Kubernetes Submit Queue b5f61ac129
Merge pull request #62657 from matthyx/master
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 all script shebangs to use /usr/bin/env interpreter instead of /bin/interpreter

This is required to support systems where bash doesn't reside in /bin (such as NixOS, or the *BSD family) and allow users to specify a different interpreter version through $PATH manipulation.
https://www.cyberciti.biz/tips/finding-bash-perl-python-portably-using-env.html
```release-note
Use /usr/bin/env in all script shebangs to increase portability.
```
2018-05-02 19:44:32 -07:00
Jordan Liggitt f0eb3c2830
ensure diff output includes the portion that differs 2018-05-02 16:31:27 -04:00
Clayton Coleman 1002f80569
Decorator for Create should be called on out, not obj
obj is not what we return
2018-05-02 12:13:19 -04:00
Kubernetes Submit Queue a30f459160
Merge pull request #63335 from deads2k/api-15-mappingtype
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 restmapping to indicate fully qualified resource

The resource of a restmapping is logically fully qualified and we have that value when we construct it.  Update the return value so that callers don't have to synthentically create one.

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

```release-note
NONE
```
2018-05-01 18:54:00 -07:00
Haowei Cai 212814a0c6 Bump kube-openapi dependency 2018-05-01 18:37:58 -07:00
Filip Filmar dfb527843c Implements distributed OIDC claims.
A distributed claim allows the OIDC provider to delegate a claim to a
separate URL.  Distributed claims are of the form as seen below, and are
defined in the OIDC Connect Core 1.0, section 5.6.2.

See: https://openid.net/specs/openid-connect-core-1_0.html#AggregatedDistributedClaims

Example claim:

```
{
  ... (other normal claims)...
  "_claim_names": {
    "groups": "src1"
  },
  "_claim_sources": {
    "src1": {
      "endpoint": "https://www.example.com",
      "access_token": "f005ba11"
    },
  },
}
```

Example response to a followup request to https://www.example.com is a
JWT-encoded claim token:

```
{
  "iss": "https://www.example.com",
  "aud": "my-client",
  "groups": ["team1", "team2"],
  "exp": 9876543210
}
```

Apart from the indirection, the distributed claim behaves exactly
the same as a standard claim.  For Kubernetes, this means that the
token must be verified using the same approach as for the original OIDC
token.  This requires the presence of "iss", "aud" and "exp" claims in
addition to "groups".

All existing OIDC options (e.g. groups prefix) apply.

Any claim can be made distributed, even though the "groups" claim is
the primary use case.

Allows groups to be a single string due to
https://github.com/kubernetes/kubernetes/issues/33290, even though
OIDC defines "groups" claim to be an array of strings. So, this will
be parsed correctly:

```
{
  "iss": "https://www.example.com",
  "aud": "my-client",
  "groups": "team1",
  "exp": 9876543210
}
```

Expects that distributed claims endpoints return JWT, per OIDC specs.

In case both a standard and a distributed claim with the same name
exist, standard claim wins.  The specs seem undecided about the correct
approach here.

Distributed claims are resolved serially.  This could be parallelized
for performance if needed.

Aggregated claims are silently skipped.  Support could be added if
needed.
2018-05-01 17:12:34 -07:00
Kubernetes Submit Queue b251681e45
Merge pull request #62893 from hzxuzhonghu/mark-APIServiceSpec.CABundle-optional
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>.

mark APIServiceSpec.CABundle optional

xref: https://github.com/kubernetes/kubernetes/issues/60690#issuecomment-382842852
mark the caBundle field optional so openapi is accurate

**Release note**:

```release-note
NONE
```
2018-05-01 14:05:42 -07:00
David Eads 9a48066749 update restmapping to indicate fully qualified resource 2018-05-01 16:34:49 -04:00
Kubernetes Submit Queue dc7f074213
Merge pull request #63309 from deads2k/server-13-rootscopedkind
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 rootscopedkinds from groupmeta

builds on https://github.com/kubernetes/kubernetes/pull/63206

Since, a RESTMapping can only be determined based on a connection to a server, the only thing that needs to know the namespaced-ness of a resource is the code doing the registration.  Everything else is derived from that source of truth.  This removes the other dangling references and collapses down onto the existing namespaced-ness methods in the strategies backing the stores.

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

```release-note
NONE
```
2018-05-01 13:10:49 -07:00
Kubernetes Submit Queue ed4739b36b
Merge pull request #63330 from deads2k/api-13-sparse
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 test for sparse version encoding/decoding

This adds tests that make sure the sparse version encoding and encoding work as callers will expect, with the correct version being picked from the list.  I wrote two tests, one a theoretical test not dependent on any API and another practical test using cronjobs which are currently sparse in the registry.

@liggitt turns out that because we find exact matches, sparse versions ought to work out fine.
@smarterclayton I hate that the versioner matches on type.  I'll update that separately I think.


```release-note
NONE
```
2018-05-01 12:11:35 -07:00
David Eads 8ae62517da remove rootscopedkinds from groupmeta 2018-05-01 13:08:23 -04:00
Kubernetes Submit Queue f03f83a20a
Merge pull request #63206 from deads2k/api-11-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>.

remove incorrect static restmapper from type registry

A RESTMapping can only be determined by inspecting a server since discovery is the authoritative source of mapping decisions.  This removes a deceptive method from the type registry and makes the old logic available for existing tests in a separate, clearly labeled package.

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

```release-note
NONE
```
2018-05-01 08:10:37 -07:00
David Eads f9b32d762a add test for sparse version encoding/decoding 2018-05-01 09:34:06 -04:00
David Eads ef0d1ab819 remove incorrect static restmapper 2018-05-01 07:51:17 -04:00
David Eads 121b698492 add fake dynamic client 2018-04-30 08:54:30 -04:00
David Eads 5ff923c7f9 make dynamic client slightly easier to use 2018-04-30 08:54:30 -04:00
Kubernetes Submit Queue 55f17933f5
Merge pull request #60741 from zlabjp/optional-subjects
Automatic merge from submit-queue (batch tested with PRs 60890, 63244, 60741, 63254). 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>.

Indicate clusterrolebinding, rolebinding subjects are optional fields

**What this PR does / why we need it**: With this PR, clusterrolebinding and rolebinding subjects are marked optional instead of required. Currently we cannot create clusterrolebinding and rolebinding with subjects are empty using `kubectl create/apply/replace -f`.

```
$ kubectl create rolebinding test --clusterrole view
rolebinding "test" created
$ kubectl get rolebinding test -o yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  creationTimestamp: 2018-03-02T06:58:16Z
  name: test
  namespace: default
  resourceVersion: "5606612"
  selfLink: /apis/rbac.authorization.k8s.io/v1/namespaces/default/rolebindings/test
  uid: 155c5c29-1de7-11e8-9f6f-fa163ec89f2a
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: view
subjects: null
$ kubectl get rolebinding test -o yaml | kubectl replace -f -
error: error validating "STDIN": error validating data: ValidationError(RoleBinding): missing required field "subjects" in io.k8s.api.rbac.v1.RoleBinding; if you choose to ignore these errors, turn validation off with --validate=false
```

**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**: This is a same issue with https://github.com/kubernetes/kubernetes/issues/59403. /cc @liggitt 

**Release note**:

```release-note
NONE
```
2018-04-27 17:43:11 -07:00
Kubernetes Submit Queue c929ec153a
Merge pull request #63202 from deads2k/api-10-selflink
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 self linker from group info

The self-link is related to RESTStorage, not to the scheme/codec.  Also, no one every customized it.  This moves it to the single point of use and retains the override potential.

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

```release-note
NONE
```
2018-04-27 15:59:01 -07:00
Jordan Liggitt 7f840f4441
Deprecate repair-malformed-updates flag, move object meta mutation into BeforeCreate 2018-04-27 17:26:39 -04:00
Kubernetes Submit Queue a8a963c983
Merge pull request #63238 from CaoShuFeng/toCurl
Automatic merge from submit-queue (batch tested with PRs 63153, 63238). 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 curl header

partially reverts kubernetes/kubernetes#60925

such command cause a 406 status code from api-server
```
curl   -H "Accept: 'application/json;as=Table;v=v1beta1;g=meta.k8s.io, application/json'"
```

this works fine:
```
curl  -H "Accept: application/json;as=Table;v=v1beta1;g=meta.k8s.io, application/json"
```


**Release note**:
```
NONE
```
2018-04-27 13:23:05 -07:00
David Eads 22410d4b4c remove self linker from group info 2018-04-27 13:49:10 -04:00
Kubernetes Submit Queue 625bce3ff6
Merge pull request #63169 from smarterclayton/limit_dependencies
Automatic merge from submit-queue (batch tested with PRs 63251, 59166, 63250, 63180, 63169). 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>.

Break a generic package dependency to core/api/v1

It is not necessary for this package to depend on core/v1.
2018-04-27 10:45:21 -07:00
Kubernetes Submit Queue 7884cc5453
Merge pull request #63250 from deads2k/cli-39-typer
Automatic merge from submit-queue (batch tested with PRs 63251, 59166, 63250, 63180, 63169). 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>.

divide statically known typer from dynamically derived restmapper

The CLI factory conflated a statically known typer and a dynamically derived restmapper. This produced confusion and unnecessary indirection.  This pull separates dynamically known from statically known.

A future pull will continue the separation of in the builder to indicate the points of variability for clients, which should logically be limited to a negotiated serializer for decoding and an object typer.

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


```release-note
NONE
```
2018-04-27 10:45:13 -07:00
Kubernetes Submit Queue 6b9cf21d9f
Merge pull request #63203 from deads2k/api-07-versioninterface
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 versioning interface

Builds on prior restmapping/converter separation to completely remove the versioning interface which isn't needed.

intersection of @kubernetes/sig-api-machinery-pr-reviews and @kubernetes/sig-cli-maintainers  again

```release-note
NONE
```
2018-04-27 09:15:13 -07:00
Kubernetes Submit Queue b75d6464c8
Merge pull request #63189 from hzxuzhonghu/master
Automatic merge from submit-queue (batch tested with PRs 61804, 63189). 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>.

make use of simple dynamic client instead of deprecated client pool

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

Use simple dynamic client through all integration test.

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-04-27 08:44:07 -07:00
David Eads 5432ef5c45 divide statically known typer from dynamically derive restmapper 2018-04-27 11:15:05 -04:00
David Eads 6fbcbc994f remove unnecessarily flexibiliy to simplify the resource builder 2018-04-27 09:27:51 -04:00
Dr. Stefan Schimanski ad21a4aa37 apiserver: document how to run sample-apiserver standalone outside the cluster 2018-04-27 14:58:43 +02:00
David Eads e2fc5cf259 remove versioning interface 2018-04-27 07:56:42 -04:00
Cao Shufeng 084eb9b429 fix curl header 2018-04-27 15:56:03 +08:00
xuzhonghu 9e8ce9535d fix bug in dynamicResourceClient.UpdateStatus should encode 2018-04-27 14:07:11 +08:00
xuzhonghu 393324497f make use of simple dynamic client in test 2018-04-27 13:38:58 +08:00
Jordan Liggitt 2c1a689952
Collapse onto request scope convertor 2018-04-26 22:28:26 -04:00
Jordan Liggitt f6b08d6d76
Fix govet error 2018-04-26 22:16:27 -04:00
Kubernetes Submit Queue 8d1b6fa917
Merge pull request #63031 from jennybuckley/dedup-update-typer
Automatic merge from submit-queue (batch tested with PRs 62937, 63105, 63031, 63174). 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 unnecessary typer from create/update handlers

**What this PR does / why we need it**:
Refactoring to remove unnecessarily duplicated definition of an ObjectTyper for some of the handlers.
The patch handler also has an extra ObjectConvertor, but it is defined differently in both places so removing one would possibly have side effects.

```release-note
NONE
```

/sig api-machinery
2018-04-26 16:40:15 -07:00
Kubernetes Submit Queue 6625d353c7
Merge pull request #63105 from deads2k/api-06-mapper
Automatic merge from submit-queue (batch tested with PRs 62937, 63105, 63031, 63174). 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>.

rest mappings cannot logically be object converters

A `RESTMapping` in the general sense cannot be a `ObjectConverter` since the conversions are compiled, but the RESTMappings are discovered.   This starts isolating the bad assumptions into `kubectl` where they are used and removes the other bad `RESTMapping` use I found in the REST API installer that uses a mapping to determine scopes instead of using the metadata provided during API registration.

intersection of @kubernetes/sig-api-machinery-bugs and @kubernetes/sig-cli-maintainers 
@sttts @pwittrock @soltysh 

```release-note
NONE
```
2018-04-26 16:40:12 -07:00
Kubernetes Submit Queue a38a02792b
Merge pull request #62662 from wangzhen127/runtime-default
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>.

Change seccomp annotation from "docker/default" to "runtime/default"

**What this PR does / why we need it**:
This PR changes seccomp annotation from "docker/default" to "runtime/default", so that it is can be applied to all kinds of container runtimes. This PR is a followup of [#1963](https://github.com/kubernetes/community/pull/1963).

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-04-26 14:33:53 -07:00
Josh Horwitz 0f62a8cdda Fixes fake client generation for non-namespaced subresources 2018-04-26 14:58:45 -04:00
Kubernetes Submit Queue 6aad80cce3
Merge pull request #63146 from liggitt/remove-patch-retry
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>.

collapse patch conflict retry onto GuaranteedUpdate

xref https://github.com/kubernetes/kubernetes/issues/63104

This PR builds on https://github.com/kubernetes/kubernetes/pull/62868

1. When the incoming patch specified a resourceVersion that failed as a precondition, the patch handler would retry uselessly 5 times. This PR collapses onto GuaranteedUpdate, which immediately stops retrying in that case.

2. When the incoming patch did not specify a resourceVersion, and persisting to etcd contended with other etcd updates, the retry would try to detect patch conflicts with deltas from the first 'current object' retrieved from etcd and fail with a conflict error in that case. Given that the user did not provide any information about the starting version they expected their patch to apply to, this does not make sense, and results in arbitrary conflict errors, depending on when the patch was submitted relative to other changes made to the resource. This PR changes the patch application to be performed on the object retrieved from etcd identically on every attempt.

fixes #58017
SMP is no longer computed for CRD objects

fixes #42644
No special state is retained on the first attempt, so the patch handler correctly handles the cached storage optimistically trying with a cached object first

/assign @lavalamp

```release-note
fixed spurious "unable to find api field" errors patching custom resources
```
2018-04-26 10:55:27 -07:00
David Eads 6900f8856f rest mappings cannot logically be object converters 2018-04-26 12:47:25 -04:00
Kubernetes Submit Queue d4b678036f
Merge pull request #63200 from deads2k/api-09-duplicate
Automatic merge from submit-queue (batch tested with PRs 62911, 63200). 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 duplicating preferred version order 

`GroupMeta` includes two fields for a preferred groupVersion, `.GroupVersion` and `.GroupVersion[0]`.  This collapses onto the latter.

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

lots of ripples, but eliminate of duplication is good.
/assign @sttts 
/assign @cheftako 


```release-note
NONE
```
2018-04-26 09:43:06 -07:00
Kubernetes Submit Queue dd5f030b02
Merge pull request #63165 from deads2k/api-08-kubeapiversion
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 KUBE_API_VERSIONS

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

KUBE_API_VERSIONS is an attempt to control the available serialization of types. It pre-dates the idea that we'll have separate schemes, so it's not a thing that makes sense anymore.

Server-side we've had a very clear message about breaks in the logs for a year "KUBE_API_VERSIONS is only for testing. Things will break.".

Client-side it became progressively more broken as we moved to generic types for CRUD more than a year ago. What is registered doesn't matter when everything is unstructured.

We should remove this piece of legacy since it doesn't behave predictable server-side or client-side.

@smarterclayton @lavalamp
@kubernetes/sig-api-machinery-bugs 

```release-note
KUBE_API_VERSIONS is no longer respected.  It was used for testing, but runtime-config is the proper flag to set.
```
2018-04-26 08:22:36 -07:00
David Eads a9518acacd generated 2018-04-26 10:03:37 -04:00
David Eads a89291a5de stop duplicating preferred version order 2018-04-26 10:03:36 -04:00
Kubernetes Submit Queue b8ab2891b3
Merge pull request #63062 from hanxiaoshuai/cleanup0424
Automatic merge from submit-queue (batch tested with PRs 63009, 63062). 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>.

clean up unused code fakeRL in requestinfo_test.go

**What this PR does / why we need it**:
clean up unused code fakeRL in requestinfo_test.go
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-04-26 05:53:12 -07:00
Kubernetes Submit Queue b181af1c68
Merge pull request #63009 from mvladev/etcd-disable-automatic-metric-registration
Automatic merge from submit-queue (batch tested with PRs 63009, 63062). 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>.

Register Prometheus etcdmetrics only for apiserver

Removed automatic registration with `init` funciton and use `Register` function to register metrics for etcd storage only when requested.



**What this PR does / why we need it**: Prevents leaking etcd metrics to other k8s components

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-04-26 05:53:09 -07:00
David Eads a68c57155e remove KUBE_API_VERSIONS 2018-04-26 08:27:49 -04:00
Kubernetes Submit Queue 5fa25a9508
Merge pull request #63133 from hzxuzhonghu/remove-always-admit
Automatic merge from submit-queue (batch tested with PRs 63186, 63133). 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>.

eliminate alwaysAdmit admission in apiserver test

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

alwaysAdmit is of no meaning, previously if not specify an admission plugin, it will panic, but now since we add protection `if admit != nil`. So can safely remove it.

**Release note**:

```release-note
NONE
```
2018-04-26 04:50:13 -07:00
hangaoshuai ba20be9911 add checks validation MinRequestTimeout of ServerRunOptions 2018-04-26 16:02:31 +08:00
Mikhail Mazurskiy bbef0f6f9d
Remove incomplete uint64 support from JSON unmarshaling 2018-04-26 15:31:56 +10:00
Kubernetes Submit Queue cc845246e4
Merge pull request #63063 from feiskyer/azure-new-sdk
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>.

Upgrade Azure Go SDK to stable version

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

Kubernetes is using a beta version of Azure Go SDK now. If there are bugs in them, it's hard to upgrade because Azure Go SDK won't release new patches for pre-released SDK versions. We should upgrade Go SDK to stable version (e.g. v14.6.0)

Refer #62249

Refer Azure/azure-sdk-for-go#1586

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

**Special notes for your reviewer**:

This PR includes changes in #61972, but with a newer go-autorest version.

**Release note**:

```release-note
Upgrade Azure Go SDK to stable version (v14.6.0)
```
2018-04-25 22:20:50 -07:00
Kubernetes Submit Queue 9e52d14eb9
Merge pull request #62805 from awly/take-reviews
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 awly as reviewer in several subtrees

```release-note
NONE
```
2018-04-25 21:24:31 -07:00
Jordan Liggitt b526532c8a
Add tests for resourceVersion precondition failures on patch 2018-04-25 22:44:46 -04:00
Jordan Liggitt fbd6f38084
collapse patch conflict retry onto GuaranteedUpdate
builds on #62868

1. When the incoming patch specified a resourceVersion that failed as a precondition,
the patch handler would retry uselessly 5 times. This PR collapses onto GuaranteedUpdate,
which immediately stops retrying in that case.

2. When the incoming patch did not specify a resourceVersion, and persisting to etcd
contended with other etcd updates, the retry would try to detect patch conflicts with
deltas from the first 'current object' retrieved from etcd and fail with a conflict error
in that case. Given that the user did not provide any information about the starting version
they expected their patch to apply to, this does not make sense, and results in arbitrary
conflict errors, depending on when the patch was submitted relative to other changes made
to the resource. This PR changes the patch application to be performed on the object retrieved
from etcd identically on every attempt.

fixes #58017
SMP is no longer computed for CRD objects

fixes #42644
No special state is retained on the first attempt, so the patch handler correctly handles
the cached storage optimistically trying with a cached object first
2018-04-25 21:55:13 -04:00
Pengfei Ni 058b619040 Update vendors for client-go 2018-04-26 09:38:48 +08:00
Kubernetes Submit Queue 3dbcd1ddce
Merge pull request #63059 from ceshihao/upgrade_json_package_fix_base64_newline
Automatic merge from submit-queue (batch tested with PRs 59965, 59115, 63076, 63059). 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>.

Upgrade dep json-iterator/go to fix base64 decode bug

**What this PR does / why we need it**:
upgrade dep `json-iterator/go` to fix base64 decode bug #62742

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

**Special notes for your reviewer**:
Just upgrade `json-iterator/go` to latest which includes base64 decode fix https://github.com/json-iterator/go/pull/266
No other code changes

**Release note**:

```release-note
None
```
2018-04-25 17:07:18 -07:00
Clayton Coleman 847edc0e27
restclient should not depend on api/core/v1 2018-04-25 18:52:16 -04:00
Clayton Coleman aa9fd2bf11
client-go should not take a dependency on the v1 api lightly
These constants will never change, and tools/ should not be depending on
core/api/v1 (there is nothing v1 specific about them).
2018-04-25 18:52:16 -04:00
Kubernetes Submit Queue b942c53546
Merge pull request #62868 from lavalamp/refactor-patch
Automatic merge from submit-queue (batch tested with PRs 62432, 62868, 63040). 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 patch

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

Continue making patch handler readable.

**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-25 12:56:10 -07:00
Kubernetes Submit Queue 97287177ee
Merge pull request #63075 from deads2k/api-05-eliminate-indirection
Automatic merge from submit-queue (batch tested with PRs 62982, 63075, 63067, 62877, 63141). 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>.

eliminate indirection from type registration

Some years back there was a partial attempt to revamp api type registration, but the effort was never completed and this was before we started splitting schemes. With separate schemes, the idea of partial registration no longer makes sense.  This pull starts removing cruft from the registration process and pulls out a layer of indirection that isn't needed.

@kubernetes/sig-api-machinery-pr-reviews 
@lavalamp @cheftako @sttts @smarterclayton 

Rebase cost is fairly high, so I'd like to avoid this lingering.

/assign @sttts 
/assign @cheftako 

```release-note
NONE
```
2018-04-25 11:53:14 -07:00
ceshihao 3fde7d6844 runhack/update-staging-godeps.sh 2018-04-25 16:11:21 +00:00
Daniel Smith 349a99b80e Refactor the patch handler for readability
This is the combination of a series of changes which individually don't
make any behavioral changes. The original commits are preserved in my
own fork in the refactor-patch-complete branch, as when squashed this is
impossible to review.

This turned a big function with lots of parameters and closures into an
object with multiple functions, fewer closures and more well documented
state transitions.
2018-04-25 09:11:20 -07:00
Kubernetes Submit Queue 5d7569d664
Merge pull request #62913 from deads2k/client-04-dynamic
Automatic merge from submit-queue (batch tested with PRs 63137, 62913). 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>.

make a simple dynamic client that is easy to use

The dynamic client has annoyed me for the last time!  The existing one takes arguments at odd levels, requires lots of information to instantiate, does some weird pool thing, and uses unusual types.  This creates an interface like this:

```go

type DynamicInterface interface {
	ClusterResource(resource schema.GroupVersionResource) DynamicResourceInterface
	NamespacedResource(resource schema.GroupVersionResource, namespace string) DynamicResourceInterface
}

type DynamicResourceInterface interface {
	Create(obj *unstructured.Unstructured) (*unstructured.Unstructured, error)
	Update(obj *unstructured.Unstructured) (*unstructured.Unstructured, error)
	UpdateStatus(obj *unstructured.Unstructured) (*unstructured.Unstructured, error)
	Delete(name string, options *metav1.DeleteOptions) error
	DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error
	Get(name string, options metav1.GetOptions) (*unstructured.Unstructured, error)
	List(opts metav1.ListOptions) (*unstructured.UnstructuredList, error)
	Watch(opts metav1.ListOptions) (watch.Interface, error)
	Patch(name string, pt types.PatchType, data []byte, subresources ...string) (*unstructured.Unstructured, error)
}
```

You create it from just a `rest.Config`, no mapper, no path resolving func, no trying to set up codecs ahead of time, no unnecessary pool.  It just works.

I updated the namespace controller to use it and I updated the existing dynamic client to leverage it so that I get all their tests for "free".

@kubernetes/sig-api-machinery-pr-reviews 
@liggitt @smarterclayton @bparees @sttts @ironcladlou I know each of us has struggled with the dynamic client in our time.
@lavalamp @caesarxuchao This is vastly simplifying.  I'm eager to drop the old `ClientPool`.  client-go will technically have another incompatible semver this release.  I'm up for changing it in tree.


```release-note
client-go developers: the new dynamic client is easier to use and the old is deprecated, you must switch.
```
2018-04-25 08:50:09 -07:00
Kubernetes Submit Queue a53df4d905
Merge pull request #63086 from soltysh/discovery_timeout
Automatic merge from submit-queue (batch tested with PRs 63129, 63066, 60009, 63136, 63086). 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 discovery default timeout test

/assign @sttts 

**Release note**:
```release-note
NONE
```
2018-04-25 06:29:29 -07:00
David Eads e931158128 generated 2018-04-25 09:02:32 -04:00
David Eads 1a753659cf core v1 API requires autoscaling/v1 to serve the Scale endpoint 2018-04-25 09:02:31 -04:00
David Eads df50da3adc update code generator 2018-04-25 09:02:31 -04:00
David Eads e7fbbe0e3c eliminate indirection from type registration 2018-04-25 09:02:31 -04:00
David Eads 3632037e60 add easy to use dynamic client 2018-04-25 08:55:26 -04:00
xuzhonghu e1bcca681d remove useless alwaysAdmit in apiserver test 2018-04-25 16:37:08 +08:00
Martin Vladev 40cf788013 Register Prometheus etcdmetrics only for apiserver
Removed automatic registration with `init` funciton and use `Register` function
to register metrics for etcd storage only when requested.
2018-04-25 10:06:37 +03:00
hzxuzhonghu 271f942293 mark APIServiceSpec.CABundle optional 2018-04-25 11:25:28 +08:00
Cao Shufeng 4d20c38c33 avoid duplicate status in audit events
Fixes: https://github.com/kubernetes/kubernetes/issues/60108
2018-04-25 10:13:51 +08:00
Kubernetes Submit Queue 9baf337cf3
Merge pull request #63084 from mikedanese/ctx
Automatic merge from submit-queue (batch tested with PRs 59220, 62927, 63084, 63090, 62284). 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 request.Context with context.Context

Followup on https://github.com/kubernetes/kubernetes/pull/62810

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

```release-note
NONE
```
2018-04-24 19:01:17 -07:00