Commit Graph

2144 Commits (f32b390cf08a9afd9f9899e0d97a90eb162b32a8)

Author SHA1 Message Date
Clayton Coleman 42d410fdde
Switch to use pkg/apis/meta/v1/unstructured and the new interfaces
Avoid directly accessing an unstructured type if it is not required.
2016-12-10 18:05:28 -05:00
Davanum Srinivas bbd04cde41 Better deal with failures under golang 1.8beta1
If there is any error in the initial parsing then we should just
try adding the scheme.

url.Parse(base) has changed in 1.8. Please see the following change
c5ccbdd22b

Fixes #38380
2016-12-09 14:15:02 -05:00
Wojciech Tyczynski aa7da5231f Update bazel files 2016-12-09 09:42:02 +01:00
Wojciech Tyczynski e8d1cba875 GetOptions in client calls 2016-12-09 09:42:01 +01:00
Wojciech Tyczynski cff55e5894 Autogenerate clients 2016-12-09 09:42:01 +01:00
Jordan Liggitt da15bd9260
Update client status generator to not use json tags 2016-12-08 21:58:01 -05:00
Kubernetes Submit Queue 129413aabd Merge pull request #38413 from timothysc/leaselogs
Automatic merge from submit-queue (batch tested with PRs 38413, 37164)

Update leaderelection logging per user feedback.

<!--  Thanks for sending a pull request!  Here are some tips for you:
1. If this is your first time, read our contributor guidelines https://github.com/kubernetes/kubernetes/blob/master/CONTRIBUTING.md and developer guide https://github.com/kubernetes/kubernetes/blob/master/docs/devel/development.md
2. If you want *faster* PR reviews, read how: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/faster_reviews.md
3. Follow the instructions for writing a release note: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/pull-requests.md#release-notes
-->

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

Cleans up log spam, per user feedback. 

fixes #34594

**Release note**:
<!--  Steps to write your release note:
1. Use the release-note-* labels to set the release note state (if you have access) 
2. Enter your extended release note in the below block; leaving it blank means using the PR title as the release note. If no release note is required, just write `NONE`. 
-->
```
NONE
```
2016-12-08 18:08:52 -08:00
Kubernetes Submit Queue a4c9c32657 Merge pull request #37998 from ymqytw/add_test_for_concurrent_evictions
Automatic merge from submit-queue (batch tested with PRs 36071, 32752, 37998, 38350, 38401)

Add test for concurrent evictions requests

This is a followup PR after #37668.
Add a test case to make sure concurrent eviction requests can be handled.

@davidopp @lavalamp
2016-12-08 16:25:56 -08:00
Timothy St. Clair ad5f323ff7 Update leaderelection logging per user feedback.
Fixes #34594
2016-12-08 15:46:06 -06:00
Kubernetes Submit Queue 1199d42210 Merge pull request #36702 from fabxc/client-metrics
Automatic merge from submit-queue (batch tested with PRs 37701, 36702, 37145, 37424, 38261)

Limit unbound label cardinality on request errors

This converts all request errors to the string `<error>` instead of
passing the full error string. Error strings can have arbitrary values
and thus have a cardinality that is not suitable for a metric
use case.

Inspecting individual errors is a logging use case which can be handled separately by registering a client error handler.

@kubernetes/sig-instrumentation
2016-12-08 04:39:20 -08:00
Kubernetes Submit Queue 9a89e8cdcb Merge pull request #35679 from xilabao/fix-repeat-request-for-auth
Automatic merge from submit-queue (batch tested with PRs 35884, 37305, 37369, 37429, 35679)

fix repeat request for auth

reference to  #27851

When use basic-auth/RBAC, don't set the users in .kube/config

```
# cat ~/.kube/config
apiVersion: v1
clusters:
- cluster:
    insecure-skip-tls-verify: true
    server: https://127.0.0.1:6443
  name: ubuntu
contexts:
- context:
    cluster: ubuntu
    namespace: default
    user: test
  name: ubuntu
current-context: ubuntu
kind: Config
preferences: {}
users: []
```

kubectl request for username/password  time after time

```
$ kubectl get nodes
Please enter Username: admin
Please enter Password: ******
Please enter Username: admin
Please enter Password: ******
```
2016-12-08 03:55:19 -08:00
Kubernetes Submit Queue d9414bca99 Merge pull request #37463 from tanshanshan/comment-modify
Automatic merge from submit-queue (batch tested with PRs 36626, 37294, 37463, 37943, 36541)

Modify wrong comment

<!--  Thanks for sending a pull request!  Here are some tips for you:
1. If this is your first time, read our contributor guidelines https://github.com/kubernetes/kubernetes/blob/master/CONTRIBUTING.md and developer guide https://github.com/kubernetes/kubernetes/blob/master/docs/devel/development.md
2. If you want *faster* PR reviews, read how: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/faster_reviews.md
3. Follow the instructions for writing a release note: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/pull-requests.md#release-notes
-->

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

Modify wrong comment

Thanks!

**Special notes for your reviewer**:

**Release note**:
<!--  Steps to write your release note:
1. Use the release-note-* labels to set the release note state (if you have access) 
2. Enter your extended release note in the below block; leaving it blank means using the PR title as the release note. If no release note is required, just write `NONE`. 
-->
```release-note
```
2016-12-08 00:23:13 -08:00
ymqytw 83a0373926 copy eviction from internal clientset to release_1_5 clientset 2016-12-07 13:24:34 -08:00
deads2k 8ae8bf02a4 regenerate informers 2016-12-07 07:54:04 -05:00
deads2k 97854b8de5 update informer generator 2016-12-07 07:48:24 -05:00
Kubernetes Submit Queue 653fd97ba0 Merge pull request #37966 from p0lyn0mial/unify_restmapping_and_restmappings
Automatic merge from submit-queue (batch tested with PRs 38185, 37966)

decided to extract common logic for RESTMapping and RESTMappings to a…

<!--  Thanks for sending a pull request!  Here are some tips for you:
1. If this is your first time, read our contributor guidelines https://github.com/kubernetes/kubernetes/blob/master/CONTRIBUTING.md and developer guide https://github.com/kubernetes/kubernetes/blob/master/docs/devel/development.md
2. If you want *faster* PR reviews, read how: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/faster_reviews.md
3. Follow the instructions for writing a release note: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/pull-requests.md#release-notes
-->

**What this PR does / why we need it**: the changes introduced in this PR extract common logic of RESTMapping and RESTMappings to one common method. 

**Special notes for your reviewer**: this is my first PR - be polite.



The only change in logic to what was before is when calling commonRESTMappings from RESTMapping
we search all defaultGroupVersion as opposed to just one when no mapping was found for provided versions.
2016-12-06 06:49:25 -08:00
p0lyn0mial 5f8e774517 extended RESTMappings method by a version parameter.
RESTMapping method can now rely on RESTMappings by passing versions parameter and taking the first match found by RESTMappings method. In addition
a UT that test the new method has been added.

The only change in logic to what was before is when calling RESTMapping
we search all defaultGroupVersion as opposed to just one when no mapping was found for provided versions.
2016-12-05 20:09:36 +01:00
Kubernetes Submit Queue 45a436ac24 Merge pull request #36909 from sttts/sttts-discovery-with-verbs
Automatic merge from submit-queue (batch tested with PRs 37370, 37003, 36909)

Add verbs to APIResourceInfo for discovery

Verbs will be used by generic controllers (gc, namespace) to avoid unnecessary API calls, reducing load on the apiserver. E.g. not all objects can be deleted.

Example:
```json
{
  "kind": "APIResourceList",
  "apiVersion": "v1",
  "groupVersion": "batch/v1",
  "resources": [
    {
      "name": "jobs",
      "namespaced": true,
      "kind": "Job",
      "verbs": [
        "create",
        "delete",
        "deletecollection",
        "get",
        "list",
        "update",
        "watch"
      ]
    },
    {
      "name": "jobs/status",
      "namespaced": true,
      "kind": "Job",
      "verbs": [
        "create",
        "get"
      ]
    }
  ]
}
```
2016-12-05 06:48:41 -08:00
deads2k 61b5585bac add auth proxy roundtripper 2016-12-05 08:18:47 -05:00
Dr. Stefan Schimanski 2dff13f332 Update generated files 2016-12-05 12:42:31 +01:00
Dr. Stefan Schimanski 458d2b2fe4 Add verb support for discovery client 2016-12-05 12:36:05 +01:00
Kubernetes Submit Queue 68ca638164 Merge pull request #35672 from zlabjp/fix-list-and-watch-goroutine-leak
Automatic merge from submit-queue

Fix resync goroutine leak in ListAndWatch

<!--  Thanks for sending a pull request!  Here are some tips for you:
1. If this is your first time, read our contributor guidelines https://github.com/kubernetes/kubernetes/blob/master/CONTRIBUTING.md and developer guide https://github.com/kubernetes/kubernetes/blob/master/docs/devel/development.md
2. If you want *faster* PR reviews, read how: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/faster_reviews.md
3. Follow the instructions for writing a release note: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/pull-requests.md#release-notes
-->

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

This PR fixes resync goroutine leak in ListAndWatch function

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

fixes #35015

**Special notes for your reviewer**:

**Release note**:

<!--  Steps to write your release note:
1. Use the release-note-* labels to set the release note state (if you have access) 
2. Enter your extended release note in the below block; leaving it blank means using the PR title as the release note. If no release note is required, just write `NONE`. 
-->

``` release-note
```

Previously, we had no way to stop resync goroutine when ListAndWatch
returned.  goroutine leaked every time ListAndWatch returned, for
example, with error.  This commit adds another channel to signal that
resync goroutine should exit when ListAndWatch returns.
2016-12-05 02:41:33 -08:00
Kubernetes Submit Queue ce0d2ac8ee Merge pull request #37688 from nvartolomei/reflector-handle-store-errors
Automatic merge from submit-queue

Add error handling for store operations in cache/reflector

In my opinion the errors there should be returned, but to have minimal impact I just added runtime error handler.

Let me know what you think.
2016-12-04 10:04:45 -08:00
Clayton Coleman 3454a8d52c
refactor: update bazel, codec, and gofmt 2016-12-03 19:10:53 -05:00
Clayton Coleman 5df8cc39c9
refactor: generated 2016-12-03 19:10:46 -05:00
Kubernetes Submit Queue f3d463f114 Merge pull request #37643 from ncdc/informer-gen
Automatic merge from submit-queue (batch tested with PRs 35300, 36709, 37643, 37813, 37697)

Add generated informers

Add informer-gen and the informers it generates. We'll do follow-up PRs to convert everything currently using the hand-written informers to the generated ones.

TODO:

- [x] switch to `GroupVersionResource`
- [x] finish godoc

@deads2k @caesarxuchao @sttts @liggitt
2016-12-03 08:55:57 -08:00
Kubernetes Submit Queue ee3289cce5 Merge pull request #36755 from deads2k/cli-09-extend-impersonate
Automatic merge from submit-queue (batch tested with PRs 36263, 36755, 37357, 37222, 37524)

add other impersonation fields to transport

Adds the group and extra fields to the impersation options in a rest and transport config.

@kubernetes/sig-auth
2016-12-02 16:26:45 -08:00
juanvallejo 885b7a6da8 Add restclientconfig helper fn for parsing timeout
This patch adds a package `pkg/client/unversioned/clientcmd/util` and
defines a `ParseTimeout` helper function for parsing time from a
user-defined string. This allows code re-use in other packages that
require the creation of a new restclient (and therefore must set the
`--global-timeout` flag value manually).
2016-12-02 13:25:03 -05:00
Tatsuhiro Tsujikawa 991674380b Fix resync goroutine leak in ListAndWatch
Previously, we had no way to stop resync goroutine when ListAndWatch
returned.  goroutine leaked every time ListAndWatch returned, for
example, with error.  This commit adds another channel to signal that
resync goroutine should exit when ListAndWatch returns.
2016-12-02 15:26:25 +09:00
Nicolae Vartolomei c6733f1c9e Handle cache/reflector errors when updating objects in store 2016-12-01 21:09:28 +02:00
Andy Goldstein 3bc87f9338 Add generated informers 2016-11-30 09:17:12 -05:00
tanshanshan 64cab5e8b3 modify wrong comment 2016-11-30 09:54:41 +08:00
Clayton Coleman 35a6bfbcee
generated: refactor 2016-11-23 22:30:47 -06:00
Chao Xu bcc783c594 run hack/update-all.sh 2016-11-23 15:53:09 -08:00
Chao Xu 98a82de6d1 dependencies: pkg/client 2016-11-23 15:53:09 -08:00
ymqytw 3cc294b1e0 Revert "support patch list of primitives"
This reverts commit 34891ad9f6.
2016-11-22 21:06:36 -08:00
ymqytw d248843b65 Revert "try old patch after new patch fails"
This reverts commit f32696e734.
2016-11-22 21:02:30 -08:00
xilabao 8d4df82d56 fix repeat request for auth 2016-11-22 11:17:38 +08:00
Kubernetes Submit Queue 0fd70a4990 Merge pull request #36444 from soltysh/issue31481
Automatic merge from submit-queue

Read all resources for finalization and gc, not just preferred

Fixes #31481. 

Currently when starting namespace controller or garbage collector we only gather preferred version resources, which in case of multiple versions (you guessed it `batch/v2alpha1.CronJobs` again) isn't sufficient. This PR adds additional method which actually retrieves all resources from all versions and works on them.

@kubernetes/sig-api-machinery ptal
2016-11-21 15:19:59 -08:00
Maciej Szulik 4401c814fc Read resources from all versions for finalization and gc
If the same resource exists in more then one version, only the preferred
version one will be returned.
2016-11-18 23:31:52 +01:00
ymqytw f32696e734 try old patch after new patch fails 2016-11-17 14:28:09 -08:00
deads2k ef19bf8413 add other impersonation fields to transport 2016-11-15 08:10:30 -05:00
Fabian Reinartz a247736f2a Limit unbound label cardinality on request errors
This converts all request errors to the string `<error>` instead of
passing the full error string. Error strings can have arbitrary values
and thus have a cardinality that is not suitable for a metric
use case.
2016-11-12 18:37:20 +01:00
Kubernetes Submit Queue 3e169be887 Merge pull request #35647 from ymqytw/patch_primitive_list
Automatic merge from submit-queue

Fix strategic patch for list of primitive type with merge sementic

Fix strategic patch for list of primitive type when the patch strategy is `merge`.
Before: we cannot replace or delete an item in a list of primitive, e.g. string, when the patch strategy is `merge`. It will always append new items to the list.
This patch will generate a map to update the list of primitive type.
The server with this patch will accept either a new patch or an old patch.
The client will found out the APIserver version before generate the patch.

Fixes #35163, #32398

cc: @pwittrock @fabianofranz 

``` release-note
Fix strategic patch for list of primitive type when patch strategy is `merge` to remove deleted objects.
```
2016-11-11 14:36:44 -08:00
Marcin 324368ea98 Switch pod eviction client from v1alpha1 to v1beta. 2016-11-11 19:34:29 +01:00
Kubernetes Submit Queue 850f2bf1fd Merge pull request #35382 from jbeda/nits
Automatic merge from submit-queue

Expand documentation and TODOs in a few packages

I was reading through unfamiliar code and mostly added TODOs and expanded and clarified documentations.

There are a couple of things that are real code changes:
- Removed some unused constants
- Changed `workqueue.Parallize` to clamp the number of worker goroutines to the number of items to be processed.
- Added another unit test to `workqueue.queue`.  I thought I found a bug (I was wrong) and wrote a unit test to isolate.  I figure the extra test is worth keeping.
2016-11-10 17:48:06 -08:00
ymqytw 34891ad9f6 support patch list of primitives 2016-11-09 11:46:59 -08:00
Kubernetes Submit Queue 866293b704 Merge pull request #33366 from rhcarvalho/execincontainer-timeout-argument
Automatic merge from submit-queue

Add timeout argument to ExecInContainer

<!--  Thanks for sending a pull request!  Here are some tips for you:
1. If this is your first time, read our contributor guidelines https://github.com/kubernetes/kubernetes/blob/master/CONTRIBUTING.md and developer guide https://github.com/kubernetes/kubernetes/blob/master/docs/devel/development.md
2. If you want *faster* PR reviews, read how: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/faster_reviews.md
3. Follow the instructions for writing a release note: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/pull-requests.md#release-notes
-->

**What this PR does / why we need it**: This is related to https://github.com/kubernetes/kubernetes/issues/26895. It brings a timeout to the signature of `ExecInContainer` so that we can take timeouts into account in the future. Unlike my first attempt in https://github.com/kubernetes/kubernetes/pull/27956, it doesn't immediately observe the timeout, because it is impossible to do it with the current state of the Docker Remote API (the default exec handler implementation).

**Special notes for your reviewer**: This shares commits with https://github.com/kubernetes/kubernetes/pull/27956, but without some of them that have more controversial implications (actually supporting the timeouts). The original PR shall be closed in the current state to preserve the history (instead of dropping commits in that PR).

Pinging the original people working on this change: @ncdc @sttts @vishh @dims 

**Release note**:

<!--  Steps to write your release note:
1. Use the release-note-* labels to set the release note state (if you have access) 
2. Enter your extended release note in the below block; leaving it blank means using the PR title as the release note. If no release note is required, just write `NONE`. 
-->

``` release-note
NONE
```
2016-11-08 01:41:19 -08:00
Kubernetes Submit Queue 13cc43af82 Merge pull request #35483 from ymqytw/use_evict_for_drain
Automatic merge from submit-queue

Fix kubectl drain for statefulset

Support deleting pets for `kubectl drain`. 
Use evict to delete pods.

Fixes: #33727

```release-note
Adds support for StatefulSets in kubectl drain.
Switches to use the eviction sub-resource instead of deletion in kubectl drain, if server supports.
```

@foxish @caesarxuchao
2016-11-07 17:42:08 -08:00
ymqytw b73fae6c55 Fix kubectl drain for statefulset and use eviciton for drain if possible 2016-11-07 16:13:06 -08:00
Rodolfo Carvalho 506129ba4e Add timeout argument to ExecInContainer
This allows us to interrupt/kill the executed command if it exceeds the
timeout (not implemented by this commit).

Set timeout in Exec probes. HTTPGet and TCPSocket probes respect the
timeout, while Exec probes used to ignore it.

Add e2e test for exec probe with timeout. However, the test is skipped
while the default exec handler doesn't support timeouts.
2016-11-07 13:00:59 +01:00
Maciej Szulik 8216e47b6a Generated changes 2016-11-07 11:26:50 +01:00
Maciej Szulik 41d88d30dd Rename ScheduledJob to CronJob 2016-11-07 10:14:12 +01:00
Kubernetes Submit Queue f7e0c6c19e Merge pull request #35418 from sttts/sttts-discovery-cache
Automatic merge from submit-queue

Add caching for discovery info with invalidation on cache-miss

TODO:
- [x] write tests for `CachedDiscoveryClient`
- [x] write tests for `DeferredDiscoveryRESTMapper` on cache-miss
- [x] find better way/structure to get rid of `invalidateCh` in c06ba3175b
2016-11-06 20:10:57 -08:00
Kubernetes Submit Queue 5396cbf2a6 Merge pull request #36038 from caesarxuchao/add-versioned-expansions
Automatic merge from submit-queue

Add missing expansion files to versioned clientset

I copied the expansion functions that only existed in the internalclientset to release_1_5.

Most changes are mechanical. This is needed for migrating k8s to use versioned clientset, so I add the 1.5 milestone.
2016-11-06 11:38:11 -08:00
Dr. Stefan Schimanski c8513c31a1 Update bazel 2016-11-04 21:17:12 +01:00
Dr. Stefan Schimanski 14ce6f6065 Add caching for discovery info 2016-11-04 21:17:12 +01:00
Joe Beda e0c6bf13b1
TODOs around stopping informers 2016-11-04 09:28:11 -07:00
Joe Beda 453bb17c3c
Remove constants that are no longer referenced 2016-11-04 09:28:11 -07:00
Andy Goldstein 8c923faf74 Switch to JobLister 2016-11-03 20:41:40 -04:00
Andy Goldstein 8e10413468 Regenerate listers 2016-11-03 20:41:32 -04:00
Kubernetes Submit Queue f0ca9fbd9e Merge pull request #35567 from mwielgus/allowed_disruptions_b2
Automatic merge from submit-queue

Switch DisruptionBudget api from bool to int allowed disruptions [only v1beta1]

Continuation of #34546. Apparently it there is some bug that prevents us from having 2 different incompatibile version of API in integration tests. So in this PR v1alpha1 is removed until testing infrastructure is fixed.

Base PR comment:

Currently there is a single bool in disruption budget api that denotes whether 1 pod can be deleted or not. Every time a pod is deleted the apiserver filps the bool to false and the disruptionbudget controller sets it to true if more deletions are allowed. This works but it is far from optimal when the user wants to delete multiple pods (for example, by decreasing replicaset size from 10000 to 8000).
This PR adds a new api version v1beta1 and changes bool to int which contains a number of pods that can be deleted at once.

cc: @davidopp @mml @wojtek-t @fgrzadkowski @caesarxuchao
2016-11-03 15:50:19 -07:00
Kubernetes Submit Queue 7c391158e3 Merge pull request #35810 from deads2k/client-18-decode-status
Automatic merge from submit-queue

always allow decoding of status when returned from the API

`unversioned.Status` should be able to come back from any API version and still be properly decoded.  This doesn't happen today by default.

@smarterclayton  Our projectrequest endpoint returns a `Status` object on a 200 return from list to indicate everything went well.  This (or something like it) is needed to make the API accepted by `kubectl`.  Alternatively, we change the API to return a different (still not a `Project`) value from list, which still feels wrong.
2016-11-03 11:18:23 -07:00
Marcin 3872a47074 Autogenerated code and docs 2016-11-03 18:36:32 +01:00
Kubernetes Submit Queue f91cd17821 Merge pull request #35799 from deads2k/client-17-negotiation
Automatic merge from submit-queue

clean up client version negotiation to handle no legacy API

Version negotiation fails if the legacy API endpoint isn't available.

This tightens up the negotiation interface based to more clearly express what each stage is doing and what the constraints on negotiation are.  This is needed to speak to generic API servers.

@kubernetes/kubectl
2016-11-03 07:53:47 -07:00
Janet Kuo c25455e8b3 (Auto-gen) Run hack/update-all & update-bazel & update linted packages 2016-11-02 15:16:41 -07:00
Janet Kuo c15b9470f5 Replace apps/v1alpha1 with apps/v1beta1 and manually remove generated apps/v1alpha1 files
Manually remove generated apps/v1alpha1 types, protobuf, and api-reference doc files
Manually remove apps/v1alpha1 folder from 1.5 generated client
2016-11-02 15:16:23 -07:00
Kubernetes Submit Queue 7d14b568c3 Merge pull request #36001 from smarterclayton/change_double_decode
Automatic merge from submit-queue

Avoid double decoding all client responses

Fixes #35982 

The linked issue uncovered that we were always double decoding the response in restclient for get, list, update, create, and patch.  That's fairly expensive, most especially for list.  This PR refines the behavior of the rest client to avoid double decoding, and does so while minimizing the changes to rest client consumers.

restclient must be able to deal with multiple types of servers. Alter the behavior of restclient.Result#Raw() to not process the body on error, but instead to return the generic error (which still matches the error checking cases in api/error like IsBadRequest). If the caller uses
.Error(), .Into(), or .Get(), try decoding the body as a Status.

For older servers, continue to default apiVersion "v1" when calling restclient.Result#Error(). This was only for 1.1 servers and the extensions group, which we have since fixed.

This removes a double decode of very large objects (like LIST) - we were trying to DecodeInto status, but that ends up decoding the entire result and then throwing it away.  This makes the decode behavior specific to the type of action the user wants.

```release-note
The error handling behavior of `pkg/client/restclient.Result` has changed.  Calls to `Result.Raw()` will no longer parse the body, although they will still return errors that react to `pkg/api/errors.Is*()` as in previous releases.  Callers of `Get()` and `Into()` will continue to receive errors that are parsed from the body if the kind and apiVersion of the body match the `Status` object.

This more closely aligns rest client as a generic RESTful client, while preserving the special Kube API extended error handling for the `Get` and `Into` methods (which most Kube clients use).
```
2016-11-02 11:36:41 -07:00
Chao Xu ca70b19554 run update-bazel.sh 2016-11-01 23:33:23 -07:00
Chao Xu 36f11c4b21 copy missing expansion files to release_1_5 2016-11-01 23:32:40 -07:00
Clayton Coleman ce187f9c6a
Avoid double decoding all client responses
restclient must be able to deal with multiple types of servers. Alter
the behavior of restclient.Result#Raw() to not process the body on
error, but instead to return the generic error (which still matches the
error checking cases in api/error like IsBadRequest). If the caller uses
.Error(), .Into(), or .Get(), try decoding the body as a Status.

For older servers, continue to default apiVersion "v1" when calling
restclient.Result#Error(). This was only for 1.1 servers and the
extensions group, which we have since fixed.

This removes a double decode of very large objects (like LIST).
2016-11-01 22:55:51 -04:00
Mike Danese bdcb4a9784 remove orphaned build file 2016-11-01 15:13:40 -07:00
Mike Danese 1c89526963 autogenerated 2016-11-01 15:13:27 -07:00
deads2k 235678d591 always allow decoding of status when returned from the API 2016-11-01 16:36:45 -04:00
Kubernetes Submit Queue 1fa8369074 Merge pull request #35639 from ncdc/lister-gen
Automatic merge from submit-queue

Add tooling to generate listers

Add lister-gen tool to auto-generate listers. So far this PR only demonstrates replacing the manually-written `StoreToLimitRangeLister` with the generated `LimitRangeLister`, as it's a small and easy swap.

cc @deads2k @liggitt @sttts @nikhiljindal @lavalamp @smarterclayton @derekwaynecarr  @kubernetes/sig-api-machinery @kubernetes/rh-cluster-infra
2016-11-01 09:29:06 -07:00
Chao Xu 4cf7adf937 remove release_1_4
remove archived federation clientsets
update README
2016-10-31 15:05:26 -07:00
deads2k bae940df5c clean up client version negotiation to handle no legacy API 2016-10-31 16:05:50 -04:00
Andy Goldstein 13abf36c60 Update bazel build files 2016-10-31 11:13:44 -04:00
Andy Goldstein 7b85985a72 Add generated listers 2016-10-31 11:13:43 -04:00
Chao Xu 2044927034 move watch.ListWatchUntil to its own package to avoid future import cycle 2016-10-30 13:14:20 -07:00
Kubernetes Submit Queue a06a08a906 Merge pull request #34489 from caesarxuchao/time-copy.sh
Automatic merge from submit-queue

Verify and update client-go staging area for every PR

We need to keep the staging area up-to-date to prevent PRs from breaking client-go.

It's marked as "WIP" because we need to decide the [versioning strategy](https://github.com/kubernetes/client-go/issues/9) for client-go first. This PR contains breaking changes for client-go.

This is blocking #29934 and potentially #34441

cc @kubernetes/sig-api-machinery
2016-10-29 16:24:07 -07:00
Chao Xu fd2fdfba89 move client/unversioned/fake to client/restclient/fake 2016-10-29 14:22:02 -07:00
Chao Xu 850729bfaf include multiple versions in clientset
update client-gen to use the term "internalversion" rather than "unversioned";
leave internal one unqualified;
cleanup client-gen
2016-10-29 13:30:47 -07:00
Kubernetes Submit Queue 620788a795 Merge pull request #35230 from deads2k/controller-12-sa-controller
Automatic merge from submit-queue

convert SA controller to shared informers

convert the SA controller to shared informer + workqueue.

I think one of @derekwaynecarr @ncdc or @liggitt
2016-10-29 10:09:46 -07:00
Kubernetes Submit Queue 17e4156163 Merge pull request #35785 from piosz/clientset
Automatic merge from submit-queue

Removed 1.3 clientset

needed for #35782
2016-10-29 08:37:04 -07:00
Clayton Coleman ca2f1b87ad
Replace negotiation with a new method that can extract info
Alter how runtime.SerializeInfo is represented to simplify negotiation
and reduce the need to allocate during negotiation. Simplify the dynamic
client's logic around negotiating type. Add more tests for media type
handling where necessary.
2016-10-28 11:30:11 -04:00
Piotr Szczesniak 0c4fc2abbf Removed 1.3 clientset 2016-10-28 14:40:47 +02:00
Janet Kuo 3febdb7f71 Remove petset from 1.4 generated client to pass import-boss verification 2016-10-27 17:25:10 -07:00
Janet Kuo 74dbfdca97 (Auto-gen) Run update-all.sh, codecgen, munge docs, and bazel 2016-10-27 17:25:10 -07:00
Janet Kuo f35a095b50 Manually remove previously generated petset client 2016-10-27 17:25:10 -07:00
Janet Kuo e9927664cf Remove unnecessary dependency in client-gen 2016-10-27 17:25:10 -07:00
Janet Kuo 10aee82ae3 Rename PetSet API to StatefulSet 2016-10-27 17:25:10 -07:00
deads2k df4ed892c4 convert SA controller to shared informers 2016-10-27 15:44:46 -04:00
Kubernetes Submit Queue 5423eaf431 Merge pull request #35431 from deads2k/client-16-remove-old
Automatic merge from submit-queue

remove the non-generated client

Removes the non-generated client from kube.  The package has a few methods left, but nothing that needs updating when adding new groups.

@ingvagabund
2016-10-27 05:12:33 -07:00
deads2k 81ae13084d handle non-generated client removal 2016-10-26 16:10:41 -04:00
deads2k 969e945a9e delete non-generated client 2016-10-26 15:14:41 -04:00
Madhusudan.C.S 63e317598c Make the fake RESTClient usable by all the API groups, not just core. 2016-10-26 00:21:23 -07:00
Kubernetes Submit Queue 5ec053719f Merge pull request #35563 from mikedanese/old-clients
Automatic merge from submit-queue

remove old clients from build

<!--  Thanks for sending a pull request!  Here are some tips for you:
1. If this is your first time, read our contributor guidelines https://github.com/kubernetes/kubernetes/blob/master/CONTRIBUTING.md and developer guide https://github.com/kubernetes/kubernetes/blob/master/docs/devel/development.md
2. If you want *faster* PR reviews, read how: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/faster_reviews.md
3. Follow the instructions for writing a release note: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/pull-requests.md#release-notes
-->

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

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

**Special notes for your reviewer**:

**Release note**:
<!--  Steps to write your release note:
1. Use the release-note-* labels to set the release note state (if you have access) 
2. Enter your extended release note in the below block; leaving it blank means using the PR title as the release note. If no release note is required, just write `NONE`. 
-->
```release-note
```
2016-10-25 17:40:38 -07:00
Mike Danese 1682b81295 remove old clients from build 2016-10-25 16:43:19 -07:00
Tim St. Clair 52ed57ec3b
Refactor PortForward server methods into the portforward package 2016-10-25 12:08:35 -07:00
Mike Danese 763c4987f2 autogenerated 2016-10-24 14:47:27 -07:00
Kubernetes Submit Queue 1569a8b04f Merge pull request #35322 from deads2k/controller-14-panic
Automatic merge from submit-queue

prevent panic if resourceversion checked early

Found panic while trying to use this in a separate API server.
2016-10-24 13:38:39 -07:00
deads2k fd65bc8fff prevent panic if resourceversion checked early 2016-10-24 08:25:11 -04:00
Jan Chaloupka 4fde09d308 Replace client with clientset in code 2016-10-23 22:00:35 +02:00
Mike Danese df713b478c fix tests by declaring testdata 2016-10-21 17:32:32 -07:00
Mike Danese 3b6a067afc autogenerated 2016-10-21 17:32:32 -07:00
Kubernetes Submit Queue a7807eb5a4 Merge pull request #34138 from ingvagabund/create-restclient-interface
Automatic merge from submit-queue

Create restclient interface

Refactoring of code to allow replace *restclient.RESTClient with any RESTClient implementation that implements restclient.RESTClientInterface interface.
2016-10-21 16:02:04 -07:00
deads2k a0a0e61f62 add generic shared informer backed by existing informer 2016-10-21 08:39:09 -04:00
Jan Chaloupka 6079053407 Update clientset generator to use RESTClient interface instead of the RESTClient data type 2016-10-21 10:13:51 +02:00
Kubernetes Submit Queue 71471c2330 Merge pull request #34740 from derekwaynecarr/storage-class-informer
Automatic merge from submit-queue

Add an informer for StorageClass

Add an informer for `StorageClass` for later consumption in quota.

/cc @eparis @deads2k @erinboyd
2016-10-20 23:36:58 -07:00
Kubernetes Submit Queue 6306ab00d2 Merge pull request #34845 from derekwaynecarr/make_pvc_informer_list
Automatic merge from submit-queue

PVC informer lister supports listing

This will be used in follow-on PRs for quota evaluation backed by informers for pvcs.

/cc @deads2k @eparis @kubernetes/sig-storage
2016-10-19 19:29:02 -07:00
Chao Xu 45432750df add import restriction to clientset 2016-10-19 11:47:51 -07:00
derekwaynecarr 39da9d19f0 Add an informer for StorageClass 2016-10-19 12:26:57 -04:00
Clayton Coleman 1694cfb72d
Make defaulting part of versioning codec
Most normal codec use should perform defaulting. DirectCodecs should not
perform defaulting. Update the defaulting_test to fuzz the list of known
defaulters. Use the new versioning.NewDefaultingCodec() method.
2016-10-18 21:07:35 -04:00
Kubernetes Submit Queue a31482207f Merge pull request #34960 from sdminonne/serviceaccount_informer
Automatic merge from submit-queue

To add service account informer

@deads2k  this PR adds ServiceAccount informer as discussed [here](https://github.com/openshift/origin/pull/11330#issuecomment-253216303)
2016-10-18 16:21:41 -07:00
Kubernetes Submit Queue 4b7024efe7 Merge pull request #27784 from deads2k/catch-mutators
Automatic merge from submit-queue

add optional mutation checks for shared informer cache

We need to make sure that no one is mutating caches if they're using a shared informer.  It is important that whatever is tracking those changes gets the object *before* anyone else possibly could.

This adds the ability to track the original objects in the cache and their current values.  Go doesn't have an exit hook or a way to say "wait for non-daemon go-funcs to complete before exit", so this runs a gofunc on a loop that can panic the entire process.  It's gated behind an env var.

@derekwaynecarr did I get the right spots to make sure that e2e runs with this flag?
@smarterclayton @kubernetes/rh-cluster-infra
2016-10-18 14:38:57 -07:00
derekwaynecarr 555231fad7 PVC informer lister supports listing 2016-10-18 14:36:33 -04:00
Kubernetes Submit Queue b77e13444f Merge pull request #34939 from wojtek-t/throttle_retried_requests
Automatic merge from submit-queue

Throttle retried requests in client

Fix #34938
2016-10-18 10:08:53 -07:00
deads2k aee54ae57e add optional mutation checks for shared informer cache 2016-10-18 09:19:38 -04:00
Kubernetes Submit Queue e6cc8ff149 Merge pull request #34498 from mml/remotecommand-golint
Automatic merge from submit-queue

Fix lint error in remotecommand.go

Before:

```
pkg/client/unversioned/remotecommand/remotecommand.go:101:9: should omit type http.RoundTripper from declaration of var rt; it will be inferred from the right-hand side

Please fix the above errors. You can test via "golint" and commit the result.
```
2016-10-18 03:35:21 -07:00
Salvatore Dario Minonne a745872b94 To add service account informer 2016-10-18 09:24:54 +02:00
Kubernetes Submit Queue 7414cafbeb Merge pull request #34860 from mbohlool/optional
Automatic merge from submit-queue

+optional tag for OpenAPI spec

OpenAPI rely on "omitempty" json tag to determine if a field is optional or not. This change will add "+optional" tag to all fields with "omitempty" json tag and support the tag in OpenAPI spec generator.
2016-10-17 22:07:00 -07:00
Matt Liggett 805a740d64 Fix lint error in remotecommand.go
Before:

pkg/client/unversioned/remotecommand/remotecommand.go:101:9: should omit type http.RoundTripper from declaration of var rt; it will be inferred from the right-hand side

Please fix the above errors. You can test via "golint" and commit the result.
2016-10-17 17:26:27 -07:00
derekwaynecarr 3c0b35d6b1 Add LimitRange informer 2016-10-17 16:00:26 -04:00
mbohlool 25afcc5522 Add +optional tag to all fields with omitempty json tag 2016-10-17 08:52:13 -07:00
Wojciech Tyczynski 564fc0cc80 Throttle retried requests in client 2016-10-17 11:45:35 +02:00
Kubernetes Submit Queue 13196527cf Merge pull request #34759 from caesarxuchao/remove-unversioned
Automatic merge from submit-queue

Remove imports of "pkg/client/unversioned" in "pkg/controller"

We are trying to deprecate "pkg/client/unversioned", see https://github.com/kubernetes/kubernetes/issues/25442.

Also part of https://github.com/kubernetes/kubernetes/issues/29934.
2016-10-15 00:10:15 -07:00
Kubernetes Submit Queue c0bd6e8ea5 Merge pull request #33958 from juanvallejo/jvallejo/add-global-timeout-flag
Automatic merge from submit-queue

Add global timeout flag

**Release note**:
```release-note
Add a new global option "--request-timeout" to the `kubectl` client
```

UPSTREAM: https://github.com/kubernetes/client-go/pull/10

This patch adds a global timeout flag (viewable with `kubectl -h`) with
a default value of `0s` (meaning no timeout).

The timeout value is added to the default http client, so that zero
values and default behavior are enforced by the client.

Adding a global timeout ensures that user-made scripts won't hang for an
indefinite amount of time while performing remote calls (right now, remote
calls are re-tried up to 10 times when each attempt fails, however, there is
no option to set a timeout in order to prevent any of these 10 attempts from
hanging indefinitely).

**Example**
```
$ kubectl get pods # no timeout flag set - default to 0s (which means no
timeout)
NAME                      READY     STATUS    RESTARTS   AGE
docker-registry-1-h7etw   1/1       Running   1          2h
router-1-uv0f9            1/1       Running   1          2h

$ kubectl get pods --request-timeout=0 # zero means no timeout no timeout flag set
NAME                      READY     STATUS    RESTARTS   AGE
docker-registry-1-h7etw   1/1       Running   1          2h
router-1-uv0f9            1/1       Running   1          2h

$kubectl get pods --request-timeout=1ms
Unable to connect to the server: net/http: request canceled while
waiting for connection (Client.Timeout exceeded while awaiting headers)
```
2016-10-14 23:29:58 -07:00
juanvallejo fd087caadb Add global timeout flag
This patch adds a global timeout flag (viewable with `kubectl -h`) with
a default value of `0s` (meaning no timeout).

The timeout value is added to the default http client, so that zero
values and default behavior are enforced by the client.

**Example**
```
$ kubectl get pods # no timeout flag set - default to 0s (which means no
timeout)
NAME                      READY     STATUS    RESTARTS   AGE
docker-registry-1-h7etw   1/1       Running   1          2h
router-1-uv0f9            1/1       Running   1          2h

$ kubectl get pods --timeout=0 # zero means no timeout no timeout flag set
NAME                      READY     STATUS    RESTARTS   AGE
docker-registry-1-h7etw   1/1       Running   1          2h
router-1-uv0f9            1/1       Running   1          2h

$kubectl get pods --timeout=1ms
Unable to connect to the server: net/http: request canceled while
waiting for connection (Client.Timeout exceeded while awaiting headers)
```
2016-10-14 09:57:40 -04:00
Chao Xu fbd187af45 move the retry util out of pkg/client/unversioned 2016-10-13 16:10:24 -07:00
deads2k 2c4e618be1 add rbac shared informers 2016-10-13 07:50:02 -04:00
deads2k 518d5500c7 remove testapi.Default.GroupVersion 2016-10-07 10:10:54 -04:00
Kubernetes Submit Queue 6d56d0337a Merge pull request #33234 from caesarxuchao/retry-discovery-failure
Automatic merge from submit-queue

Discovery client retry when failed to discovery resrouces

Fix #32308

`ServerPreferredNamespacedResources()` fails if in the middle of its execution, the TPR e2e tests change the supported resources on the API server. This PR let the e2e test framework retry `ServerPreferredNamespacedResources()`.

cc @lavalamp
2016-10-07 05:13:21 -07:00
Kubernetes Submit Queue a89e4785ba Merge pull request #31949 from asalkeld/fix-coverage
Automatic merge from submit-queue

Ignore troublesome paths that cause coverage to fail

**What this PR does / why we need it**:
`KUBE_COVER=y make check` currently fails, this patch fixes it.

**Which issue this PR fixes** 
fixes #31691

**Special notes for your reviewer**:
None

**Release note**:

```release-note
NONE
```

This avoids the whole command failing because of errors like the following:
```
# cover k8s.io/kubernetes/pkg/client/restclient
cover: internal error: block 268 overlaps block 270
```
2016-10-07 02:40:07 -07:00
Kubernetes Submit Queue 83921597ef Merge pull request #29236 from juanvallejo/jvallejo_add-configuration-missing-error-type
Automatic merge from submit-queue

Update client config invalid option errors to be more specific

This patch adds better error handling for cases where a global option (such as --context or --cluster) causes an invalid config to be returned.

```release-note
release-note-none
```
2016-10-07 01:24:49 -07:00
juanvallejo 6f925b1f82
handle invalid client config option errors
This patch provides a more relevant error message when a client
configuration option is passed with an invalid or non-existent value.

`$ kubectl get pods --cluster="non-existent"`
```
error: No configuration file found, please login or point to an existing
file
```

`$ kubectl get pods --cluster="non-existent"`
```
error: cluster "non-existent" does not exist
```
2016-10-06 16:28:51 -04:00
Kubernetes Submit Queue 42e5f95a6b Merge pull request #34024 from deads2k/controller-06-deployment-controller
Automatic merge from submit-queue

update deployment and replicaset listers

Updates the deployment lister to avoid copies and updates the deployment controller to use shared informers.

Pushing WIP to see which tests are broken.
2016-10-06 00:02:34 -07:00
deads2k c30b2efc46 update replicaset lister 2016-10-05 15:20:27 -04:00
deads2k 358a57d74a update deployment lister 2016-10-05 13:27:35 -04:00
deads2k 8ea2acc6a3 use service accounts as clients for controllers 2016-10-05 13:15:16 -04:00
Kubernetes Submit Queue 0798f02391 Merge pull request #33942 from kargakis/sttts-kubectl-run-watch-until
Automatic merge from submit-queue

Switch kubectl to use watch.Until

Squashed version of https://github.com/kubernetes/kubernetes/pull/30235 

@ncdc PTAL

cc: @kubernetes/kubectl
2016-10-05 08:29:54 -07:00
Wojciech Tyczynski c215bd0eac Fix call to Index call in listers 2016-10-05 14:23:31 +02:00
Chao Xu 04ac4a4020 discovery client retry serverPreferredResources() in case groups changed in the middle 2016-10-04 21:49:53 -07:00
Chao Xu a3861b9cb9 generated 2016-10-04 20:39:29 -07:00
Chao Xu 75cc05de82 manual changes to let client-gen use versioned options 2016-10-04 20:39:29 -07:00
Kubernetes Submit Queue dab787d80d Merge pull request #31755 from smarterclayton/has_synced
Automatic merge from submit-queue

DeltaFIFO should not report HasSynced until deletes are reported

Deletions identified by knownObjects on the initial sync replace
(immediately after the List from a reflector) should be considered part
of the initial sync since we have the information available at the time
we do the deletion.

An error during Replace() can result in Populated not being set, but it
was incorrect before (population would be wrong) and queueActionLocked
does not error except on "my cache is broken because I gave an incorrect
keyFunc".

@lavalamp @deads2k hit this while trying to use DeltaFIFO to implement an "external" controller (one that uses the knownObjects as provided by a call to a remote system of record).

Not 1.4
2016-10-03 15:41:20 -07:00
bindata-mockuser 5ad518cd2b Switch kubectl to use watch.Until 2016-10-03 17:17:41 +02:00
Kubernetes Submit Queue e8ae960af4 Merge pull request #33868 from wongma7/update-1.4-clientset
Automatic merge from submit-queue

Run hack/update-codegen.sh in release-1.4 for generating an updated 1.4 clientset

@caesarxuchao doing steps 1 and 2 as described here https://github.com/kubernetes/kubernetes/pull/33851#issuecomment-250851272

adds apps, authentication, certificates, rbac, and storage.

The reason there are substantial deletions (aside from the oneliner "this package is generated by client-gen with arguments...") is because PR https://github.com/kubernetes/kubernetes/pull/32407 added a resource to the 1.4 clientset even though the resource is not present in 1.4 and the PR is targeted to 1.5. So this corrects that, as a bonus.
2016-10-01 07:01:15 -07:00
Matthew Wong 014239f06b Run hack/update-codegen.sh in release-1.4 2016-09-30 18:21:55 -04:00
Timothy St. Clair 4a9f72b59f Abstraction of endpoints in leaderelection code 2016-09-29 23:42:00 -05:00
Wojciech Tyczynski df8f83fd51 Use multiple clients in load test to avoid "no cached connections" errors. 2016-09-29 16:32:57 +02:00
Kubernetes Submit Queue 4bda90e89c Merge pull request #33645 from kargakis/remove-obsolete-pkg-name
Automatic merge from submit-queue

cache: remove obsolete internal package name

pkg/controller/framework is not a thing since https://github.com/kubernetes/kubernetes/pull/32718

@mikedanese @wojtek-t
2016-09-28 06:55:53 -07:00
Kubernetes Submit Queue dc06ceb87d Merge pull request #32246 from caesarxuchao/fed-1.5
Automatic merge from submit-queue

Update federation controllers to use release 1.5 clientset

This PR is based on #32243, we won't merge it until next week, to make cherry-picks easier.
2016-09-28 04:17:20 -07:00
Michail Kargakis 78dfe52afb cache: remove obsolete internal package name 2016-09-28 11:35:48 +02:00
Kubernetes Submit Queue b2c175c758 Merge pull request #33474 from wojtek-t/user_agent_for_master_election
Automatic merge from submit-queue

Set UserAgent in LeaderElection clients.

Ref https://github.com/kubernetes/kubernetes/issues/33259

@timothysc - FYI
2016-09-27 22:58:08 -07:00
Chao Xu a780db9a03 changes in federation controllers 2016-09-27 14:33:24 -07:00
Clayton Coleman bbd8096065
DeltaFIFO should not report HasSynced until deletes are reported
Deletions identified by knownObjects on the initial sync replace
(immediately after the List from a reflector) should be considered part
of the initial sync since we have the information available at the time
we do the deletion.

An error during Replace() can result in Populated not being set, but it
was incorrect before (population would be wrong) and queueActionLocked
does not error except on "my cache is broken because I gave an incorrect
keyFunc".
2016-09-27 12:56:17 -04:00
Wojciech Tyczynski cbcce2c90f Set UserAgent in LeaderElection clients. 2016-09-27 15:22:40 +02:00
Kubernetes Submit Queue 1e7fa1f6cd Merge pull request #33334 from caesarxuchao/copy-auth-plugin
Automatic merge from submit-queue

Copy auth plugin to client-go repo

client-go doesn't copy the [auth plugin](https://github.com/kubernetes/kubernetes/blob/master/plugin/pkg/client/auth/plugins.go). This causes user cannot access cluster run by GKE. User will see error "No Auth Provider found for name gcp".

This PR fixes this issue. It's marked as WIP because I'll need to rebase after #32906 gets merged. Also, the fix needs to be cherry-picked into 1.4 branch to update client-go/1.4.
2016-09-27 02:30:38 -07:00
Kubernetes Submit Queue 224a16f0ea Merge pull request #33273 from guangxuli/k8s_0922_02
Automatic merge from submit-queue

test file should be remove after test over
2016-09-26 22:29:57 -07:00
guangxuli f2f591aa45 test file should be remove after test over
remove the tmp file

gofmt
2016-09-27 11:56:45 +08:00
Chao Xu a397e306a4 run client-gen
run copy.sh
2016-09-26 15:40:36 -07:00
Chao Xu e17e0b19ab remove special clientrepo code from main repository gcp plugin
rename plugin/pkg/client/auth/plugins.go package name to auth

add the plugin import line in client-gen

update import_known_versions for release_1_5 clientset

change copy.sh
2016-09-26 15:40:29 -07:00
deads2k 48ac4d549d change e2e scale to avoid adapter 2016-09-26 07:58:01 -04:00
Kubernetes Submit Queue 64777d37b6 Merge pull request #33268 from deads2k/client-14-rc-svc-lister
Automatic merge from submit-queue

simplify RC listers

Make the RC and SVC listers use the common list functions that more closely match client APIs, are consistent with other listers, and avoid unnecessary copies.
2016-09-23 23:37:15 -07:00
Kubernetes Submit Queue 071927a59d Merge pull request #32549 from smarterclayton/gc_non_kube_legacy
Automatic merge from submit-queue

Allow garbage collection to work against different API prefixes

The GC needs to build clients based only on Resource or Kind. Hoist the
restmapper out of the controller and the clientpool, support a new
ClientForGroupVersionKind and ClientForGroupVersionResource, and use the
appropriate one in both places.

Allows OpenShift to use the GC
2016-09-23 14:06:35 -07:00
Kubernetes Submit Queue 5f815354e0 Merge pull request #33182 from deads2k/api-13-collapse-script-references
Automatic merge from submit-queue

unify available api group versions in our scripts

There are currently many parallel lists of available group versions with slightly different syntaxes in each one.  This collapses them into a single list for us to maintain.  

Also caught spots where the lists didn't match before.

@sttts @ncdc
2016-09-23 10:06:10 -07:00
deads2k 500959b70c fix RC lister 2016-09-23 08:12:03 -04:00
Kubernetes Submit Queue b2aed32578 Merge pull request #33269 from deads2k/client-15-svc-lister
Automatic merge from submit-queue

simplify svc lister

trying to track down what killed the e2e tests.
2016-09-23 03:10:57 -07:00
Kubernetes Submit Queue 1ef86aa8ab Merge pull request #32906 from caesarxuchao/staging-1.5
Automatic merge from submit-queue

Staging 1.5 client

Created the 1.5 folder and remove the 1.4 folder in the staging area in the master branch.

Content of kubernetes/client-go/1.4 will be pulled from the kubernetes/kubernetes 1.4 branch (https://github.com/kubernetes/contrib/pull/1719)
2016-09-22 19:55:01 -07:00
Clayton Coleman 97c35fcc67
Allow garbage collection to work against different API prefixes
The GC needs to build clients based only on Resource or Kind. Hoist the
restmapper out of the controller and the clientpool, support a new
ClientForGroupVersionKind and ClientForGroupVersionResource, and use the
appropriate one in both places.
2016-09-22 15:00:58 -04:00
Kubernetes Submit Queue 4ab5a76338 Merge pull request #33103 from deads2k/controller-03-kill-non-generatedclient
Automatic merge from submit-queue

switch controller manager to generated clients

Switches the controller manager to generated clients.

@ncdc ptal
2016-09-22 11:37:01 -07:00
deads2k 43db7c0c44 generated code that was missing before 2016-09-22 13:30:42 -04:00
deads2k 483af28944 fix up service lister 2016-09-22 09:12:37 -04:00
Kubernetes Submit Queue 5af04d1dd1 Merge pull request #32876 from errordeveloper/more-cert-utils
Automatic merge from submit-queue

Refactor cert utils into one pkg, add funcs from bootkube for kubeadm to use

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

We have ended-up with rather incomplete and fragmented collection of utils for handling certificates. It may be worse to consider using `cfssl` for doing all of these things, but for now there is some functionality that we need in `kubeadm` that we can borrow from bootkube. It makes sense to move the utils from bookube into core, as discussed in #31221.

**Special notes for your reviewer**: I've taken the opportunity to review names of existing funcs and tried to make some improvements in that area (with help from @peterbourgon).

**Release note**:

```release-note
NONE
```
2016-09-22 01:29:46 -07:00
Antoine Pelisse 938872582e Revert "simplify RC and SVC listers" 2016-09-21 15:49:38 -07:00
Chao Xu a4e62297d6 fix tests 2016-09-21 14:44:39 -07:00
Kubernetes Submit Queue 2d9d84dc64 Merge pull request #32888 from deads2k/client-10-fixup-remaining-listers
Automatic merge from submit-queue

simplify RC and SVC listers

Make the RC and SVC listers use the common list functions that more closely match client APIs, are consistent with other listers, and avoid unnecessary copies.
2016-09-21 04:13:56 -07:00
Clayton Coleman 07f079216e
Make clientcmd defaulting a function of ConfigOverrides and LoadingRules
This commit moves away from using a global variable for default
configuration checking, and instead exposes a method on LoadingRules to
determine whether a particular restclient.Config should be considered
"default". This allows kubectl to provide its own defaults (the same
as before, KUBERNETES_MASTER and the static localhost:8080 values) while
allowing other clients to avoid defining them.

In-cluster config defaulting is now easier to read.
2016-09-21 01:28:06 -04:00
deads2k b83a317003 switch controller manager to generated clientset 2016-09-20 12:53:47 -04:00
deads2k adda69c7ca generated code 2016-09-20 12:53:46 -04:00
Kubernetes Submit Queue 0e5def2054 Merge pull request #33040 from wongma7/storage-codegen
Automatic merge from submit-queue

Add storage api group to hack/update-codegen.sh

Add it to the script then run it in the second commit. 1.4 needs the same change, I'll do it in my other PR.
2016-09-20 08:48:43 -07:00
deads2k 16fbb47189 fix up service lister 2016-09-20 08:24:33 -04:00
deads2k 185a7adf84 fix RC lister 2016-09-20 08:24:32 -04:00
Kubernetes Submit Queue 76f2ddf4e8 Merge pull request #32292 from pmorie/subresource-fake
Automatic merge from submit-queue

Add godoc on using FakeClient with subresources

Add a little godoc on using FakeClient with subresources, hoping to prevent future occurences of #32127.
2016-09-19 23:51:23 -07:00
Matthew Wong 7ba1410521 Generate clientset 1.5 2016-09-19 15:54:08 -04:00
Kubernetes Submit Queue a089791f3e Merge pull request #32989 from lojies/fixspellerr
Automatic merge from submit-queue

fix a spell mistake

**What this PR does / why we need it**:
fixed a spell mistake

**Which issue this PR fixes** :

**Special notes for your reviewer**:

**Release note**:
<!--  Steps to write your release note:
1. Use the release-note-* labels to set the release note state (if you have access) 
2. Enter your extended release note in the below block; leaving it blank means using the PR title as the release note. If no release note is required, just write `NONE`. 
-->
```release-note
```
2016-09-19 11:41:00 -07:00
Kubernetes Submit Queue 87b40782c9 Merge pull request #31150 from ncdc/handle-init-container-terminated-pod-running-condition
Automatic merge from submit-queue

Check init containers in PodContainerRunning

Sometimes when an init container runs and terminates quickly, PodContainerRunning can go into a
state where the pod indicates it's still running, but the container is already terminated. Handle
that condition by returning ErrContainerTerminated when it happens.

See also #29952

@smarterclayton @fabianofranz
2016-09-19 05:43:21 -07:00
Ilya Dmitrichenko 386fae4592
Refactor utils that deal with certs
- merge `pkg/util/{crypto,certificates}`
- add funcs from `github.com/kubernetes-incubator/bootkube/pkg/tlsutil`
- ensure naming of funcs is fairly consistent
2016-09-19 09:03:42 +01:00
lojies fc9f029e5a fix a spell mistake 2016-09-18 15:04:59 +08:00
deads2k 1bf17eb4e9 change factorization of listers to make them easier to add 2016-09-16 14:49:00 -04:00
Kubernetes Submit Queue e8fbcb1669 Merge pull request #32654 from soltysh/sj_clientset
Automatic merge from submit-queue

Switch ScheduledJob controller to use clientset

**What this PR does / why we need it**:
This is part of #25442. I've applied here the same fix I've applied in the manual client in #29187, see the 1st commit for that (@caesarxuchao we've talked about it in #29856).

@deads2k as promised 
@janetkuo ptal
2016-09-16 05:03:57 -07:00
Kubernetes Submit Queue 27c093ea90 Merge pull request #32048 from smarterclayton/consistent_errors
Automatic merge from submit-queue

Handle Stream() errors consistently in restclient

We should be following the same rules for Stream() as the normal body
request flow.

Also add slightly more output on a server error - in the future we may
want to clean this up but it's potentially hiding bad responses.

Related to #32009 but isn't the fix (so far)
2016-09-15 20:13:48 -07:00
Kubernetes Submit Queue fcc97f37ee Merge pull request #32718 from mikedanese/mv-informer
Automatic merge from submit-queue

move informer and controller to pkg/client/cache

@kubernetes/sig-api-machinery
2016-09-15 16:44:30 -07:00
Mike Danese a765d59932 move informer and controller to pkg/client/cache
Signed-off-by: Mike Danese <mikedanese@google.com>
2016-09-15 12:50:08 -07:00
deads2k 4359c79f53 add FirstHitRESTMapper for adding thirdparty resources 2016-09-15 10:26:39 -04:00
Mike Danese 2cbbaf4384 autogenerated 2016-09-14 16:33:12 -07:00
Kubernetes Submit Queue 9aca785bc8 Merge pull request #32613 from madhusudancs/fed-clientcmd-bug-31947-fix
Automatic merge from submit-queue

Fix clientcmd for a non-host cluster client running in a pod. 

This is based on @errordeveloper's PR #32438. It fixes a case where default config is invalid and original config, i.e. `mergedConfig` is empty. It also adds a test for the case where default config is invalid and original config is neither invalid nor empty.

cc @errordeveloper @kubernetes/sig-cluster-federation @pwittrock @colhom
2016-09-14 13:10:27 -07:00
Maciej Szulik 5894834cc8 Generated changes for clientset 2016-09-14 11:27:29 +02:00
Madhusudan.C.S c4acaa6717 Add a test to verify that the client config is returned when default config is invalid. 2016-09-13 15:34:56 -07:00
Madhusudan.C.S 0433fe0d72 Do not return original config, i.e. mergeConfig, when it is empty and default config is invalid. 2016-09-13 15:33:51 -07:00
deads2k e5dbfdacc0 generated client 2016-09-13 08:54:23 -04:00
deads2k 8fac64b43f add localSAR 2016-09-13 08:54:23 -04:00
Kubernetes Submit Queue ac8aae584d Merge pull request #32393 from smarterclayton/incluster_namespace
Automatic merge from submit-queue

Allow namespace to be loaded from in-cluster config

This is a follow on from the previous commit that fixed ClientConfig.
Namespace can also be defaulted from ICC, and this correctly handles
that logic. Also add two debugging lines to ensure that it is easier in
the future to uncover problems here.

Fixes #32352

@deads2k
2016-09-13 04:02:21 -07:00
Kubernetes Submit Queue a44d2f8009 Merge pull request #32243 from caesarxuchao/generate-1-5-clientset
Automatic merge from submit-queue

Generate 1 5 clientset

Generate the 1.5 clientset. Stop updating 1.4 clientset. Remove 1.2 clientset.

@nikhiljindal @lavalamp 

I will rebase #31994 atop of this one.
2016-09-12 23:04:50 -07:00
Chao Xu 70d62a93a5 other manual changes 2016-09-12 10:24:18 -07:00
deads2k f756e43e7f convert rolling updater to generated client 2016-09-12 07:38:34 -04:00
deads2k 11c4de457d generated client code 2016-09-12 07:38:34 -04:00
Kubernetes Submit Queue 60b63b7cda Merge pull request #31767 from asalkeld/bad-context-error
Automatic merge from submit-queue

Add a check in ConfirmUsable() to validate the contextName

**What this PR does / why we need it**:
When a context name is provided, but can't be found (miss spelling), it currently
uses the defaults. This PR will cause the command to fail, to prevent unexpected side effects
of using the wrong configuration.

**Which issue this PR fixes**
fixes #21062

**Special notes for your reviewer**:
None

**Release note**:
```release-note
Error if a contextName is provided but not found in the kubeconfig.
```
2016-09-11 02:00:34 -07:00
Kubernetes Submit Queue bc835c608a Merge pull request #31586 from brendandburns/kubectl
Automatic merge from submit-queue

When prompting for passwords, don't echo to the terminal

@deads2k 
@kubernetes/kubectl
2016-09-10 13:58:13 -07:00
Wojciech Tyczynski e240aff741 Revert "Use scale subresource" 2016-09-10 18:35:07 +02:00
Kubernetes Submit Queue a5d6bf4095 Merge pull request #31111 from fraenkel/scale_subresource
Automatic merge from submit-queue

Use scale subresource

Fixes #29698

Use scale subresource for ReplicationController, ReplicaSet and Deployment.
Couldn't do Jobs and PetSet since they live in a different group.
2016-09-10 06:26:25 -07:00
Kubernetes Submit Queue c7d1e38412 Merge pull request #30963 from plutov/master
Automatic merge from submit-queue

Example of unversioned pkg uses correct Config struct

Currently this Doc has incorrect example - https://godoc.org/k8s.io/kubernetes/pkg/client/unversioned

So when developers use it they are confused why `client` pkg has no `Config` struct, actually this is a struct from `restclient` pkg.

Also pkg name and variable name should be equal:
`client, err := client.New(config)`

Thanks,
Alex
2016-09-10 04:27:05 -07:00
Ilya Dmitrichenko a96bd93c0f Check if default config is invalid before comparing it
Changes made in #31947 cause kube-proxy to ignore `--kubeconfig`
and `--master` flags and use in-cluster configuration, which is
unusable due to the fact that VIP hasn't been created yet.
2016-09-10 09:37:41 +02:00
Clayton Coleman d1d20e5340
Allow namespace to be loaded from in-cluster config
This is a follow on from the previous commit that fixed ClientConfig.
Namespace can also be defaulted from ICC, and this correctly handles
that logic. Also add two debugging lines to ensure that it is easier in
the future to uncover problems here.
2016-09-09 17:38:24 -04:00
Chao Xu cd93032cc7 remove release_1_2 2016-09-08 16:03:07 -07:00
Chao Xu ff9da535d3 generated 1.5 release 2016-09-08 16:03:07 -07:00
Paul Morie 4f45fa90ae Add godoc on using FakeClient with subresources 2016-09-08 10:29:07 -04:00
Kubernetes Submit Queue 7a4d81ea43 Merge pull request #31271 from deads2k/self-sar
Automatic merge from submit-queue

add selfsubjectaccessreview API

Exposes the REST API for self subject access reviews.  This allows a user to see whether or not they can perform a particular action.

@kubernetes/sig-auth
2016-09-08 01:29:48 -07:00
Matt Liggett 108a15db38 Add eviction e2e tests.
Also refactor the test a bit.
2016-09-07 17:38:38 -07:00
Kubernetes Submit Queue 7c27a2686f Merge pull request #31688 from mehdy/master
Automatic merge from submit-queue

updated client document
2016-09-07 16:25:24 -07:00
Kubernetes Submit Queue 184e91bbf6 Merge pull request #32182 from smarterclayton/aggregate_discovery_errors
Automatic merge from submit-queue

Use a structured error rather than an Aggregate error in discovery

Should provide more information for debugging the root cause of
discovery failures.

Exposes the true cause of #32009

@lavalamp @derekwaynecarr
2016-09-07 12:12:58 -07:00
Kubernetes Submit Queue 9f58a867e1 Merge pull request #31522 from krousey/path_validation
Automatic merge from submit-queue

Split path validation into a separate library

This PR splits path segment validation into it's own package. This cuts off one of the restclient's dependency paths to some docker packages, and completely eliminates its dependency on go-restful swagger validation.


cc @kubernetes/sig-api-machinery
2016-09-07 10:14:32 -07:00
Clayton Coleman 88b64a7a82
Use a structured error rather than an Aggregate error in discovery
Should provide more information for debugging the root cause of
discovery failures.
2016-09-07 10:59:03 -04:00
Kubernetes Submit Queue 54db8fa2e3 Merge pull request #31886 from deads2k/move-storage-class
Automatic merge from submit-queue

Move StorageClass to a storage group

We discussed the pros and cons in sig-api-machinery yesterday.  Choosing a particular group name means that clients (including our internal code) require less work and re-swizzling to handle promotions between versions.  Even if you choose a group you end up not liking, the amount of work remains the same as the incubator work case: you move the affected kind, resource, and storage.

This moves the `StorageClass` type to the `storage.k8s.io` group (named for consistency with authentication, authorization, rbac, and imagepolicy).  There are two commits, one for manaul changes and one for generated code.
2016-09-06 23:22:02 -07:00
Kubernetes Submit Queue 9dce773502 Merge pull request #31947 from smarterclayton/check_empty_config
Automatic merge from submit-queue

Check for EmptyConfig errors when trying to use in-cluster config

By removing the default "localhost:8080" behavior several paths in
client config began returning err == ErrEmptyConfig rather than err ==
nil.  The code checking for in cluster config was wrong - the logic
should be:

1. If loading the underlying config returns a non-empty error, fail
2. If the underlying config is not equal to the default config,
   return that config (it has user input)
3. If it is possible to use in-cluster config, do so
4. Otherwise return the default config (and or default EmptyConfig
   error).

Fixes #31910 @thockin @lavalamp @deads2k. We introduced EmptyConfig a very long time ago, but until I removed the "localhost:8080" Kubernetes was not actually exposing it (OpenShift relies on it since we don't set an insecure default). This properly falls through to in-cluster config in the described conditions.



```release-note
Some components like kube-dns and kube-proxy could fail to load the service account token when started within a pod. Properly handle empty configurations to try loading the service account config.
```
2016-09-06 22:02:55 -07:00
Ryan Hitchman 4c7ef6561e Revert "Add e2e tests for eviction subresource." 2016-09-06 16:21:50 -07:00
Clayton Coleman 48b4d6d30c
Check for EmptyConfig errors when trying to use in-cluster config
By removing the default "localhost:8080" behavior several paths in
client config began returning err == ErrEmptyConfig rather than err ==
nil.  The code checking for in cluster config was wrong - the logic
should be:

1. If loading the underlying config returns a non-empty error, fail
2. If the underlying config is not equal to the default config,
   return that config (it's got user input)
3. If it is possible to use in cluster config, do so
4. Otherwise return the default config (and or default EmptyConfig
   error).
2016-09-06 17:46:50 -04:00
Kubernetes Submit Queue 3da5d781fc Merge pull request #31722 from mml/evict.test
Automatic merge from submit-queue

Add e2e tests for eviction subresource.

This branch includes changes pending in both #31638 and #31721.  I will rebase
once those merge.
2016-09-06 14:25:07 -07:00
Matt Liggett c377011138 Add eviction e2e tests.
Also refactor the test a bit.
2016-09-06 11:58:22 -07:00
Wojciech Tyczynski e0779df721 Fix race in DeltaFIFO 2016-09-06 20:48:18 +02:00
deads2k 6320dc6e73 generated code for moving StorageClass 2016-09-06 08:41:17 -04:00
deads2k cd5b6cc491 move StorageClass to its own group 2016-09-06 08:41:17 -04:00
Kubernetes Submit Queue 1c85bbe6cb Merge pull request #31718 from pmorie/fake-client-doc
Automatic merge from submit-queue

Improve doc for the fake client

Improve doc in this type.

cc @derekwaynecarr @ncdc @deads2k
2016-09-05 11:10:23 -07:00
Angus Salkeld 9fcce9e001 Work around go cover bug
This avoids the whole command failing because of errors like the following:
```
# cover k8s.io/kubernetes/pkg/client/restclient
cover: internal error: block 268 overlaps block 270
```
For vendor code, igone
For local code replace the switch with an if statement
2016-09-05 09:59:15 +10:00
Clayton Coleman 5e6f5fee8a
Handle Stream() errors consistently in restclient
We should be following the same rules for Stream() as the normal body
request flow.

Also add slightly more output on a server error - in the future we may
want to clean this up but it's potentially hiding bad responses.
2016-09-04 14:50:04 -04:00
Kubernetes Submit Queue 11765ab92e Merge pull request #31887 from liggitt/certificates-group
Automatic merge from submit-queue

Namespace certificates API group

New API groups should follow best-practices for naming, including using DNS names within the k8s.io namespace

```release-note
The certificates API group has been renamed to certificates.k8s.io
```
2016-09-02 15:08:55 -07:00
Kubernetes Submit Queue 64c2beae09 Merge pull request #31834 from wongma7/pvc-genclient
Automatic merge from submit-queue

Generate versioned client for pvc

I noticed while trying to use client-go that there is no way to get PVC with versioned clientset. I don't know why it is excluded, I cannot find any discussion about this, so I am creating this assuming it is just an oversight...
2016-09-01 15:01:13 -07:00
Jordan Liggitt a869de61bd
Namespace certificates API group 2016-09-01 14:39:06 -04:00
Angus Salkeld e9cad12e5f Add a check in ConfirmUsable() to validate the contextName 2016-09-01 11:35:11 +10:00
Matthew Wong 934fc002bc Generate versioned client for pvc 2016-08-31 18:57:56 -04:00
Kubernetes Submit Queue 1c607b391a Merge pull request #31721 from mml/disrupt.e2e.versioned
Automatic merge from submit-queue

Rewrite disruption e2e test to use versioned client.

This currently includes the changes from #31638.  I will rebase once that is merged.
2016-08-30 15:35:15 -07:00
Matt Liggett a5f1dc44f5 // update-all and staging/.../client-go/copy.sh 2016-08-30 13:35:51 -07:00
Matt Liggett 44b2c862ef Rewrite disruption e2e test to use versioned client. 2016-08-30 12:34:45 -07:00
Paul Morie c9b97c38a8 Improve doc for the fake client 2016-08-30 13:42:43 -04:00
Clayton Coleman 06cbb29e9e
ClientConfig should not default to http://localhost:8080
This changes clientcmd to skip the default cluster, but preserves the
behavior in kubectl. This prevents the possibility of an administrator
misconfiguration in kubelet or other server component from allowing a
third party who can bind to 8080 on that host from potentially
impersonating an API server and gaining root access.
2016-08-30 10:43:24 -04:00
mehdy fb00d77c17 updated document
as far as I dug into codes I figured it out that the config exists in `restclient` package
2016-08-30 12:46:52 +04:30
deads2k 2f642ebc9e generated 2016-08-29 09:51:55 -04:00
deads2k 97529e3687 add selfsubjectaccessreview API 2016-08-29 09:51:54 -04:00
Brendan Burns a79f714b1e Make password prompting hide the string 2016-08-27 21:31:04 -07:00