Commit Graph

941 Commits (12277a0ad47c14b4a244b019df29fe0387d29c50)

Author SHA1 Message Date
Jamie Hannaford 9440a68744 Use dedicated Unix User and Group ID types 2017-05-05 14:07:38 +02:00
Cao Shufeng 8b54081939 update the doc of function NewPathRecorderMux 2017-05-05 19:06:17 +08:00
Kubernetes Submit Queue 3f6be95f82 Merge pull request #45378 from mbohlool/c5
Automatic merge from submit-queue

Fix yet another bug in OpenAPI extension generation

A comment extension for a type is ignored if the type already has extensions (e.g. GVK).
2017-05-04 17:32:41 -07:00
mbohlool bcd0288e60 Fix yet another bug in OpenAPI extension generation 2017-05-04 13:34:40 -07:00
Kubernetes Submit Queue d22a9c2599 Merge pull request #45321 from caesarxuchao/remove-GetGVK
Automatic merge from submit-queue (batch tested with PRs 45362, 45159, 45321, 45238)

Remove redundent GetObjectKind() defined on types

Embedding TypeMeta is enough.
2017-05-04 13:25:05 -07:00
Chao Xu 5f5a70f65f generated clientset changes
propagate to client-go
update-bazel.sh
2017-05-04 11:30:51 -07:00
Chao Xu bbb94e42c1 remove registry from testing/fixture.go; update client-gen to not use
registry in the generated clients
2017-05-04 11:30:51 -07:00
Chao Xu 47b410f58b Remove redundent GetObjectKind() defined on top-level types
TypeMeta is embedded in all these types and TypeMeta has GetObjectKind()
method to implement the runtime.Object interface.
2017-05-04 10:31:58 -07:00
Kubernetes Submit Queue 82bc084297 Merge pull request #45169 from ncdc/lister-gen-typo
Automatic merge from submit-queue

Fix typo in lister-gen, regenerate

NamespaeLister -> NamespaceLister

@stevekuznetsov, just for you 😄
2017-05-04 07:24:01 -07:00
Kubernetes Submit Queue 1bfef70836 Merge pull request #44466 from deads2k/server-22-custom-mux
Automatic merge from submit-queue

use our own serve mux that directs how we want

alternative to https://github.com/kubernetes/kubernetes/pull/44405

I really wanted to avoid writing my own, but the gorilla mux works via redirect, which would be a change.  This does exact pattern matches only unless someone explicitly requests a prefix match.

@liggitt happier?
2017-05-04 05:43:53 -07:00
Kubernetes Submit Queue e1423acc50 Merge pull request #45056 from ericchiang/update-oauth2
Automatic merge from submit-queue

bump(golang.org/x/oauth2): a6bd8cefa1811bd24b86f8902872e4e8225f74c4

As I tackle https://github.com/kubernetes/kubernetes/issues/42654 kubectl's OpenID Connect plugin will start using golang.org/x/oauth2 for refreshing, instead of go-oidc's own hand rolled oauth2 implementation. In preparation, update golang.org/x/oauth2 to include 7374b3f1ec which fixes refreshing with Okta.

We also somehow removed the dependency on `google.golang.org/appengine`. Maybe 8cf58155e4?

cc @kubernetes/sig-auth-pr-reviews
2017-05-03 19:34:14 -07:00
Chao Xu c984468678 control visibility client-go/pkg/api 2017-05-03 14:04:36 -07:00
deads2k c837c7fb1a use our own serve mux that directs how we want 2017-05-03 16:21:45 -04:00
Kubernetes Submit Queue 80f26fa8a8 Merge pull request #44523 from caesarxuchao/remove-client-go-api-scheme
Automatic merge from submit-queue

Remove imports of k8s.io/client-go/pkg/api

k8s.io/client-go/pkg/api will be eliminated by #44784, so we need to remove all imports of it.

This PR is large, but mostly simple changes, like:
* using constants defined in the v1 package instead of those in the internal package 
* using k8s.io/client-go/kubernetes/scheme.Codecs/Schemes instead of those in k8s.io/client-go/pkg/api
* using `v1.SchemeGroupVersion` instead of `api.Registry.GroupOrDie(api.GroupName).GroupVersion` in tests
* importing `k8s.io/kubernetes/pkg/api` instead of `k8s.io/client-go/pkg/api` if possible

With this PR https://github.com/kubernetes/kubernetes/pull/45159, the only remaining imports of `k8s.io/client-go/pkg/api` are from k8s.io/metrics.
``` bash
$ git grep "\"k8s.io/client-go/pkg/api\"" | grep -v "staging/src/k8s.io/client-go/pkg/api"
staging/src/k8s.io/metrics/pkg/apis/custom_metrics/install/install.go:25:	"k8s.io/client-go/pkg/api"
Binary file staging/src/k8s.io/metrics/pkg/apis/custom_metrics/types.generated.go matches
staging/src/k8s.io/metrics/pkg/apis/custom_metrics/types.go:22:	"k8s.io/client-go/pkg/api"
staging/src/k8s.io/metrics/pkg/apis/metrics/install/install.go:26:	"k8s.io/client-go/pkg/api"
staging/src/k8s.io/metrics/pkg/apis/metrics/types.go:21:	"k8s.io/client-go/pkg/api"
Binary file staging/src/k8s.io/metrics/pkg/apis/metrics/v1alpha1/zz_generated.conversion.go matches
Binary file staging/src/k8s.io/metrics/pkg/apis/metrics/zz_generated.deepcopy.go matches
staging/src/k8s.io/metrics/pkg/client/clientset_generated/clientset/fake/clientset_generated.go:24:	"k8s.io/client-go/pkg/api"
staging/src/k8s.io/metrics/pkg/client/custom_metrics/client.go:26:	"k8s.io/client-go/pkg/api"
staging/src/k8s.io/metrics/pkg/client/custom_metrics/fake/fake_client.go:24:	"k8s.io/client-go/pkg/api"
```
2017-05-03 10:46:34 -07:00
Kubernetes Submit Queue df8551acd2 Merge pull request #45115 from deads2k/tpr-07-types
Automatic merge from submit-queue (batch tested with PRs 45272, 45115)

initial types for TPRs

This pull starts creating the types described by https://github.com/kubernetes/community/blob/master/contributors/design-proposals/thirdpartyresources.md .  In the initial pull different names were suggested.  I've started this pull with `CustomResource.apiextensions.k8s.io`.

The structure begins as a separate API server to facilitate rapid prototyping and experimentation, but the end result will be added to the end of the `kube-apiserver` chain as described in https://github.com/kubernetes/community/blob/master/sig-api-machinery/api-extensions-position-statement.md .

Because it is separate to start (not included in any default server), I don't think we need a perfect name, but I'd like to be close.

@kubernetes/sig-api-machinery-misc @enisoc @smarterclayton @erictune
2017-05-03 05:36:59 -07:00
Dr. Stefan Schimanski b0b711119b apimachinery: rename meta.{ -> UnsafeGuess}KindToResource 2017-05-03 09:49:02 +02:00
Chao Xu d978f22e04 remove references to client-go/pkg/api 2017-05-02 17:16:06 -07:00
Kubernetes Submit Queue 72a469f3ac Merge pull request #40544 from henriquetruta/broken-podspec-link
Automatic merge from submit-queue

Fixes broken link in PodSpec

The PodSpec reference to NodeSelector misses
the `.md` extension in the file.



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

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

**Special notes for your reviewer**:

**Release note**:

```release-note
```
2017-05-02 12:45:48 -07:00
Kubernetes Submit Queue e10c59af41 Merge pull request #43003 from deads2k/server-05-discovery
Automatic merge from submit-queue (batch tested with PRs 45227, 43003, 45231)

separate discovery from the apiserver

This decouples the API discovery handlers from the core API server code.  It separates the code into a new package and clarifies interfaces with existing TPR code.

@kubernetes/sig-api-machinery-pr-reviews
2017-05-02 11:24:53 -07:00
deads2k 641b83877a remove bearer token from headers after we consume it 2017-05-02 14:11:23 -04:00
Kubernetes Submit Queue 2689f033a8 Merge pull request #45222 from sttts/sttts-cut-off-endpoints-from-client-go
Automatic merge from submit-queue (batch tested with PRs 45100, 45152, 42513, 44796, 45222)

apiserver: split endpoint tests from client-go

Use the example apigroup and create its own scheme.

Fixes https://github.com/kubernetes/kubernetes/issues/45209.
2017-05-02 10:35:14 -07:00
Henrique Truta 4a487cbb11 Fixes broken link in PodSpec
The PodSpec reference to NodeSelector misses
 the .md extension in the file.
2017-05-02 13:33:49 -03:00
deads2k e099f5eee6 separate discovery from the apiserver 2017-05-02 08:50:43 -04:00
deads2k 6a74988f96 image and resources for manual testing 2017-05-02 08:49:21 -04:00
deads2k c7e68a27be create apiserver for extensions 2017-05-02 08:49:20 -04:00
deads2k 72eef13e3e generated 2017-05-02 08:49:20 -04:00
deads2k a0b6241159 types 2017-05-02 08:43:34 -04:00
deads2k ed27887ad2 wire new staging repo 2017-05-02 08:43:31 -04:00
Dr. Stefan Schimanski 67ca42b2d7 apiserver: split endpoint tests from client-go 2017-05-02 12:03:58 +02:00
Kubernetes Submit Queue cb27476153 Merge pull request #45180 from caesarxuchao/move-metrics-to-staging
Automatic merge from submit-queue (batch tested with PRs 45077, 45180, 34727, 45079, 45177)

Move k8s.io/metrics to staging/

This is to break the cyclic dependency in our code base: kubernetes depends on k8s.io/metrics, which depends on kubernetes/staging/client-go.

@DirectXMan12 i actually moved it to staging because we will need the flexibility to update metrics code directly to do many planned refactors, so the copy of metrics in kubernetes has to be the source of truth.

client-gen is not enabled for the code yet, we can enable it after you port your changes to client-gen.

`make generated_files` is enabled for metrics.
2017-05-01 18:55:11 -07:00
Chao Xu 3294200dc8 move metrics to staging 2017-05-01 16:43:50 -07:00
Andy Goldstein 11e4f149d9 Fix typo in lister-gen, regenerate
NamespaeLister -> NamespaceLister
2017-05-01 12:18:45 -04:00
deads2k 0da5be47cf prevent panic on setting nil deletion timestamp 2017-05-01 11:11:41 -04:00
Ricky Pai a76ada8d5a generated files 2017-04-28 22:55:47 -07:00
Kubernetes Submit Queue 55f802b72a Merge pull request #44196 from xiangpengzhao/cmd-cleanup
Automatic merge from submit-queue

Delete "hard-coded" default value in flags usage.

**What this PR does / why we need it**:
Some flags of kubernetes components have "hard-coded" default values in their usage info. In fact, [pflag pkg](https://github.com/kubernetes/kubernetes/blob/master/vendor/github.com/spf13/pflag/flag.go#L602-L608) has already added a string `(default value)` automatically in the usage info if the flag is initialized. Then we don't need to hard-code the default value in usage info. After this PR, if we want to update the default value of a flag, we only need to update the flag where it is initialized. `pflag` will update the usage info for us. This will avoid inconsistency.

For example:
Before
```
kubelet -h
...
--node-status-update-frequency duration                   Specifies how often kubelet posts node status to master. Note: be cautious when changing the constant, it must work with nodeMonitorGracePeriod in nodecontroller. Default: 10s (default 10s)
...
```

After
```
kubelet -h
...
--node-status-update-frequency duration                   Specifies how often kubelet posts node status to master. Note: be cautious when changing the constant, it must work with nodeMonitorGracePeriod in nodecontroller. (default 10s)
...
```

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

**Special notes for your reviewer**:
This PR doesn't delete some "hard-coded" default values because they are not explicitly initialized. We still need to hard-code them to give users friendly info.

```
--allow-privileged                                        If true, allow containers to request privileged mode. [default=false]
```

**Release note**:

```release-note
None
```
2017-04-28 21:28:09 -07:00
Kubernetes Submit Queue ce01882e32 Merge pull request #43301 from deads2k/agg-27-add-conditions
Automatic merge from submit-queue (batch tested with PRs 44044, 44766, 44930, 45109, 43301)

add APIService conditions

Adds conditions to the APIServiceStatus struct and fixes up generators that appear to have slipped.

The first condition is "ServiceAvailable" which will provide the status currently derived in the discovery handler that decides about whether to expose the version in discovery.

@kubernetes/sig-api-machinery-pr-reviews @liggitt @ncdc
2017-04-28 17:49:13 -07:00
Eric Chiang 9fc727cf44 staging: run ./hack/update-staging-client-go.sh 2017-04-28 13:51:59 -07:00
Kubernetes Submit Queue 90d5fbca94 Merge pull request #44961 from mikedanese/fix-clone
Automatic merge from submit-queue (batch tested with PRs 45033, 44961, 45021, 45097, 44938)

replace CloneTLSConfig() with (*tls.Config).Clone()
2017-04-28 13:16:40 -07:00
Kubernetes Submit Queue d4ece0abc3 Merge pull request #37499 from fabianofranz/kubectl_plugins
Automatic merge from submit-queue

kubectl binary plugins

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

Introduces the ability to extend `kubectl` by adding third-party plugins that will be exposed through `kubectl`.

Plugins are executable commands written in any language. To be included as a plugin, a binary or script file has to

1. be located under one of the supported plugin path locations:
1.1 `~/.kubectl/plugins` dir
1.2. one or more directory set in the `KUBECTL_PLUGINS_PATH` env var
1.3. the `kubectl/plugins` dir under one or more directory set in the `XDG_DATA_DIRS` env var, which defaults to `/usr/local/share:/usr/share`
2. in any of the plugin path above, have a subfolder with the plugin file(s)
3. in the subfolder, contain at least a `plugin.yaml` file that describes the plugin

Example:

```
$ cat ~/.kube/plugins/myplugin/plugin.yaml
name: "myplugin"
shortDesc: "My plugin's short description"
command: "echo Hello plugins!"

$ kubectl myplugin
Hello plugins!
```

~~In case the plugin declares `tunnel: true`, the plugin engine will pass the `KUBECTL_PLUGIN_API_HOST` env var when calling the plugin binary. Plugins can then access the Kube REST API in "http://$KUBECTL_PLUGIN_API_HOST/api" using the same context currently in use by `kubectl`.~~

Test plugins are provided in `pkg/kubectl/plugins/examples`. Just copy (or symlink) the files to `~/.kube/plugins` to test.

**Which issue this PR fixes**:

Related to the discussions in the proposal document: https://github.com/kubernetes/kubernetes/pull/30086 and https://github.com/kubernetes/community/pull/122.

**Release note**:
```release-note
Introduces the ability to extend kubectl by adding third-party plugins. Developer preview, please refer to the documentation for instructions about how to use it.
```
2017-04-28 12:23:59 -07:00
Kubernetes Submit Queue 9fbefe3b97 Merge pull request #44350 from deads2k/server-17-watch
Automatic merge from submit-queue (batch tested with PRs 44868, 44350)

build external watch event so simple encoders can encode

`kube-apiserver` clients require a specific serialization of `watch.Event` to function properly.  There is no reason to allow flexibility of serialization at this point since no client would able to understand a different encoding.

I found this which trying to use a simple, unstructured json encoder and the clients kept choking on watches because it serialized without the proper json tags.

@kubernetes/sig-api-machinery-pr-reviews
2017-04-28 11:41:34 -07:00
Kubernetes Submit Queue 2315008ea6 Merge pull request #44489 from CaoShuFeng/SelfLinkPathPrefix
Automatic merge from submit-queue

Fix PathPrefix for subresources

before this change:
$ curl -s http://172.16.116.128:8080/api/v1/nodes/kubenet-02/status | grep selfLink
    "selfLink": "/api/v1/nodes/{name}/status/kubenet-02/status",
after this change:
$ curl -s http://172.16.116.128:8080/api/v1/nodes/kubenet-02/status | grep selfLink
    "selfLink": "/api/v1/nodes/kubenet-02/status",

related to:
#44462

**Release note**:

```NONE
```
2017-04-28 10:50:09 -07:00
deads2k afc5ae1539 generated 2017-04-28 11:28:37 -04:00
deads2k b5f0e3d07e add APIService status conditions 2017-04-28 10:47:29 -04:00
Kubernetes Submit Queue 8787b13d75 Merge pull request #43922 from cezarsa/spdy-fix
Automatic merge from submit-queue

prevent corrupted spdy stream after hijacking connection

This PR fixes corner case in spdy stream code where some bytes would never arrive at the server.

Reading directly from a hijacked connection isn't safe because some data may have already been read by the server before `Hijack` was called. To ensure all data will be received it's safer to read from the returned `bufio.Reader`. This problem seem to happen more frequently when using Go 1.8.
This is described in https://golang.org/pkg/net/http/#Hijacker:

> // The returned bufio.Reader may contain unprocessed buffered
   // data from the client.

I came across this while debugging a flaky test that used code from the `k8s.io/apimachinery/pkg/util/httpstream/spdy` package. After filling the code with debug logs and long hours running the tests in loop in the hope of catching the error I finally caught something weird.

The first word on the first spdy frame [read by the server here](b625085230/vendor/github.com/docker/spdystream/spdy/read.go (L148)) had the value `0x03000100`. See, the first frame to arrive on the server was supposed to be a control frame indicating the creation of a new stream, but all control frames need the high-order bit set to 1, which was not the case here, so the saver mistakenly assumed this was a data frame and the stream would never be created. The correct value for the first word of a SYN_STREAM frame was supposed to be `0x80030001` and this lead me on the path of finding who had consumed the first 1 byte prior to the frame reader being called and finally finding the problem with the Hijack call.

I added a new test to try stressing this condition and ensuring that this bug doesn't happen anymore. However, it's quite ugly as it loops 1000 times creating streams on servers to increase the chances of this bug happening. So, I'm not sure whether it's worth it to keep this test or if I should remove it from the PR. Please let me know what you guys think and I'll be happy to update this.

Fixes #45093 #45089 #45078 #45075 #45072 #45066 #45023
2017-04-28 07:40:03 -07:00
Fabiano Franz 2b178ad608 Basic support for kubectl plugins 2017-04-28 01:34:07 -03:00
Mike Danese 6c6dbec1e2 replace CloneTLSConfig() with (*tls.Config).Clone() 2017-04-27 19:51:36 -07:00
Kubernetes Submit Queue b2d714a7ca Merge pull request #44888 from caesarxuchao/clean-deepcopy-init
Automatic merge from submit-queue

Prepare for move zz_generated_deepcopy.go to k8s.io/api

This is in preparation to move deep copies to with the types to the types repo (see https://github.com/kubernetes/gengo/pull/47#issuecomment-296855818). The init() function is referring the `SchemeBuilder` defined in the register.go in the same packge, so we need to revert the dependency.

This PR depends on https://github.com/kubernetes/gengo/pull/49, otherwise verification will fail.
2017-04-27 18:48:28 -07:00
Kubernetes Submit Queue 8efb5c9957 Merge pull request #44983 from caesarxuchao/easy-remove-client-go-api-scheme
Automatic merge from submit-queue (batch tested with PRs 45052, 44983, 41254)

Non-controversial part of #44523

For easier review of #44523, i extracted the non-controversial part out to this PR.
2017-04-27 17:14:04 -07:00
Chao Xu d0b94538b9 make it possible to move SchemeBuilder with zz_generated.deepcopy.go 2017-04-27 16:57:29 -07:00
Kubernetes Submit Queue 14a557b1a2 Merge pull request #44346 from mikedanese/build-static
Automatic merge from submit-queue (batch tested with PRs 41106, 44346, 44929, 44979, 45027)

bazel: statically link dockerized components
2017-04-27 12:11:00 -07:00
Chao Xu 958903509c bazel 2017-04-27 09:41:53 -07:00
Chao Xu 3fa7b7824a easy changes 2017-04-27 09:41:53 -07:00
Kubernetes Submit Queue 2e7cc0222d Merge pull request #44935 from yifan-gu/fix_poll
Automatic merge from submit-queue (batch tested with PRs 44940, 44974, 44935)

apimachinery/pkg/util/wait: Fix potential goroutine leak in pollInternal().

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

Without the change, the wait function wouldn't exit until the timeout
happens, so if the timeout is set to a big value and the Poll() is run
inside a loop, then the total goroutines will increase indefinitely.

This PR fixes the issue by closing the stop channel to tell the wait function
to exit immediately if condition is true or any error happens.
2017-04-26 20:34:14 -07:00
Kubernetes Submit Queue c446132a97 Merge pull request #44974 from caesarxuchao/remove-client-go-api-listers
Automatic merge from submit-queue (batch tested with PRs 44940, 44974, 44935)

Remove import of internal api package in generated external-versioned listers

Follow up of https://github.com/kubernetes/kubernetes/pull/44523

One line change in cmd/libs/go2idl/lister-gen/generators/lister.go, and simple changes in pkg/apis/autoscaling/v2alpha1/register.go, other changes are generated.

The internal api package will be eliminated from client-go, so these imports should be removed. Also, it's more correct to report the versioned resource in the error.
2017-04-26 20:34:13 -07:00
Kubernetes Submit Queue 904b020756 Merge pull request #43469 from enisoc/has-conflicts
Automatic merge from submit-queue

Fix mergepatch.HasConflicts().

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

This fixes some false negatives:

* If a map had multiple entries, only the first was checked.
* If a list had multiple entries, only the first was checked.

**Which issue this PR fixes**:

**Special notes for your reviewer**:

**Release note**:
```release-note
NONE
```
2017-04-26 18:32:33 -07:00
Kubernetes Submit Queue 433aec11c8 Merge pull request #44531 from pwittrock/kubectl-openapi
Automatic merge from submit-queue

OpenAPI support for kubectl

Support for openapi spec in kubectl.

Includes:
- downloading and caching openapi spec to a local file
- parsing openapi spec into binary serializable datastructures (10x faster load times 600ms -> 40ms)
- caching parsed openapi spec in memory for each command

```release-note
NONE
```
2017-04-26 16:59:17 -07:00
Chao Xu ee61ffb4b1 bazel 2017-04-26 14:41:10 -07:00
Chao Xu 0bac9b6aaa update list-gen to not import internal package in external listers 2017-04-26 14:41:09 -07:00
Andy Goldstein fc2128c8d8 Update bazel 2017-04-26 09:45:19 -04:00
Andy Goldstein 715d5d9c91 Add redirect support to SpdyRoundTripper
Add support for following redirects to the SpdyRoundTripper. This is
necessary for clients using it directly (e.g. the apiserver talking
directly to the kubelet) because the CRI streaming server issues a
redirect for streaming requests.

Also extract common logic for following redirects.
2017-04-26 09:45:19 -04:00
Cao Shufeng dde1221839 Fix PathPrefix for subresources 2017-04-26 14:51:19 +08:00
Kubernetes Submit Queue d03ca66367 Merge pull request #41636 from luxas/bump_go_18
Automatic merge from submit-queue (batch tested with PRs 41287, 41636, 44881, 44826)

Bump to go1.8 and remove the edge GOROOT

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

Bumps to go1.8; we get:
 - performance improvements
 - build time improvements
 - the possibility to remove the hacky edge-GOROOT for arm and ppc64le that must use go1.8
 - all other awesome features that are included in go1.8: https://golang.org/doc/go1.8

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

**Special notes for your reviewer**:

@ixdy Please push the image ASAP so we can see if this passes all tests

**Release note**:

```release-note
Upgrade go version to v1.8
```
cc @ixdy @bradfitz @jessfraz @wojtek-t @timothysc @spxtr @thockin @smarterclayton @bprashanth @gmarek
2017-04-25 17:56:40 -07:00
Kubernetes Submit Queue fd3171b3a8 Merge pull request #41287 from whitlockjc/webhook-tests
Automatic merge from submit-queue (batch tested with PRs 41287, 41636, 44881, 44826)

apiserver: add pkg/util/webhook tests

This commit adds tests for pkg/util/webhooks.  The purpose of this was not only for better code coverage but also to alleviate the need for consumers to write their own tests for core functionality.

**Reasoning**

While working on the generic webhook admission plugin for https://github.com/kubernetes/community/pull/132, I found out that there are no tests for `staging/k8s.io/apiserver/pkg/util/webhook` and I also noticed that various places in the k8s sources were also replicating the same core tests that could/should be handled in `staging/k8s.io/apiserver/pkg/util/webhook`:

* `staging/src/k8s.io/apiserver/plugin/pkg/authorizer/webhook/webhook_test.go`
* `staging/src/k8s.io/apiserver/plugin/pkg/authenticator/token/webhook/webhook_test.go`
* `plugin/pkg/admission/imagepolicy/admission_test.go`
* _possibly more..._

That's what this PR does, adds tests for `staging/k8s.io/apiserver/pkg/util/webhook` so that consumers no longer have to worry about testing client configuration issues, TLS issues, etc. just to use `staging/k8s.io/apiserver/pkg/util/webhook`.

cc @cjcullen
2017-04-25 17:56:38 -07:00
Yifan Gu 3d0391864e apimachinery/pkg/util/wait: Fix potential goroutine leak in pollInternal().
Without the change, the wait function wouldn't exit until the timeout
happens, so if the timeout is set to a big value and the Poll() is run
inside a loop, then the total goroutines will increase indefinitely.

This PR fix the issue by closing the stop channel to tell the wait function
to exit immediately if condition is true or any error happens.
2017-04-25 17:24:40 -07:00
Solly Ross b6256e1f3f OWNERS: add directxman12 to pkg/apis/autoscaling
Added directxman12 (current SIG lead of SIG-autoscaling) as a reviewer
for pkg/apis/autoscaling.
2017-04-25 17:43:42 -04:00
Lucas Käldström 50af2e84ab
Update the staging directory 2017-04-26 00:32:00 +03:00
Lucas Käldström f32e6d8a89
Update protobuf 2017-04-25 23:50:31 +03:00
Kubernetes Submit Queue e1adcc2367 Merge pull request #44583 from mikedanese/go1.8
Automatic merge from submit-queue

bump bazel build to go1.8.1 and remove invalid unit tests

part of https://github.com/kubernetes/kubernetes/issues/38228

I firmly believe that unit tests that check error strings are incorrect unit tests. If we care about what type of error is returned, we need to use public error types. Anywhere we are using generic errors, we don't care other then that we saw an error.
2017-04-25 13:32:28 -07:00
Kubernetes Submit Queue f4eed2477d Merge pull request #44491 from NickrenREN/volume-MountOptionAnnotation
Automatic merge from submit-queue (batch tested with PRs 44601, 44842, 44893, 44491, 44588)

Define const annotation variable once

We do not need to define the const annotation var twice in pkg/volume and pkg/volume/validation


**Release note**:
```release-note
NONE
```
2017-04-25 12:51:39 -07:00
Mike Danese e48a4f0af7 fix various bad tests 2017-04-25 11:23:33 -07:00
Phillip Wittrock 21e239fb82 kubectl OpenAPI bazel updates 2017-04-25 10:45:50 -07:00
Phillip Wittrock 212c2a3a72 kubectl OpenAPI support 2017-04-25 10:45:49 -07:00
Phillip Wittrock 70704196be kubectl OpenAPI godeps updates 2017-04-25 10:44:56 -07:00
Kubernetes Submit Queue cd380b580b Merge pull request #44462 from deads2k/server-21-selflink
Automatic merge from submit-queue (batch tested with PRs 42477, 44462)

fix cluster scoped self-link

Might fix #37622, definitely fixes the cluster-scoped resource problem.  Looks like it was just a typo when compared against  https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apiserver/pkg/endpoints/installer.go#L451

@adohe @DirectXMan12
2017-04-25 10:25:46 -07:00
Kubernetes Submit Queue 1fd19f7fa2 Merge pull request #42477 from jsafrane/v1-2-new-api
Automatic merge from submit-queue (batch tested with PRs 42477, 44462)

Use storage.v1 instead of v1beta1

storage.v1beta1 was used to work around GKE which did not expose v1. Now that GKE is updated, we can switch everything to v1.

This is simple sed v1beta1 -> v1 + enabled a new test + changed preference of exposed interfaces in `storage/install/install.go`.

@msau42, PTAL and let me know when GKE is updated with storage v1 API and this PR can be actually merged.

@kubernetes/sig-storage-pr-reviews 

```release-note
NONE
```
2017-04-25 10:25:44 -07:00
deads2k 5746d876e3 fix cluster scoped self-link 2017-04-25 11:23:18 -04:00
Jan Safranek cde2746821 Regenerate everything 2017-04-25 15:34:46 +02:00
Liam White 0bdfb7ae13 Increase code coverage for pkg/api/resource
Signed-off-by: Liam White <liamwhite@uk.ibm.com>
2017-04-25 08:12:11 +01:00
Kubernetes Submit Queue c3ec845ab6 Merge pull request #44862 from liggitt/icc-namespace-override
Automatic merge from submit-queue

Stop treating in-cluster-config namespace as an override

Fixes #44835

The namespace of an in-cluster config should behave like the namespace specified in a kubeconfig file... it should be used as the default namespace, but be able to be overridden by namespaces specified in yaml files passed to `kubectl create -f`.

```release-note
Restored the ability of kubectl running inside a pod to consume resource files specifying a different namespace than the one the pod is running in.
```
2017-04-24 19:22:42 -07:00
Jeremy Whitlock d15dba7e8b apiserver: add pkg/util/webhook tests
This commit adds tests for pkg/util/webhooks.  The purpose of this was
not only for better code coverage but also to alleviate the need for
consumers to write their own tests for core functionality.
2017-04-24 16:13:17 -06:00
Kubernetes Submit Queue a9454baba4 Merge pull request #44788 from enisoc/patch-numeric
Automatic merge from submit-queue

PATCH: Fix erroneous meaningful conflict for numeric values.

The wrong json package was used, resulting in patches being unmarshaled with numbers as float64 rather than int64. This in turn confused `HasConflicts()` which expects numeric types to match.

The end result was false positives of meaningful conflicts, such as:

```
there is a meaningful conflict (firstResourceVersion: "8517", currentResourceVersion: "8519"):
 diff1={"metadata":{"resourceVersion":"8519"},"spec":{"replicas":0},"status":"conditions":null,"fullyLabeledReplicas":null,"replicas":0}}
, diff2={"spec":{"replicas":0}}
```

This is branched from a discussion on https://github.com/kubernetes/kubernetes/pull/43469.

```release-note
Fix false positive "meaningful conflict" detection for strategic merge patch with integer values.
```
2017-04-24 12:11:29 -07:00
Jordan Liggitt 1305559abb
Stop treating in-cluster-config namespace as an override 2017-04-24 14:33:02 -04:00
Kubernetes Submit Queue 7e42d3848e Merge pull request #44492 from CaoShuFeng/namer
Automatic merge from submit-queue (batch tested with PRs 44837, 44779, 44492)

remove duplicate code from restful namer

The deleted codes have the same logic with function ObjectName.

**Release note**:

```release-note
```
2017-04-24 07:56:02 -07:00
Kubernetes Submit Queue c90faa8071 Merge pull request #44779 from enj/enj/r/etcd_default_name_copy
Automatic merge from submit-queue (batch tested with PRs 44837, 44779, 44492)

Default ObjectNameFunc for all REST Stores

All `Store`s in Kubernetes follow the same logic for determining the name of an object.  This change makes it so that `CompleteWithOptions` defaults the `ObjectNameFunc` if it is not specified.  Thus a user does not need to remember to use `ObjectMeta.Name`.  Using the wrong field as the name can lead to an object which has a name that bypasses normal object name validation.

Signed-off-by: Monis Khan <mkhan@redhat.com>

cc @liggitt @soltysh for review

**Release note**:

```
NONE
```
2017-04-24 07:55:59 -07:00
Kubernetes Submit Queue 08c5e28904 Merge pull request #44837 from danielqsj/apiissue
Automatic merge from submit-queue

Fix Content-Type error of apis

**What this PR does / why we need it**:
Response's Content-type of `/apis` is `text/plain`, not `application/json`.

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

**Special notes for your reviewer**:
We could use `responsewriters.WriteObjectNegotiated()` to write Content-type correctly.

**Release note**:

```release-note
```
2017-04-24 07:14:33 -07:00
Kubernetes Submit Queue 57fdd75cb8 Merge pull request #43440 from CaoShuFeng/audit_port
Automatic merge from submit-queue

Update basic audit filter's comment message

**Release note**:

```NONE
```
2017-04-24 06:27:59 -07:00
shijunqian 90802b2e3d Fix Content-Type error of apis 2017-04-24 16:12:00 +08:00
Kubernetes Submit Queue ac90c0e45c Merge pull request #44579 from mikedanese/cert-fix
Automatic merge from submit-queue

make certs used in roundtripper_test same as those used in proxy_test

This fixes an invalid cert error in 1.8. Gross copy paste but we will likely never have to do this again.

Part of https://github.com/kubernetes/kubernetes/issues/38228

https://github.com/kubernetes/kubernetes/blame/master/staging/src/k8s.io/apiserver/pkg/endpoints/proxy_test.go#L524-L570
2017-04-23 22:23:36 -07:00
NickrenREN e443277d58 Define const annotation variable once
Move annotation to package imported by both pkg/volume and pkg/volume/validation
2017-04-24 11:54:21 +08:00
NickrenREN 7d00e5cfb6 remove deprecated NodeLegacyHostIP 2017-04-24 11:01:25 +08:00
Kubernetes Submit Queue e0ba40b67c Merge pull request #39716 from zhouhaibing089/etcd-health-check
Automatic merge from submit-queue

etcd component status check should include credentials

- [x] Add TLS credentials into `pkg/genericapiserver.Backend`.
- [x] Add TLS credentials into `pkg/registry/core/componentstatus.Server`.
- [x] `pkg/probe/http.httpProber` should accept the TLS credentials.

Now it is working.

```console
$ kubectl get cs
NAME                 STATUS    MESSAGE              ERROR
scheduler            Healthy   ok
controller-manager   Healthy   ok
etcd-0               Healthy   {"health": "true"}
```

Fixes https://github.com/kubernetes/kubernetes/issues/27343.
2017-04-22 07:30:30 -07:00
Anthony Yeh 1ab6a33db4
PATCH: Fix erroneous meaningful conflict for numeric values.
The wrong json package was used, resulting in patches being unmarshaled
with numbers as float64 rather than int64.
This in turn confused HasConflicts() which expects numeric types to match.

The end result was false positives of meaningful conflicts, such as:

```
there is a meaningful conflict (firstResourceVersion: "8517",
currentResourceVersion: "8519"):
 diff1={"metadata":{"resourceVersion":"8519"},"spec":{"replicas":0},"status":{"conditions":null,"fullyLabeledReplicas":null,"replicas":0}}
, diff2={"spec":{"replicas":0}}
```
2017-04-21 17:24:07 -07:00
Anthony Yeh 103cb17bad
Fix mergepatch.HasConflicts().
This fixes some false negatives:

* If a map had multiple entries, only the first was checked.
* If a list had multiple entries, only the first was checked.
2017-04-21 15:33:10 -07:00
Kubernetes Submit Queue fa750c02be Merge pull request #44570 from liggitt/namespace-icc
Automatic merge from submit-queue

Explicit namespace from kubeconfig should override in-cluster config

Fixes #43662 

If an explicitly specified namespace is read from a kubeconfig file, we should not fall back to in-cluster config

```release-note
kubectl commands run inside a pod using a kubeconfig file now use the namespace specified in the kubeconfig file, instead of using the pod namespace. If no kubeconfig file is used, or the kubeconfig does not specify a namespace, the pod namespace is still used as a fallback.
```
2017-04-21 14:45:23 -07:00
Monis Khan ed35deb69d
Default ObjectNameFunc for all REST Stores
All Stores in Kubernetes follow the same logic for determining the name
of an object.  This change makes it so that CompleteWithOptions defaults
the ObjectNameFunc if it is not specified.  Thus a user does not need to
remember to use ObjectMeta.Name.  Using the wrong field as the name can
lead to an object which has a name that bypasses normal object name
validation.

Signed-off-by: Monis Khan <mkhan@redhat.com>
2017-04-21 15:47:25 -04:00
Kubernetes Submit Queue ee86c18d92 Merge pull request #44623 from p0lyn0mial/split_out_admission_options
Automatic merge from submit-queue (batch tested with PRs 42202, 40784, 44642, 44623, 44761)

Split out AdmissionOptions

**What this PR does / why we need it**: The changes in this PR split out AdmissionOptions from ServerRunOptions. In the long term AdmissionOptions will accepts various dependencies
and spit out AdmissionControl

**Release note**:

NONE
2017-04-21 11:52:09 -07:00
Kubernetes Submit Queue 936137d22b Merge pull request #44076 from liggitt/impersonation-groupify
Automatic merge from submit-queue

Include system:authenticated group when impersonating

Fixes #43227

An authorized impersonation request solely for a specific username previously resulted in a `user.Info` that did not include either the `system:authenticated` or `system:unauthenticated` groups. That meant that permissions intended to be granted to all users, like discovery, would be denied the impersonated user.

This allows `kubectl get pods --as=<username>` to work as expected

```release-note
API requests using impersonation now include the `system:authenticated` group in the impersonated user automatically.
```
2017-04-21 09:22:35 -07:00
Kubernetes Submit Queue c4bc7c1166 Merge pull request #44636 from yvespp/master
Automatic merge from submit-queue

client-go PortForwarder: don't log an error if net.Listen fails

**What this PR does / why we need it**:
If ipv6 is disabled the client-go PortForwarder logs an error:
```
E0406 17:26:06.983609   29625 portforward.go:209] Unable to create listener: Error listen tcp6 [::1]:30143: socket: address family not supported by protocol
```
This pull request removes this error log. Reasons:
* Tunnel creation might still succeed on ipv4 and the error just confuses the user (see https://github.com/kubernetes/helm/issues/2223).
* If the tunnel can't be created the error gets also loggen in `listenOnPort`.
* runtime.HandleError should only be used on errors "_when a non-user facing piece of code cannot return an error"_ which isn't the case here.

**Which issue this PR fixes**
Fixes https://github.com/kubernetes/helm/issues/2223
2017-04-21 08:34:17 -07:00
Kubernetes Submit Queue 3559c067c6 Merge pull request #41571 from php-coder/fix_comments
Automatic merge from submit-queue

Minor cleanups

Minor improvements:
- `ValidateNoNewFinalizers`: remove unused const
- Mention that mutation of `spec.initContainers[*].image` field is allowed
- Improve godoc comments
2017-04-21 08:34:07 -07:00
Roman Mohr b39b3ba016 client-go workqueue example
Demonstrates how to compose a controller out of cache.Controller,
cache.Indexer and a workqueue.
2017-04-21 12:41:30 +02:00