Commit Graph

1573 Commits (ea78fe40db4668032abd6f83f03e427648fa0c53)

Author SHA1 Message Date
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
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
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