Commit Graph

1611 Commits (ebf24c14a916adebc37023be69f112d2c97759a9)

Author SHA1 Message Date
Kubernetes Submit Queue 5bbdfc6661 Merge pull request #48544 from sttts/sttts-typed-deepcopy-1.8
Automatic merge from submit-queue (batch tested with PRs 46094, 48544, 48807, 49102, 44174)

Static deepcopy – phase 1

This PR is the follow-up of https://github.com/kubernetes/kubernetes/pull/36412, replacing the
dynamic reflection based deepcopy with static DeepCopy+DeepCopyInto methods on API types.

This PR **does not yet** include the code dropping the cloner from the scheme and all the
porting of the calls to scheme.Copy. This will be part of a follow-up "Phase 2" PR.

A couple of the commits will go in first:
- [x] audit: fix deepcopy registration  https://github.com/kubernetes/kubernetes/pull/48599
- [x] apimachinery+apiserver: separate test types in their own packages #48601 
- [x] client-go: remove TPR example #48604
- [x] apimachinery: remove unneeded GetObjectKind() impls #48608 
- [x] sanity check against origin, that OpenShift's types are fine for static deepcopy https://github.com/deads2k/origin/pull/34

TODO **after** review here:
- [x] merge https://github.com/kubernetes/gengo/pull/32 and update vendoring commit
2017-07-18 11:20:51 -07:00
Kubernetes Submit Queue ac742fa9f2 Merge pull request #46094 from atlassian/sync-informer-run
Automatic merge from submit-queue (batch tested with PRs 46094, 48544, 48807, 49102, 44174)

Shared Informer Run blocks until all goroutines finish

**What this PR does / why we need it**:
Makes Shared Informer Run method block until all goroutines it spawned finish. See #45454.

**Which issue this PR fixes**
Fixes #45454

**Release note**:
```release-note
NONE
```
2017-07-18 11:20:48 -07:00
Kubernetes Submit Queue 6b78eeca84 Merge pull request #48686 from jianglingxia/jlx71015
Automatic merge from submit-queue

amend the comment

**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
```NONE
2017-07-18 09:13:57 -07:00
Kubernetes Submit Queue 08d9893998 Merge pull request #49010 from huangjiuyuan/fix-audit-log-flag-check
Automatic merge from submit-queue (batch tested with PRs 48576, 49010)

adding validations on kube-apiserver audit log options

**What this PR does / why we need it**:
The kube-apiserver does not check the validity of the following audit log options `--audit-log-maxage`, `--audit-log-maxage`, `--audit-log-maxage`. If these options are set to negative numbers, the kube-apiserver will not detect these invalid settings. This PR adds validations on these audit log options.

**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-18 00:35:45 -07:00
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
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
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
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 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
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