Commit Graph

1715 Commits (b73ce8e47d4ab45a367e88b0bdf30cd80cd9657e)

Author SHA1 Message Date
Dr. Stefan Schimanski 8dd0989b39 Update generated code 2017-07-18 09:28:49 +02:00
Dr. Stefan Schimanski b7fb418a19 staging/copy.sh: don't strip tags anymore with k8s.io/api 2017-07-18 09:28:49 +02:00
Dr. Stefan Schimanski 2bbe72d4e0 deepcopy: misc fixes for static deepcopy compilation
- port direct calls to deepcopy funcs
- apimachinery: fix types in unstructured converter test
- federation: fix deepcopy registration
2017-07-18 09:28:48 +02:00
Dr. Stefan Schimanski 39d95b9b06 deepcopy: add interface deepcopy funcs
- add DeepCopyObject() to runtime.Object interface
- add DeepCopyObject() via deepcopy-gen
- add DeepCopyObject() manually
- add DeepCopySelector() to selector interfaces
- add custom DeepCopy func for TableRow.Cells
2017-07-18 09:28:47 +02:00
xiangpengzhao 01daf707c5 Refactor: pkg/util into sub-pkgs 2017-07-18 14:34:08 +08:00
Mikhail Mazurskiy 6464774a9b
Refactor Start functions into an object 2017-07-18 14:05:09 +10:00
Mikhail Mazurskiy d11a9973cf
Improve Start functions 2017-07-18 14:05:09 +10:00
Mikhail Mazurskiy d789615902
Shared Informer Run blocks until all goroutines finish
Fixes #45454
2017-07-18 14:05:08 +10:00
huangjiuyuan 21d0f81564 adding validations on kube-apiserver audit log options
Signed-off-by: huangjiuyuan <jiuyuan.huang@daocloud.io>
2017-07-18 11:03:41 +08:00
Cao Shufeng a8693b63b9 fix NamespaceLifecycle admission
forceLiveLookupCache is designed to save recently deleted namespaces.
But currently, cluster scoped resources are also put into it.
For example, when we run:
kubectl delete clusterrole edit
The "edit" is put into forceLiveLookupCache as a deleted namespace.
This change fix the invalid action.
2017-07-18 10:09:15 +08:00
Kubernetes Submit Queue c004136540 Merge pull request #48384 from atlassian/update-testify
Automatic merge from submit-queue (batch tested with PRs 49017, 45440, 48384, 45894, 48808)

Update two dependencies

**What this PR does / why we need it**:
github.com/stretchr/testify - main desired update. Old version has bugs. Specifically I encountered https://github.com/stretchr/testify/issues/347 which was fixed a year ago.

github.com/davecgh/go-spew/spew is set to the newest version, a bit
newer than required by testify. Updated from version 6 Nov 2015 to
27 Jun 2017.

github.com/stretchr/objx is not updated - testify uses version
from 27 May 2014 which is older than 28 Sep 2015 used now (latest
actually). In practice there is only a tiny difference - one method was
removed in new version.

**Release note**:

```release-note
NONE
```
/sig testing
2017-07-17 16:26:55 -07:00
Kubernetes Submit Queue e0dcaa3409 Merge pull request #45440 from verb/nit-too-much-m
Automatic merge from submit-queue (batch tested with PRs 49017, 45440, 48384, 45894, 48808)

Fix typo in ExecCommandParam

**What this PR does / why we need it**: Makes ExecCommandParam look like all of the other "Param"s

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-07-17 16:26:53 -07:00
Eric Chiang 38722d0d62 generated
Commands run:

	./hack/update-generated-protobuf.sh
2017-07-17 15:36:30 -07:00
Eric Chiang 36c771826e api types: fix protobuf names that are different from JSON name 2017-07-17 15:32:44 -07:00
juanvallejo 113ff3bb98
check for negative index values 2017-07-17 15:59:10 -04:00
p0lyn0mial 6a3191a2d4 minor adjustments in the sample apiserver around resource creation.
issue: #47868
2017-07-17 18:16:04 +02:00
Kubernetes Submit Queue e2eefe922b Merge pull request #48733 from liggitt/namespace-deletion
Automatic merge from submit-queue (batch tested with PRs 48494, 48733)

Never prevent deletion of resources as part of namespace lifecycle

Namespace lifecycle should not prevent deletion of resources... its purpose is to prevent creation of resources in a terminating namespace, or create/update of resources in a non-existent namespace.

Fixes #49027
2017-07-17 08:43:39 -07:00
Kubernetes Submit Queue d54ab221cd Merge pull request #48991 from smarterclayton/cleanup_restclient
Automatic merge from submit-queue

Remove old, core/v1 specific constructs from RESTClient

Now that metav1 is abstracted from the APIs, RESTClient should also be agnostic to the core API.

* Remove `LabelSelectorParam` and `FieldSelectorParam` - use `VersionedParams` with `ListOptions`
* Remove `UintParam`
* Remove all legacy field selector logic from `VersionedParams` - ParameterCodec now handles that
* Remove special parameters (like `timeout`) which is no longer set by most clients
2017-07-17 06:50:18 -07:00
Kubernetes Submit Queue ba2bdb1aea Merge pull request #48944 from liaoyw/renew-lease-errormsg
Automatic merge from submit-queue

Log error when failed to renew lease.

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

Log detailed error when leaderelection can not renew release.
It would add a little bit help to find direct reason of failing renew lease
```
E0626 15:23:06.269198   46443 leaderelection.go:263] Failed to update lock: etcdserver: request timed out
E0626 15:23:07.528206   46443 leaderelection.go:263] Failed to update lock: Operation cannot be fulfilled on endpoints "kube-scheduler": the object has been modified; please apply yo
ur changes to the latest version and try again
E0626 15:23:07.528260   46443 event.go:259] Could not construct reference to: '&v1.Endpoints{TypeMeta:v1.TypeMeta{Kind:"", APIVersion:""}, ObjectMeta:v1.ObjectMeta{Name:"", GenerateN
ame:"", Namespace:"", SelfLink:"", UID:"", ResourceVersion:"", Generation:0, CreationTimestamp:v1.Time{Time:time.Time{sec:0, nsec:0, loc:(*time.Location)(nil)}}, DeletionTimestamp:(*
v1.Time)(nil), DeletionGracePeriodSeconds:(*int64)(nil), Labels:map[string]string(nil), Annotations:map[string]string(nil), OwnerReferences:[]v1.OwnerReference(nil), Finalizers:[]str
ing(nil), ClusterName:""}, Subsets:[]v1.EndpointSubset(nil)}' due to: 'selfLink was empty, can't make reference'. Will not report event: 'Normal' 'LeaderElection' 'gd6-k8s-noah-prod0
01-master-s0004 stopped leading'
I0626 15:23:07.528391   46443 leaderelection.go:208] failed to renew lease kube-system/kube-scheduler
F0626 15:23:07.528422   46443 server.go:134] lost master
```
2017-07-17 01:46:58 -07:00
Mikhail Mazurskiy de29d11bfe
github.com/stretchr/testify - main desired update. Old version has bugs.
github.com/davecgh/go-spew/spew is set to the newest version, a bit
newer than required by testify. Updated from version 6 Nov 2015 to
27 Jun 2017.

github.com/stretchr/objx is not updated - testify uses version
from 27 May 2014 which is older than 28 Sep 2015 used now (latest
actually). In practice there is only a tiny difference - one method was
removed in new version.
2017-07-17 11:15:33 +10:00
Clayton Coleman 112e0fa9da
Remove Kube specific api constructs from restclient
All callers must use VersionedParameters, which no longer has special
behavior for Kube resources.
2017-07-16 15:56:12 -04:00
Clayton Coleman f0e11c5b09
Remove "special" restclient parameters 2017-07-16 15:56:12 -04:00
Clayton Coleman b6d9815b95
Remove use of (Label|Field)SelectorParam 2017-07-16 15:56:11 -04:00
Kubernetes Submit Queue 3448d2fa86 Merge pull request #48906 from caesarxuchao/fix-import-cycle
Automatic merge from submit-queue (batch tested with PRs 44129, 48030, 48906)

Fix import cycle

Removed apimahcinery's dependency on k8s.io/api, introduced in https://github.com/kubernetes/kubernetes/pull/48497#discussion_r127312690.

Fixed hack/verify-staging-imports.sh to prevent future occurrences.
2017-07-15 17:13:41 -07:00
Jordan Liggitt def7f34055
Fix tls config copy in dial test 2017-07-15 12:57:15 -04:00
Jordan Liggitt 95bf4983de
Never prevent deletion of resources as part of namespace lifecycle 2017-07-15 12:56:22 -04:00
Kubernetes Submit Queue da31d920f5 Merge pull request #47846 from ncdc/jsonpath-filter-allow-missing-intermediate-keys
Automatic merge from submit-queue

jsonpath filter: allow intermediate missing keys

**What this PR does / why we need it**:
In jsonpath, when filtering a list, if allowMissingKeys is true, skip
over any items that are missing an intermediate key in the filter,
instead of returning a confusing error.

For example, if the filter is

{.items[?(@.metadata.annotations.foo=="bar")].metadata.name}

we should return all items where metadata.annotations.foo == bar, but if
an item in the list does not have metadata, metadata.annotations, or
metadata.annotations.foo, skip it instead of erroring.

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

**Special notes for your reviewer**:

**Release note**:

```release-note
Fixed a bug where a jsonpath filter would return an error if one of the items being evaluated did not contain all of the nested elements in the filter query.
```

cc @timothysc @smarterclayton @stevekuznetsov @mengqiy @liggitt @kubernetes/sig-api-machinery-pr-reviews
2017-07-14 17:34:20 -07:00
John Millikin 4d84968413
Use $(location) to find generated output paths.
Along with the build-infra PR
https://github.com/kubernetes/repo-infra/pull/19, this allows Kubernetes
binaries (e.g. hyperkube) to be build as external dependencies in other
Bazel projects.
2017-07-14 14:36:23 -07:00
Kubernetes Submit Queue a933551aaa Merge pull request #48892 from ericchiang/client-go-canonical-import
Automatic merge from submit-queue (batch tested with PRs 47066, 48892, 48933, 48854, 48894)

client-go: add canonical import comment

Ensure users check out client-go to the correct location. The install error now reads:

```
can't load package: package github.com/kubernetes/client-go/kubernetes: code in directory /home/eric/src/github.com/kubernetes/client-go/kubernetes expects import "k8s.io/client-go/kubernetes"
```

ref https://github.com/kubernetes/client-go/issues/223

/cc @caesarxuchao @lavalamp 

```release-note
NONE
```
2017-07-14 12:50:49 -07:00
Kubernetes Submit Queue 8532cdfd69 Merge pull request #48886 from mikedanese/cleanup
Automatic merge from submit-queue

remove some people from OWNERS so they don't get reviews anymore

These are googlers who don't work on the project anymore but are still
getting reviews assigned to them:
- @bprashanth
- @rjnagal
- @vmarmol
2017-07-14 11:46:10 -07:00
liaoyw 8c120dcf2f Log error when failed to renew lease. 2017-07-14 23:14:03 +08:00
Lee Verberne 786e993338 Fix typo in ExecCommandParam 2017-07-14 13:54:51 +00:00
Kubernetes Submit Queue a3ff0eaf69 Merge pull request #48276 from pmichali/issue48225
Automatic merge from submit-queue (batch tested with PRs 48812, 48276)

client-go support IPv6 addresses for PortForwarder getListener()

Currently, client-go requires that an IPv6 address string for hostname has
square brackets surrounding, so that it can be used with address:port in
an API request.

This change, removes that requirement, and has getListener() add the
square brackets, if needed. If the hostname is a name, an IPv4 address
string, or an IPv6 address already with square brackets, no change is made.

Decided to change here, rather than everywhere client-go is used (thinking
that there may be places where we DON'T want the square brackets applied).

This issue was found in kubelet, which, at startup, creates a listener for
services and nodes. If an IPv6 address is used, the URI was malformed.



**What this PR does / why we need it**:
Ensures that client-go will handle IPv6 addresses as hostnames, without any special encoding by caller.

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-07-14 04:43:44 -07:00
Kubernetes Submit Queue 578063b7a9 Merge pull request #47703 from smarterclayton/clean_self_link
Automatic merge from submit-queue (batch tested with PRs 48864, 48651, 47703)

Do not persist SelfLink into etcd storage

This behavior regressed in an earlier release. Clearing the self link reduces the size of the stored object by a small amount and keeps etcd marginally cleaner. Add tests to verify that Create and Update result in no SelfLink stored in etcd.
2017-07-14 03:10:47 -07:00
Chao Xu c6bfbaef23 remove apimachinery's dependency on k8s.io/api 2017-07-13 17:50:51 -07:00
Eric Chiang 90a555545e client-go: add canonical import comment 2017-07-13 13:03:12 -07:00
Paul Michali e17a501bcb Support IPv6 addresses for getListener()
Currently, client-go requires that an IPv6 address string for hostname has
square brackets surrounding, so that it can be used with address:port in
an API request.

This change, removes that requirement, and has getListener() add the
square brackets for IPv6 addresses for hosts. If IPv4 or hostname, the name
will not be modified.

Decided to change here, rather than everywhere client-go is used (thinking
that there may be places where we DON'T want the square brackets applied).

This issue was found in kubelet, which, at startup, creates a listener for
services and nodes. If an IPv6 address is used, the URI was malformed.
2017-07-13 19:52:48 +00:00
Clayton Coleman 461c3701f0
Do not persist SelfLink into etcd storage
This behavior regressed in an earlier release. Clearing the self link
ensures that a new version is always written and reduces the size of the
stored object by a small amount. Add tests to verify that Create and
Update result in no SelfLink stored in etcd.
2017-07-13 13:24:03 -04:00
Mike Danese c201553f27 remove some people from OWNERS so they don't get reviews anymore
These are googlers who don't work on the project anymore but are still
getting reviews assigned to them:
- bprashanth
- rjnagal
- vmarmol
2017-07-13 10:02:21 -07:00
Kubernetes Submit Queue ef229eaf51 Merge pull request #48813 from shyamjvs/fix-inflight-handler
Automatic merge from submit-queue

maxinflight handler should let panicrecovery handler call NewLogged

Fixes #48700 #48782 

/cc @deads2k @sttts
2017-07-12 17:24:34 -07:00
Kubernetes Submit Queue 77b6b126cb Merge pull request #48641 from smarterclayton/refactor_exec
Automatic merge from submit-queue (batch tested with PRs 48594, 47042, 48801, 48641, 48243)

Prepare to introduce websockets for exec and portforward

Refactor the code in remotecommand to better represent the structure of
what is common between portforward and exec.

Ref #48633
2017-07-12 14:08:10 -07:00
Kubernetes Submit Queue 9ba50833db Merge pull request #48319 from nilebox/nilebox/controller-ref
Automatic merge from submit-queue (batch tested with PRs 48279, 48566, 48319, 48794, 47952)

Helper methods dealing with ControllerRef

**What this PR does / why we need it**:
Adds helper methods for working with **controllerRef** (controller's `OwnerReference`).

It is based on the existing code from Kubernetes plus extracting some common logic:
- `NewControllerRef` is based on examples from [daemon controller](https://github.com/kubernetes/kubernetes/blob/master/pkg/controller/daemon/daemoncontroller.go#L1223), [deployment controller](https://github.com/kubernetes/kubernetes/blob/master/pkg/controller/deployment/sync.go#L649), [job controller](https://github.com/kubernetes/kubernetes/blob/master/pkg/controller/job/utils.go#L34)
- `GetControllerOf` is copied from [controller_ref_manager.go](https://github.com/kubernetes/kubernetes/blob/master/pkg/controller/controller_ref_manager.go#L36)
- `IsControlledBy` is a common logic extracted from resource controllers: [deployment_util.go#L568](https://github.com/kubernetes/kubernetes/blob/master/pkg/controller/deployment/util/deployment_util.go#L568), [history.go#L276](https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/history.go#L276) and many others.

It will also be useful for writing custom resource controllers, for example [service-catalog#979](https://github.com/kubernetes-incubator/service-catalog/pull/979)
2017-07-12 11:52:19 -07:00
Shyam Jeedigunta 6ffbbad217 maxinflight handler should let panicrecovery handler call NewLogged 2017-07-12 17:40:43 +02:00
Brendan Burns 29a0c6f56a Code updates for new SDK. 2017-07-12 06:09:31 -07:00
Kubernetes Submit Queue 0e461035cb Merge pull request #48734 from tallclair/namechange
Automatic merge from submit-queue (batch tested with PRs 48698, 48712, 48516, 48734, 48735)

Name change: s/timstclair/tallclair/

I changed my name, and I'm migrating my user name to be consistent.
2017-07-12 04:56:32 -07:00
Kubernetes Submit Queue 69dff8b943 Merge pull request #48698 from sakeven/remove_mime
Automatic merge from submit-queue

remove svg mime type extension

Signed-off-by: sakeven <jc5930@sina.cn>



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

I found that [kubernetes requires go version 1.6 or greater](https://github.com/kubernetes/kubernetes/blob/master/hack/lib/golang.sh#L335).
While the [commit](21e47d831b)  which adds "image/svg+xml" type for extension ".svg", has been merged to go from version 1.5 to 1.9beta.

So it's safe to remove code ```mime.AddExtensionType(".svg", "image/svg+xml")```.

**Special notes for your reviewer**:

**Release note**:

```
NONE
```
2017-07-12 04:50:02 -07:00
Kubernetes Submit Queue 1f1f9ef962 Merge pull request #48549 from maleck13/add-generated-clients
Automatic merge from submit-queue (batch tested with PRs 47948, 48631, 48693, 48549, 47593)

add generated clients. modify codegen script 

**What this PR does / why we need it**:
Adds in the generated clientsets for the sample apiserver. Modifies the update-codgen script to copy over the client from the generated location. We need it in order to be able to add integrations and unit tests that make use of the clientsets and their fakes.

**Special notes for your reviewer**:
@deads2k  @p0lyn0mial  hopefully done the correct thing here. Not 100% sure on needing the copy but it seemed what was needed to get the import paths correct?

**Release note**:

```release-note
NONE
```
2017-07-12 04:03:58 -07:00
Kubernetes Submit Queue 7b650c9ec0 Merge pull request #48693 from CaoShuFeng/audit_id_header
Automatic merge from submit-queue (batch tested with PRs 47948, 48631, 48693, 48549, 47593)

add a regression test for Audit-ID http header

This change add a test for: https://github.com/kubernetes/kubernetes/pull/48492



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

```
NONE
```
2017-07-12 04:03:56 -07:00
Kubernetes Submit Queue e152e67092 Merge pull request #48631 from smarterclayton/unify_proxy
Automatic merge from submit-queue (batch tested with PRs 47948, 48631, 48693, 48549, 47593)

Unify generic proxy code in apimachinery
2017-07-12 04:03:55 -07:00
Kubernetes Submit Queue fee4421bf5 Merge pull request #48658 from CaoShuFeng/WriteHeader
Automatic merge from submit-queue (batch tested with PRs 46865, 48661, 48598, 48658, 48614)

remove extra WriteHeader function

The deleted two functions will be called later in the function
SerializeObject(). Not necessary to call them twice.

**Release note**:
```
NONE
```
2017-07-12 03:02:20 -07:00
Kubernetes Submit Queue b66be98174 Merge pull request #39173 from caesarxuchao/include-leaderelection
Automatic merge from submit-queue (batch tested with PRs 47232, 48625, 48613, 48567, 39173)

Include leaderelection in client-go; 

Fix #39117
Fix https://github.com/kubernetes/client-go/issues/28

This PR:
* includes the leaderelection to the staging client-go
* to avoid conflict with golang's testing package, renames package /testing to /testutil, and renames cache/testing to cache/testframework

```release-note
client-go now includes the leaderelection package
```
2017-07-12 00:10:20 -07:00
Nail Islamov e86faca6b6
Helper methods dealing with ControllerRef 2017-07-12 16:24:51 +10:00
Kubernetes Submit Queue 1591975808 Merge pull request #46138 from pmichali/issue44848b
Automatic merge from submit-queue (batch tested with PRs 48196, 42783, 48507, 47719, 46138)

IPv6 support for getting IP from default route

This is another part of the effort to update ChoseHostInterface() to support
IPv6. In particular, this focuses on the call path, starting from
chooseHostInterfaceFromRoute(), which attempts to find the node IP by
using default route information.

In the original code, routes are collected, and examined to find default
routes. For a default route, the IPs for the associated interface are
checked to see if there is one that is a V4 address, and is not a
loopback, link local, or multicast address. If found, that IP will be
used for the node IP.

With this PR, there are some slight changes to prepare for allowing IPs
from IPv6 default routes. The routes (IPv4 at this time - a subsequent
PR will handle IPv6) are collected as before. If the route is a default
route AND it's GW address is a global unicast address, then the IPs
for the associated interface are checked. This time though, we just pick
the IP that is on the same subnet as the gateway IP.

This ensures it is not a link local, loopback, or multicast address. It
saves time, by nt checking IPs for interfaces that don't have a "global"
default route. It also will ensure the right IP is used, when using both
IPv4 and IPv6 addresses.

For example, if we have eth0 with global IPv4 and IPv6 addresses, and
an IPv6 default route, we want to select the IPv6 address, as it is
associated with the default route.

Another case is that same interface, along with eth1 containing an IPv4
address with a default route. We want to select eth1's IPv4 address,
and not the IPv4 on eth0.

This change adds more UT coverage to several methods, and removes UTs
that are redundantly testing at a higher level. Coverage is slightly
improved.



**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)*: xref #44848

**Special notes for your reviewer**:
This goes along with PR 46044, and will have another PR to the next part.

**Release note**:

```release-noteNONE
```
2017-07-11 23:09:14 -07:00
Kubernetes Submit Queue 3217495f52 Merge pull request #47203 from spiffxp/selfclient-ipv6-loopback
Automatic merge from submit-queue (batch tested with PRs 48402, 47203, 47460, 48335, 48322)

TestLoopbackHostPort should accept IPv6 loopback host

Attempting to get unit tests to pass on darwin per [our unit testing policy](https://github.com/kubernetes/community/blob/master/contributors/devel/testing.md#unit-tests)

part of #48509

/cc @kubernetes/sig-api-machinery-bugs
2017-07-11 21:01:33 -07:00
craig 87f8e79658 Add generated clients. modify codegen script to make modification easier and to allow it to work from the root of the sample server.
fix issue where binaries not being removed. Add new client packages to lint

put new linted packages in correct location. remove flag from variables

Add all pkgs that should be linted and run sort

Add output from hack/update-bazel.sh

remove genclient=true from FischerList and regenerate client

re update bazel build files

fix missing resource method in register.go
2017-07-11 19:49:37 +01:00
Tim Allclair a2f2e1d491 Name change: s/timstclair/tallclair/ 2017-07-10 14:05:46 -07:00
Andy Goldstein e6f97d514d jsonpath filter: allow intermediate missing keys
In jsonpath, when filtering a list, if allowMissingKeys is true, skip
over any items that are missing an intermediate key in the filter,
instead of returning a confusing error.

For example, if the filter is

{.items[?(@.metadata.annotations.foo=="bar")].metadata.name}

we should return all items where metadata.annotations.foo == bar, but if
an item in the list does not have metadata, metadata.annotations, or
metadata.annotations.foo, skip it instead of erroring.
2017-07-10 09:32:36 -04:00
Cao Shufeng a5df09ba89 add a regression test for Audit-ID http header
This change add a test for: https://github.com/kubernetes/kubernetes/pull/48492
2017-07-10 19:08:20 +08:00
Cao Shufeng 0c577c47d5 Use glog.*f when a format string is passed
ref:
https://godoc.org/github.com/golang/glog

I use the following commands to search all the invalid usage:
$ grep "glog.Warning(" * -r | grep %
$ grep "glog.Info(" * -r | grep %
$ grep "glog.Error(" * -r | grep %
$ grep ").Info(" * -r | grep % | grep "glog.V("
2017-07-10 19:04:03 +08:00
sakeven 795953c0c4 remove svg mime type extension
Signed-off-by: sakeven <jc5930@sina.cn>
2017-07-10 18:14:24 +08:00
jianglingxia fe13072443 amend the comment 2017-07-10 15:45:47 +08:00
Clayton Coleman cf026a3314
Move SPDY specific code into its own package 2017-07-09 16:11:05 -04:00
Clayton Coleman c73622108c
generated: bazel / godeps 2017-07-09 15:23:34 -04:00
Dr. Stefan Schimanski da3322c2d9 apimachinery: remove unneeded GetObjectKind() impls 2017-07-08 18:37:37 +02:00
Kubernetes Submit Queue 70fa697517 Merge pull request #48601 from sttts/sttts-separate-test-types
Automatic merge from submit-queue (batch tested with PRs 48583, 48605, 48601)

apimachinery+apiserver: separate test types in their own packages

Preparation for static deepcopy https://github.com/kubernetes/kubernetes/pull/48544
and its use of package-global deepcopy-gen tags for all runtime.Objects.

- [x] wait for #48497
2017-07-08 08:54:45 -07:00
Kubernetes Submit Queue eab5e060a4 Merge pull request #48605 from CaoShuFeng/json_log
Automatic merge from submit-queue (batch tested with PRs 48583, 48605, 48601)

support json output for log backend of advanced audit

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

```
Add json format support for advanced audit in apiserver. Use --audit-log-format=json to emit json to log backend.
```
2017-07-08 08:54:43 -07:00
Kubernetes Submit Queue 9c86d7473a Merge pull request #48583 from smarterclayton/record_errors
Automatic merge from submit-queue

Record 429 and timeout errors to prometheus

Allows gathering of load being shed.

Fixes #48559

@deads2k please review, there was a logic error in apiserver RequestInfo (minor, fortunately)

```release-note
Requests with the query parameter `?watch=` are treated by the API server as a request to watch, but authorization and metrics were not correctly identifying those as watch requests, instead grouping them as list calls.
```
2017-07-08 08:50:55 -07:00
Kubernetes Submit Queue a2e463f6d0 Merge pull request #48546 from deads2k/tpr-19-ripples
Automatic merge from submit-queue (batch tested with PRs 48497, 48604, 48599, 48560, 48546)

remove dead code

This removes the dead code cruft since we stopped serving TPRs.

ref #48152
2017-07-08 07:09:38 -07:00
Kubernetes Submit Queue b5c4346130 Merge pull request #48599 from sttts/sttts-audit-deepcopy-reg
Automatic merge from submit-queue (batch tested with PRs 48497, 48604, 48599, 48560, 48546)

audit: fix deepcopy registration

Remove manual registration into scheme by fixing the deepcopy tag of the api group.
2017-07-08 07:09:34 -07:00
Kubernetes Submit Queue ed66bfd2a1 Merge pull request #48604 from sttts/sttts-remove-tpr-example
Automatic merge from submit-queue (batch tested with PRs 48497, 48604, 48599, 48560, 48546)

client-go: remove TPR example

Now that the TPR api is gone (https://github.com/kubernetes/kubernetes/issues/48152).
2017-07-08 07:09:33 -07:00
Dr. Stefan Schimanski d358cb168d Update generated files 2017-07-08 10:18:14 +02:00
Dr. Stefan Schimanski 205cd90d46 apimachinery+apiserver: extract test types to work w/ deepcopy-gen 2017-07-08 10:18:14 +02:00
Dr. Stefan Schimanski ad23081273 audit: fix deepcopy registration 2017-07-08 10:15:16 +02:00
Cao Shufeng f41eb67798 remove extra WriteHeader function
The deleted two functions will be called later in the function
SerializeObject(). Not necessary to call them twice.
2017-07-08 14:07:01 +08:00
Cao Shufeng bc94370e9c support json output for log backend of advanced audit 2017-07-08 11:25:28 +08:00
Chao Xu 65cedeeb43 update bazel 2017-07-07 19:04:26 -07:00
shiywang 9ac39849b9 add test resource carp and change name 2017-07-08 08:53:35 +08:00
Shiyang Wang da4a875ef8 Move pkg/apimachinery/test to apimachinery 2017-07-08 08:48:38 +08:00
Chao Xu 24d5279c59 move leaderelection package to client-go 2017-07-07 17:01:04 -07:00
Clayton Coleman 12c7874c0d
Prepare to introduce websockets for exec and portforward
Refactor the code in remotecommand to better represent the structure of
what is common between portforward and exec.
2017-07-07 18:22:51 -04:00
Clayton Coleman edc12aafe2
Unify generic proxy code in apimachinery
Make the utility package truly generic, consolidate all generic proxy in
apimachinery.
2017-07-07 16:26:29 -04:00
Clayton Coleman 2e33a2f0bc
Record 429 and timeout errors to prometheus
Allows gathering of load being shed.
2017-07-07 15:50:49 -04:00
deads2k 0801ded425 remove dead code 2017-07-07 09:12:29 -04:00
Paul Michali 78ae9a57df IPv6 support for getting IP from default route
This is part 2 of the effort to update ChoseHostInterface() to support IPv6
addresses (as part of issue 44848). This changeset includes:

- Supports finding IPv6 host addresses from default routes (but currently only
  provided with IPv4 default routes).
- getRoutes() filters for default routes.
- getFinalIP() checks that IP is in requested family. Uses IsGlobalUnicast(),
  instead of explicit tests for loopback, multicast, and link-local IPs.
- getIPFromInterace() checks for family requested.
- chooseHostInterfaceFromRoute()
    * Quickly exits, if no default routes.
    * Since only getting default routes, no check here.
    * Searches all default routes for IPv4 addresses, and then searches all
      default routes for IPv6 addresses (for backwards compatibility).
- More coverage in UTs (87.8% vs 62.6%).
- Better testing of error conditions/results.
- Tests for IPv6 IPs, throughout functions.
- Reduced duplicate testing for items tested at lower levels.

Commit has been rebased on top of PR46044.
2017-07-07 12:52:21 +00:00
Dr. Stefan Schimanski b34464241d client-go: remove TPR example 2017-07-07 14:13:46 +02:00
Kubernetes Submit Queue 4e276d49b9 Merge pull request #46044 from pmichali/issue44848a
Automatic merge from submit-queue (batch tested with PRs 47435, 46044)

IPv6 support for getting node IP

As part of ChooseHostInterface(), it will call a function to try to get the
global IP for the host, by looking at all the system interfaces and select
the first IP that is not a loopback, link-local, or point-to-point IP.

This commit does the following:

- Allows IPv6 non-local IPs to be selected.
- IPv4 takes priority (checks all interfaces for IPv4 addresses and
  then checks all interfaces for IPv6), for backward compatibility.
- Adds UTs for code coverage (was no coverage of underlying function),
  increasing from 62% to 85%.
- Improved logging and reporting for error conditions.
- Minor renaming of functions and variables for readability.



**What this PR does / why we need it**:
This will be part of several PRs to add IPv6 support in apimachinery area for use by Kubernetes. It partially fixes the issue.

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

**Special notes for your reviewer**:
The intent is to break up the PR 45116 into multiple PRs to take on this change a piece at a time.

**Release note**:

```release-noteNONE
```
2017-07-06 12:43:42 -07:00
Kubernetes Submit Queue 756a814042 Merge pull request #43674 from shiywang/fixjsonpath
Automatic merge from submit-queue (batch tested with PRs 48538, 43674)

fix JSONPath parser will not filter strings containing parentheses

Fixes https://github.com/kubernetes/client-go/issues/158
@mtaufen  @daizuozhuo @caesarxuchao
2017-07-06 11:21:28 -07:00
Kubernetes Submit Queue f177389436 Merge pull request #48536 from CaoShuFeng/application/json
Automatic merge from submit-queue

Fix invalid Content-Type for 403 error

https://github.com/kubernetes/kubernetes/pull/47384 makes 403 errors return Status Object. However the Content-Type is still "text/plain"
This change fixes it.

Before this change:
kubectl get pods --as=tom
Error from server (Forbidden): {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"pods \"\" is forbidden: User \"tom\" cannot list pods in the namespace \"default\".","reason":"Forbidden","details":{"kind":"pods"},"code":403} (get pods)

After this change:
$ kubectl get pods --as=tom
Error from server (Forbidden): pods "" is forbidden: User "tom" cannot list pods in the namespace "default".



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

```
NONE
```
2017-07-06 08:52:09 -07:00
Cao Shufeng 36e0a5ed14 Fix invalid Content-Type for 403 error
https://github.com/kubernetes/kubernetes/pull/47384 makes 403 errors
return Status Object. How the Content-Type is still "text/plain"
This change fix it.
2017-07-06 20:22:43 +08:00
Cao Shufeng f21bc7bb9a Fix Audit-ID header key
Now http header key "Audit-ID" doesn't have effect, because golang
automaticly transforms "Audit-ID" into "Audit-Id". This change use
http.Header.Get() function to canonicalize "Audit-ID" to "Audit-Id".
2017-07-06 15:29:00 +08:00
Kubernetes Submit Queue 8b58346517 Merge pull request #48502 from ironcladlou/memcachediscovery
Automatic merge from submit-queue (batch tested with PRs 47700, 48464, 48502)

Add a refreshing discovery client

Introduce a discovery client (implementing `CachedDiscoveryInterface`) which caches discovery information in memory and which can be actively refreshed by the user.

This implementation fetches from discovery upon refresh and could later be improved to maintain updates from a watch.

Extracted from https://github.com/kubernetes/kubernetes/pull/47665 and https://github.com/kubernetes/kubernetes/pull/46000 to help reduce the scope of https://github.com/kubernetes/kubernetes/pull/48065.

```release-note
NONE
```
2017-07-05 13:27:46 -07:00
Kubernetes Submit Queue d630c0b6b1 Merge pull request #48464 from wanghaoran1988/fix_err_type
Automatic merge from submit-queue (batch tested with PRs 47700, 48464, 48502)

fix error type

**What this PR does / why we need it**:
invalidToken should be errInvalideToken
**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**:
No
**Release note**:
```
None
```
2017-07-05 13:27:45 -07:00
Kubernetes Submit Queue 1108738200 Merge pull request #48033 from smarterclayton/generic_printer
Automatic merge from submit-queue (batch tested with PRs 45467, 48091, 48033, 48498)

Refactor and simplify generic printer for unknown objects

The first two commits are part of other PRs

@kubernetes/sig-cli-pr-reviews part of the general refactoring for server side print
2017-07-05 12:37:33 -07:00
Dan Mace 2639b75d84 Refactor cached discovery client 2017-07-05 11:05:46 -04:00
Kubernetes Submit Queue fdee1d5488 Merge pull request #48445 from deads2k/server-28-panichandler
Automatic merge from submit-queue (batch tested with PRs 47162, 48444, 48445)

make the panic handler first

Move the panic handler to the beginning of the chain so that panics will get information in the log beyond a stack.
2017-07-05 06:39:31 -07:00
Kubernetes Submit Queue cfde9e5832 Merge pull request #48444 from p0lyn0mial/add_fisher_resource_to_wardle_group
Automatic merge from submit-queue (batch tested with PRs 47162, 48444, 48445)

Introducing a cluster-scoped resource in the wardle.k8s.io group.

**What this PR does / why we need it**:
This PR adds a cluster-scoped resource to the wardle.k8s.io group.
The cluster scoped resource has a field that indicates Flunder.Names that are disallowed.
The resource is going to be used by an admission plugin.
The admission plugin will list the cluster-scope resources and check against banned names.

**Special notes for your reviewer**:
Issue: #47868

**Release note**:

```
NONE
```
2017-07-05 06:39:29 -07:00
Kubernetes Submit Queue c746680143 Merge pull request #47384 from shiywang/api403
Automatic merge from submit-queue (batch tested with PRs 48383, 47384)

Fix 401/403 apiserver errors do not return 'Status' objects

fixes https://github.com/kubernetes/kubernetes/issues/45970
2017-07-05 02:18:21 -07:00
Kubernetes Submit Queue 0ec36bdc8f Merge pull request #47043 from CaoShuFeng/validate_audit
Automatic merge from submit-queue

Add Validate() function for audit options

**Release note**:

```
NONE
```
Fixes: #47114
2017-07-04 08:48:20 -07:00
p0lyn0mial 113e9ba1d3 Introducing a cluster-scoped resource in the wardle.k8s.io group.
The cluster scoped resource has a field that indicates Flunder.Names that are disallowed.
The resource is going to be used by an admission plugin.
The admission plugin will list the cluster-scope resources and check against banned names.

Issue: #47868
2017-07-04 15:43:45 +02:00
Kubernetes Submit Queue 1033dae18e Merge pull request #46928 from CaoShuFeng/audit_unused_function
Automatic merge from submit-queue

remove unused function and variable from audit backend

auditStringSlice is not used here anymore.
sink variable is also not used.
**Release note**:

```
NONE
```
Fixes: #47114
2017-07-04 04:21:15 -07:00
Haoran Wang 45ec7d9f51 fix error type 2017-07-04 17:21:36 +08:00
Cao Shufeng 00e871a846 remove unused function and variable from audit backend 2017-07-04 16:14:10 +08:00
Shiyang Wang 3d6479f721 Fix 401/403 apiserver errors do not return 'Status' objects 2017-07-04 15:35:51 +08:00
Kubernetes Submit Queue ea6e84365e Merge pull request #47206 from gyliu513/typo
Automatic merge from submit-queue

Follow up for https://github.com/kubernetes/kubernetes/pull/47003

**What this PR does / why we need it**:
This is addressing left comments for https://github.com/kubernetes/kubernetes/pull/47003#discussion_r120888982

/cc @aveshagarwal 

**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-07-04 00:25:22 -07:00
Kubernetes Submit Queue 4ae3b032f4 Merge pull request #48394 from smarterclayton/must_serialize_if_data_differs
Automatic merge from submit-queue (batch tested with PRs 48439, 48440, 48394)

GuaranteedUpdate must write if stored data is not canonical

An optimization added to the GuaranteedUpdate loop changed the
comparison of the current objects serialization against the stored data,
instead comparing to the in memory object, which defeated the mechanism
we use to migrate stored data (GET then PUT should update the version stored in etcd if the canonical serialization has changed)

This commit preserves that optimization but correctly verifies the in
memory serialization against the on disk serialization by fetching the
latest serialized data. Since most updates are not no-ops, this should
not regress the performance of the normal path.

Fixes #48393

```release-note
When performing a GET then PUT, the kube-apiserver must write the canonical representation of the object to etcd if the current value does not match. That allows external agents to migrate content in etcd from one API version to another, across different storage types, or across varying encryption levels. This fixes a bug introduced in 1.5 where we unintentionally stopped writing the newest data.
```
2017-07-03 13:05:30 -07:00
deads2k 9b43bd4a5b make the panic handler first 2017-07-03 14:34:03 -04:00
Kubernetes Submit Queue 74bde7f7ff Merge pull request #48354 from deads2k/gc-01-deletenever
Automatic merge from submit-queue (batch tested with PRs 47784, 47793, 48334, 48435, 48354)

allow a deletestrategy to opt-out of GC

Not all resources should be GC-able and we implemented an ignore list to handle this, but at the storage layer they could still set finalizers, they just hung in a stuck state forever.  This updates the strategy to allow a resource to indicate that they shouldn't be GCed.

@kubernetes/sig-api-machinery-misc
2017-07-03 10:41:56 -07:00
Kubernetes Submit Queue cf9f110387 Merge pull request #48334 from CaoShuFeng/LevelMetadata
Automatic merge from submit-queue (batch tested with PRs 47784, 47793, 48334, 48435, 48354)

update events' ResponseStatus at Metadata level

ResponseStatus is populated in MetadataLevel, so we also update it in
MetadataLevel.

**Release note**:

```
NONE
```
2017-07-03 10:41:51 -07:00
Kubernetes Submit Queue 55261d7955 Merge pull request #47784 from CaoShuFeng/rule_validate
Automatic merge from submit-queue (batch tested with PRs 47784, 47793, 48334, 48435, 48354)

add validate for advanced audit policy

This change checks group name and non-resrouce URLs format for audit
policy.

**Release note**:

```
add validate for advanced audit policy, kube-apiserver will do a stricter validation and will break existing users with invalid configs.
```
2017-07-03 10:41:47 -07:00
deads2k 312fb1e1fa allow a deletestrategy to opt-out of GC 2017-07-03 11:27:45 -04:00
Cao Shufeng b6abcacb38 update events' ResponseStatus at Metadata level
ResponseStatus is populated in MetadataLevel, so we also update it in
MetadataLevel.
2017-07-03 20:43:48 +08:00
Cao Shufeng 7437b88386 add validate for advanced audit policy
This change checks group name and non-resrouce URLs format for audit
policy.
2017-07-03 20:35:35 +08:00
Clayton Coleman b851614adf
GuaranteedUpdate must write if stored data is not canonical
An optimization added to the GuaranteedUpdate loop changed the
comparison of the current objects serialization against the stored data,
instead comparing to the in memory object, which defeated the mechanism
we use to migrate stored data.

This commit preserves that optimization but correctly verifies the in
memory serialization against the on disk serialization by fetching the
latest serialized data. Since most updates are not no-ops, this should
not regress the performance of the normal path.
2017-07-02 23:13:15 -04:00
Nikhita Raghunath 36271f985d
Add Cleanup section to apiextensions client-go 2017-07-02 03:53:35 +05:30
Kubernetes Submit Queue fbba67098b Merge pull request #48317 from CaoShuFeng/impersonation_group
Automatic merge from submit-queue

remove useless check from impersonation filter

When groupsSpecified is false, that means no other groups are added
rather than the service account groups. So this check doesn't make
any sense.

**Release note**:

```
NONE
```
2017-06-30 19:47:38 -07:00
Kubernetes Submit Queue 19724f0b98 Merge pull request #48151 from apelisse/accept-encoding-gzip
Automatic merge from submit-queue (batch tested with PRs 47918, 47964, 48151, 47881, 48299)

GZip openapi schema if accepted by client

**What this PR does / why we need it**: Uses gzip "Accept-Encoding" flag rather than specific path to download gzipped openapi schema.

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

**Special notes for your reviewer**:

**Release note**:

```release-note
```
2017-06-30 18:42:38 -07:00
Kubernetes Submit Queue 9c74026ffc Merge pull request #46803 from apelisse/new-download-openapi
Automatic merge from submit-queue (batch tested with PRs 43558, 48261, 42376, 46803, 47058)

OpenAPI downloads protobuf rather than Json

**What this PR does / why we need it**: 
The current implementation of the OpenAPI getter fetches the swagger in a Json format from the apiserver. The Json file is big (~1.7mb), which means that it takes a long time to download, and then a long time to parse. Because that is going to be needed on each `kubectl` run later, we want this to be as fast as possible.

The apiserver has been modified to be able to return a protobuf version of the swagger, which this patch intends to use.

Note that there is currently no piece of code that exists that allows us to go from the protobuf version of the file, back into Json and/or `spec.Swagger`. Because the protobuf is not very different (but significantly different enough that it can't be translated), I've updated the code to use `openapi_v2.Document` (the protobuf type) everywhere rather than `spec.Swagger`. The behavior should be identical though.

There are more changes that are coming in follow-up pull-requests: using the gzip version (also provided by the new apiserver) to even further reduce the size of the downloaded content, and use the HTTP Etag cache mechanism to completely get rid of recurrent fetch requests. I'm currently working on these two features.

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

**Special notes for your reviewer**:

**Release note**:
```release-note
NONE
```
2017-06-30 16:28:48 -07:00
Clayton Coleman 3662184786
meta.EachListItem should support runtime.Unstructured
Allows callers to iterate over that construct.
2017-06-30 16:40:26 -04:00
Kubernetes Submit Queue 992002689e Merge pull request #47132 from pichouk/patch-1
Automatic merge from submit-queue

Fix a typo in deletion log of apiserver

**What this PR does / why we need it**:
I just fix a typo in a log message. Nothing more 😄 

**Which issue this PR fixes**
apiserver sometimes log this message "About do delete object from database". It seems that there is a typo for `to`.

```release-note
Fix a typo in apiserver log message
```
2017-06-30 05:30:17 -07:00
Cao Shufeng 0a1e24f31e remove useless check from impersonation filter
When groupsSpecified is false, that means no other groups are added
rather than the service account groups. So this check doesn't make
any sense.
2017-06-30 10:51:07 +08:00
Mikhail Mazurskiy dc1ee493a2
Refactor unstructured converter 2017-06-30 09:35:14 +10:00
Aaron Crickenberger 8469b01333 TestLoopbackHostPort should accept IPv6 loopback host 2017-06-29 11:49:28 -07:00
Dan Mace 547d820588 Fix Unstructured field accessor
Fix the Unstructured GetDeletionGracePeriodSeconds accessor which was
always returning nil regardless of the underlying stored value. The
field value always appearing nil prevents Custom Resource instances
from being deleted when garbage collection is enabled for CRs and
when DeletePropagationOrphan is used. More generally, this fix means that
delete-on-update now works for CR instances.

Add some test coverage for Unstructured metadata deserialization.

The Unstructured DeletionGracePeriodSeconds field marshals as a value
type from JSON and as a pointer type via SetDeletionGracePeriodSeconds.
The GetDeletionGracePeriodSeconds method now supports handling both
int64 and *int64 values so that either underlying value can be returned.

Add a reflection-based unit test which attempts to exercise all the
Object Get/Set methods for nil handling.
2017-06-28 13:44:29 -04:00
Guangya Liu 159fa86d98 Follow up for https://github.com/kubernetes/kubernetes/pull/47003 2017-06-28 10:41:09 +08:00
xiangpengzhao fcf2df9ad7 Validate --storage-backend type. 2017-06-28 09:47:49 +08:00
Kubernetes Submit Queue 82eff38a63 Merge pull request #45610 from bsalamat/priority_api
Automatic merge from submit-queue (batch tested with PRs 45610, 47628)

Add Priority to Kubernetes API

**What this PR does / why we need it**: This is the first in a series of PRs to add priority to Kubernetes API. Subsequent PRs will add priority name resolution to admission controller.


**Release note**:

```release-note
Add PriorityClassName and Priority fields to PodSpec.
```
2017-06-27 17:46:08 -07:00
Antoine Pelisse f617df7d6a Add NYTimes/gziphandler dependency 2017-06-27 15:55:01 -07:00
Antoine Pelisse bd38dd4d12 openapi: Read Accept-Content to send gzip if needed 2017-06-27 15:55:00 -07:00
Kubernetes Submit Queue fd884b7eb6 Merge pull request #48106 from timstclair/audit-metrics
Automatic merge from submit-queue (batch tested with PRs 48106, 46761)

s/count/total/ in audit prometheus metrics

Responding to https://github.com/kubernetes/kubernetes/pull/46732#discussion_r124057806, making the metric names conform with the [metric naming convention](https://prometheus.io/docs/practices/naming/#metric-names).

kubernetes/features#22

/cc @ericchiang @ihmccreery
2017-06-27 15:01:57 -07:00
Kubernetes Submit Queue 9120d58fc9 Merge pull request #47352 from p0lyn0mial/wire_admission_to_sample_apiserver
Automatic merge from submit-queue

shows how to wire admission control in a sample api server.

**What this PR does / why we need it**:
This PR shows how to wire admission control in a custom api server

**Release note**:

```release-note
NONE
```
2017-06-27 10:06:06 -07:00
Kubernetes Submit Queue 353633b877 Merge pull request #47904 from deads2k/log-01-supress
Automatic merge from submit-queue (batch tested with PRs 47484, 47904, 48034)

prioritize messages for long steps

This pull prioritizes the trace messages, so steps that are unusually large come out at the info level and all details come out a v(4) level.
2017-06-26 22:21:58 -07:00
Kubernetes Submit Queue d31bcad496 Merge pull request #47702 from smarterclayton/avoid_mutable
Automatic merge from submit-queue (batch tested with PRs 48012, 47443, 47702, 47178)

Don't bother with a mutable transformer for identity

The default value transformer can safely be the identity transformer - mutability is not required if the caller doesn't need transformation.
2017-06-26 17:48:03 -07:00
Kubernetes Submit Queue aac42add77 Merge pull request #47443 from p0lyn0mial/use_incluster_cfg_when_creating_ext_informers
Automatic merge from submit-queue (batch tested with PRs 48012, 47443, 47702, 47178)

incluster config will be used when creating external shared informers.

**What this PR does / why we need it**:
Previously the loopback configuration was used to talk to the server.
As a consequence a custom API server was unable to talk to the root API server.
This PR changes the above by using incluster configuration to create shared informers.

**Release note**:

```release-note
NONE
```
2017-06-26 17:48:01 -07:00
Kubernetes Submit Queue eadd20ef48 Merge pull request #47748 from nikhita/client-go-examples-readme
Automatic merge from submit-queue

Update custom-resources example in client-go

- Update client-go examples `README.md` to point to the CustomResources example instead of the deprecated TPR one.
- Delete `staging/src/k8s.io/client-go/examples/custom-resources`. 

Fixing #47743.

**Release note**:

```release-note
NONE
```

/cc @ahmetb @sttts
2017-06-26 16:30:55 -07:00
Nikhita Raghunath bfa9ce4308
Update CR example in client-go
Remove custom-resources directory from client-go

Add TPR example back

Mention CRD is successor to TPR
2017-06-27 03:39:29 +05:30
Bobby (Babak) Salamat 403b30f6e9 Autogenerated files 2017-06-26 15:02:49 -07:00
Tim St. Clair b34d6ab890
s/count/total/ in audit prometheus metrics 2017-06-26 14:41:20 -07:00
Bobby Salamat 91f893eebe Add priority to Kubernetes API 2017-06-26 13:43:19 -07:00
Kubernetes Submit Queue 6b973991a8 Merge pull request #48036 from hongchaodeng/master
Automatic merge from submit-queue (batch tested with PRs 48036, 48022)

apiextensions-apiserver: fix build

Can't build CRD due to this bug. This PR will fix it.
2017-06-26 12:52:39 -07:00
Eric Paris f4767c270d prioritize messages for long steps 2017-06-26 13:17:00 -04:00
Paul Michali a2a99c786a IPv6 support for getting node IP
As part of ChooseHostInterface(), it will call a function to try to get the
global IP for the host, by looking at all the system interfaces and select
the first IP that is not a loopback, link-local, or point-to-point IP.

This commit does the following:

- Allows IPv6 non-local IPs to be selected.
- IPv4 takes priority (checks all interfaces for IPv4 addresses and
  then checks all interfaces for IPv6), for backward compatibility.
- Adds UTs for code coverage (was no coverage of underlying function),
  increasing from 62% to 84%.
- Improved logging and reporting for error conditions.
- Minor renaming of functions and variables for readability.
2017-06-26 13:13:17 +00:00
Kubernetes Submit Queue df7f4b3526 Merge pull request #47975 from deads2k/api-14-proto
Automatic merge from submit-queue (batch tested with PRs 46425, 47975)

make proto time precision match json

json readers/writers see second precision, but protobuf readers/writers seen nanosecond precision.  This means that a json client can read and write and accidentally mutate fields as seen by protobuf clients.

This makes the precision consistent.

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

```release-note
Update protobuf time serialization for a one second granularity
```
2017-06-26 05:49:40 -07:00
Hongchao Deng 9ee991837c apiextensions-apiserver: fix build 2017-06-25 19:33:17 -07:00
Kubernetes Submit Queue 06453433c0 Merge pull request #48017 from liggitt/encode-nested
Automatic merge from submit-queue

Plumb preferred version to nested object encoder

Fixes https://github.com/kubernetes/kubernetes/issues/48018
2017-06-24 10:24:32 -07:00
Kubernetes Submit Queue beb5b9dd4d Merge pull request #47869 from timothysc/affinity_cleanup
Automatic merge from submit-queue

Removes alpha feature gate for affinity annotations.  

**What this PR does / why we need it**:
In 1.5 we added a backstop to support alpha affinity annotations.  This PR removes that support in favor of the Beta fields per discussions.  

It also serves as a precursor to some of the component config work that @ncdc has done around @mikedanese design proposal.  

xref: https://github.com/kubernetes/kubernetes/pull/41617 

**Special notes for your reviewer**:

**Release note**:

```
Removes alpha feature gate for pod affinity annotations.  
```

/cc @kubernetes/sig-scheduling-pr-reviews @kubernetes/sig-cluster-lifecycle-misc
2017-06-24 06:11:42 -07:00
Kubernetes Submit Queue b042c76d10 Merge pull request #47936 from caesarxuchao/test-api-dependency
Automatic merge from submit-queue (batch tested with PRs 47650, 47936, 47939, 47986, 48006)

External dependency of k8s.io/api

Fix https://github.com/kubernetes/kubernetes/issues/48007

It's unfortunate that k8s.io/api has external dependencies.

Most of the dependencies are introduced by "k8s.io/apimachinery/pkg/util/intstr" and ugorji.
2017-06-24 05:15:40 -07:00
Kubernetes Submit Queue 714f97d7ba Merge pull request #47740 from liggitt/websocket-protocol
Automatic merge from submit-queue

Add token authentication method for websocket browser clients

Closes #47967

Browser clients do not have the ability to set an `Authorization` header programatically on websocket requests. All they have control over is the URL and the websocket subprotocols sent (see https://developer.mozilla.org/en-US/docs/Web/API/WebSocket)

This PR adds support for specifying a bearer token via a websocket subprotocol, with the format `base64url.bearer.authorization.k8s.io.<encoded-token>`

1. The client must specify at least one other subprotocol, since the server must echo a selected subprotocol back
2. `<encoded-token>` is `base64url-without-padding(token)`

This enables web consoles to use websocket-based APIs (like watch, exec, logs, etc) using bearer token authentication.

For example, to authenticate with the bearer token `mytoken`, the client could do:
```js
var ws = new WebSocket(
  "wss://<server>/api/v1/namespaces/myns/pods/mypod/logs?follow=true",
  [
    "base64url.bearer.authorization.k8s.io.bXl0b2tlbg",
    "base64.binary.k8s.io"
  ]
);
```

This results in the following headers:
```
Sec-WebSocket-Protocol: base64url.bearer.authorization.k8s.io.bXl0b2tlbg, base64.binary.k8s.io
```

Which this authenticator would recognize as the token `mytoken`, and if authentication succeeded, hand off to the rest of the API server with the headers
```
Sec-WebSocket-Protocol: base64.binary.k8s.io
```

Base64-encoding the token is required, since bearer tokens can contain characters a websocket protocol may not (`/` and `=`)

```release-note
Websocket requests may now authenticate to the API server by passing a bearer token in a websocket subprotocol of the form `base64url.bearer.authorization.k8s.io.<base64url-encoded-bearer-token>`
```
2017-06-24 00:34:41 -07:00
Kubernetes Submit Queue aee3c5ae87 Merge pull request #47973 from sjenning/include-obj-fieldpath-event-key
Automatic merge from submit-queue

include object fieldpath in event key

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

#47462 exposed a bug where `getEventKey()` only keys on event fields that are common at the pod level. Events generated by different containers in the same pod will yield identical event keys.  This results in events with the same message from different containers in a pod being aggregated in error.

This wasn't a problem before as the event message contained container specific information and thus didn't produce the same event key.

@derekwaynecarr @dhilipkumars @dchen1107
2017-06-23 19:51:53 -07:00
Jordan Liggitt 49b51c2de8
Plumb preferred version to nested object encoder 2017-06-23 22:09:03 -04:00
Kubernetes Submit Queue ed3c50a755 Merge pull request #47845 from liggitt/remove-redirect
Automatic merge from submit-queue (batch tested with PRs 47993, 47892, 47591, 47469, 47845)

Remove redirect verb parsing

The redirect verb was removed pre-1.0 in https://github.com/kubernetes/kubernetes/pull/9826 so the request parsing logic is dead code

Diff best viewed without whitespace:
https://github.com/kubernetes/kubernetes/pull/47845/files?w=1
2017-06-23 18:05:52 -07:00