Commit Graph

1873 Commits (032e450ec41f2fb06420e4fd1b0aac44f58c2ff5)

Author SHA1 Message Date
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
Kubernetes Submit Queue 961ef2b51d Merge pull request #31470 from caesarxuchao/regenerate-release-1-4
Automatic merge from submit-queue

Fix missing expansion files in clientset release 1.4

<!--  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**:
Fix missing expansion files in clientset release 1.4;
Update the client-gen tool to automatically update generated_expansion.go;
Update the readme to document the best practice of using client-gen.

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

https://github.com/kubernetes/kubernetes/issues/29698#issuecomment-241315798


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

cc @lavalamp @krousey @mbohlool
2016-08-27 00:45:52 -07:00
Chao Xu bf578f1bc2 run client-gen 2016-08-26 10:55:22 -07:00
Chao Xu 74a424129f make subjectaccessreview expansion follow the convention 2016-08-26 10:54:51 -07:00
Kris e87edf9bd5 Split path validation into a separate library 2016-08-26 08:05:20 -07:00
Kubernetes Submit Queue 1184800cbb Merge pull request #30730 from janetkuo/prevent-overlapping-deployment
Automatic merge from submit-queue

Handle overlapping deployments gracefully

Fixes #30028
2016-08-25 21:50:56 -07:00
Michael Fraenkel f061f74f56 Use scale subresource
- Use scale subresource for ReplicationController, ReplicaSet and Deployment.
2016-08-25 17:17:12 -04:00
Kubernetes Submit Queue c5e7e5124a Merge pull request #30969 from asalkeld/raw-status-code
Automatic merge from submit-queue

Make sure the StatusCode is taken into account in DoRaw()

**What this PR does / why we need it**:
Currently if there is an error (not found) the error printed out
is to do with the inablity to convert an empty body into the expected json.

This patch will fill in the err correctly.

example of before (with NotFound error):
$ kubectl top node
failed to unmarshall heapster response: json: cannot unmarshal object into Go value of type []v1alpha1.NodeMetrics

Now:
$ kubectl top node
the server could not find the requested resource (get services http:heapster:)

**Which issue this PR fixes** 
related to bug #30818

**Special notes for your reviewer**:
None

**Release note**:
```release-note
NONE
```
2016-08-25 01:01:05 -07:00
Kubernetes Submit Queue 94666b4a4e Merge pull request #31112 from wojtek-t/set_unsorted_list
Automatic merge from submit-queue

Avoid sorting lists when unnecessary

I've seen ThreadSafeMap::List consuming ~30% of whole CPU usage, spending the whole time in sorting (while it is in fact completely unneded).
2016-08-24 10:11:36 -07:00
Kubernetes Submit Queue cfab351621 Merge pull request #31116 from fraenkel/scale_client
Automatic merge from submit-queue

Add ScaleExpansion to client v1.4

**What this PR does / why we need it**:
The generated v1.4 did not carry over the complete ScaleExpansion interface. The unversioned client is using this interface and should be in sync with generated client.

**Release note**:
```release-note

NONE
```
2016-08-24 02:09:35 -07:00
Janet Kuo 90557ec56c Handle overlapping deployments gracefully
1. When overlapping deployments are discovered, annotate them
2. Expose those overlapping annotations as warnings in kubectl describe
3. Only respect the earliest updated one (skip syncing all other overlapping deployments)
4. Use indexer instead of store for deployment lister
2016-08-23 14:33:30 -07:00
Angus Salkeld c955de2ba8 Make sure the StatusCode is taken into account in DoRaw()
Currently if there is an error (not found) the error printed out
is to do with the inablity to convert an empty body into the expected json.

This patch will fill in the err correctly.

example of before (with NotFound error):
$ kubectl top node
failed to unmarshall heapster response: json: cannot unmarshal object into Go value of type []v1alpha1.NodeMetrics

Now:
$ kubectl top node
the server could not find the requested resource (get services http:heapster:)
2016-08-23 11:42:42 +10:00
Andy Goldstein 8530ede61f 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.
2016-08-22 15:55:42 -04:00
Michael Fraenkel d7d1bd592d Add ScaleExpansion to client v1.4 2016-08-22 09:58:28 -04:00
Wojciech Tyczynski 2804055978 Avoid sorting List when unnecessary 2016-08-22 15:07:17 +02:00
Kubernetes Submit Queue 1e5a5a2eac Merge pull request #30976 from wojtek-t/validated_selector
Automatic merge from submit-queue

	Don't validate selector that is already validated

Ref #30875

@timothysc
2016-08-22 03:34:44 -07:00
Kubernetes Submit Queue e29f1e2d11 Merge pull request #30948 from lavalamp/fix
Automatic merge from submit-queue

Do not hold the lock for a long time

Followup to #30839.

I'm not convinced this is a super great idea but I'll throw it out and let others decide.

Ref https://github.com/kubernetes/minikube/issues/368
Ref #30759
2016-08-22 02:50:19 -07:00
Kubernetes Submit Queue 5b5a4145da Merge pull request #30821 from ardnaxelarak/21076_change_isEmpty_to_Empty
Automatic merge from submit-queue

Rename IsEmpty to Empty

addresses #21076
2016-08-22 00:54:28 -07:00
Wojciech Tyczynski e9d5be628a Don't validate selector that is already validated 2016-08-22 09:39:32 +02:00
Kubernetes Submit Queue 0039d75dd0 Merge pull request #30896 from mfojtik/add-get
Automatic merge from submit-queue

Add Get() to cache listers

@kargakis @deads2k  PTAL
2016-08-21 17:31:26 -07:00
Kubernetes Submit Queue b51d5c3cc0 Merge pull request #30638 from krousey/metrics_registration
Automatic merge from submit-queue

Remove implicit Prometheus metrics from client

**What this PR does / why we need it**: This PR starts to cut away at dependencies that the client has.

**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
The implicit registration of Prometheus metrics for request count and latency have been removed, and a plug-able interface was added. If you were using our client libraries in your own binaries and want these metrics, add the following to your imports in the main package: "k8s.io/pkg/client/metrics/prometheus". 
```

cc: @kubernetes/sig-api-machinery @kubernetes/sig-instrumentation @fgrzadkowski  @wojtek-t
2016-08-21 16:47:05 -07:00
Kubernetes Submit Queue 5a98379bca Merge pull request #29696 from brendandburns/kubecfg
Automatic merge from submit-queue

Add initial support for TokenFile to to the client config file.

@smarterclayton @deads2k @cjcullen @krousey 

Part of the fix for #28260
2016-08-21 11:18:21 -07:00
Kubernetes Submit Queue 7272cd09e3 Merge pull request #26541 from sttts/sttts-kubectl-exec-rc
Automatic merge from submit-queue

Return container command exit codes in kubectl run/exec

Fixes https://github.com/kubernetes/kubernetes/issues/26424
Based on https://github.com/kubernetes/kubernetes/pull/25273.

TODO:
- [x] add e2e tests
- [x] investigate `kubectl run` exit code for `--restart=Never` (compare issue #24533 and PR #25253)
- [x] document exit codes
2016-08-21 00:44:55 -07:00
Kubernetes Submit Queue c7a82463e7 Merge pull request #30950 from liggitt/support-name-field-selector
Automatic merge from submit-queue

Add support for the standard objectmeta field selectors

certificates API was missing standard field selectors (noticed in 4120179db5 (r75413160))

also silences client-side warnings when using field selectors that don't have a registered client-side transformation (no functional change, since we were already returning the original field/value). if we want to trend toward embedding less conversion logic in our clients, I don't see us fully duplicating field selector conversions client-side to make that warning disappear.
2016-08-20 20:11:00 -07:00
Kubernetes Submit Queue db777bb9a3 Merge pull request #30940 from madhusudancs/fed-issue-30790
Automatic merge from submit-queue

Return the current kubeconfig as the starting config in ClientConfigGetter.

This fixes issue #30790.

cc @kubernetes/sig-cluster-federation
2016-08-20 19:29:31 -07:00
Jordan Liggitt 3e5acd8476
Make client-side fieldSelector stop complaining about identity transforms 2016-08-20 21:34:33 -04:00
Kubernetes Submit Queue e9947d9ad7 Merge pull request #30813 from bprashanth/kubectl_petset
Automatic merge from submit-queue

Basic scaler/reaper for petset

Currently scaling or upgrading a petset is more complicated than it should be. Would be nice if this made code freeze on friday. I'm planning on a follow up change with generation number and e2es post freeze.
2016-08-20 10:51:07 -07:00
bindata-mockuser e792d4117d Add return code support to kubectl-exec and -run 2016-08-20 15:58:47 +02:00
Kubernetes Submit Queue a157e28ef6 Merge pull request #31016 from krousey/tcp_reuse
Automatic merge from submit-queue

Attempt to ensure entire resp body is read

**What this PR does / why we need it**: Enables the re-use of TCP connections when code fails to read the entire body of the response.

**Which issue this PR fixes**: fixes #30975 

**Special notes for your reviewer**:

This is a best effort approach. It only attempts to drain the body of the response if it's less than 1k. It seems like a reasonable barrier at which to give up and just use a new TCP connection.

cc: @wojtek-t @smarterclayton @lavalamp @kubernetes/sig-api-machinery
2016-08-19 15:45:34 -07:00
Kubernetes Submit Queue d40e2296b2 Merge pull request #30630 from silasbw/short-n0
Automatic merge from submit-queue

Add a short `-n` for `kubectl --namespace`

fixes #24078

 `--namespace` is a very common flag for nearly every `kubectl` command we have. We should claim `-n` for it.
2016-08-19 14:34:13 -07:00
Kara Alexandra d12a66a422 Rename IsEmpty to Empty
Signed-off-by: Kara Alexandra <kalexandra@us.ibm.com>
2016-08-19 14:19:19 -07:00
Kris 35c695005f Attempt to ensure entire resp body is read 2016-08-19 11:56:02 -07:00
Kris 8d6ce0dcc6 Remove implicit Prometheus metrics from client 2016-08-19 10:11:45 -07:00
Aliaksandr Pliutau 41ffa9a254 Example of unversioned pkg uses correct Config struct 2016-08-19 10:57:55 +07:00
Daniel Smith edc598a359 Do not hold the lock for a long time 2016-08-18 17:40:33 -07:00
Madhusudan.C.S 2b5d689ab2 Return the current kubeconfig as the starting config in ClientConfigGetter. 2016-08-18 15:51:21 -07:00
Clayton Coleman 12a5eeea17
Introduce GroupVersioner for capturing desired target version
Convert single GV and lists of GVs into an interface that can handle
more complex scenarios (everything internal, nothing supported). Pass
the interface down into conversion.
2016-08-18 14:45:00 -04:00
Michal Fojtik 2ccc9fa859 Add Get() to cache listers 2016-08-18 18:19:50 +02:00
Kubernetes Submit Queue 86340fc123 Merge pull request #30839 from lavalamp/fix
Automatic merge from submit-queue

queueActionLocked requires write lock

Fix https://github.com/kubernetes/minikube/issues/368
Fix part of #30759

Hopefully. On stack dumps I couldn't see who was fighting with this.
2016-08-18 02:43:25 -07:00
Kubernetes Submit Queue e2f39fca86 Merge pull request #30807 from caesarxuchao/change_pod_lister_api
Automatic merge from submit-queue

Continue on #30774: Change podNamespacer API

continue on #30774, credit to @wojtek-t, Ref #30759

I just fixed a test and converted IsActivePod to operate on *Pod.
2016-08-18 02:08:23 -07:00
bprashanth 30f3cb9d26 Scaler and reaper for petset 2016-08-17 17:37:56 -07:00
Daniel Smith 3e69c5a9b8 queueActionLocked requires write lock 2016-08-17 17:34:49 -07:00
Kubernetes Submit Queue 4b5fd43e24 Merge pull request #30250 from krousey/kctl_dynamic
Automatic merge from submit-queue

Change kubectl create to use dynamic client

https://github.com/kubernetes/kubernetes/issues/16764 https://github.com/kubernetes/kubernetes/issues/3955

This is a series of changes to allow kubectl create to use discovery-based REST mapping and dynamic clients.

cc @kubernetes/sig-api-machinery

**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
kubectl will no longer do client-side defaulting on create and replace.
```
2016-08-17 14:48:56 -07:00
Wojciech Tyczynski 331083727f Change podNamespacer API 2016-08-17 16:55:01 +02:00
Kubernetes Submit Queue fdd2392035 Merge pull request #30504 from piosz/hpa-ext-client
Automatic merge from submit-queue

Hpa ext client

```release-note
Removed support for HPA in extensions client.
```

fix #21578
2016-08-17 01:35:16 -07:00
Matt Liggett d60ba3c6e2 Implement DisruptionController.
Part of #12611
2016-08-16 15:20:41 -07:00
Silas Boyd-Wickizer 39a9ec3a4f Add a short `-n` for `kubectl`'s `--namespace`
fixes #24078

--namespace is a very common flag for nearly every kubectl command we have.
We should claim -n for it.
2016-08-16 08:32:47 -07:00
Kris 63a512fe47 Add discovery mapper and dynamic typer to kubectl 2016-08-15 22:07:54 -07:00
Kris 3999f071d1 Add generic "List" type for all versions 2016-08-15 22:07:54 -07:00
Brendan Burns 50089f6c81 Initial support for TokenFile in the client config. 2016-08-15 21:59:49 -07:00
Kris e5c2154883 Eliminate redundant dynamic client type
This will allow people to override the default parameter codec and still
pass the resulting client with something that accepts *dynamic.Client.
2016-08-15 14:18:40 -07:00
Kris d9ce524d63 Expose dynamic client's content config 2016-08-15 14:18:40 -07:00
Kubernetes Submit Queue 69419a145a Merge pull request #29802 from jfrazelle/fix-go-vet-errors
Automatic merge from submit-queue

fix go vet errors

<!--
Checklist for submitting a Pull Request

Please remove this comment block before submitting.

1. Please read our [contributor guidelines](https://github.com/kubernetes/kubernetes/blob/master/CONTRIBUTING.md).
2. See our [developer guide](https://github.com/kubernetes/kubernetes/blob/master/docs/devel/development.md).
3. If you want this PR to automatically close an issue when it is merged,
   add `fixes #<issue number>` or `fixes #<issue number>, fixes #<issue number>`
   to close multiple issues (see: https://github.com/blog/1506-closing-issues-via-pull-requests).
4. Follow the instructions for [labeling and writing a release note for this PR](https://github.com/kubernetes/kubernetes/blob/master/docs/devel/pull-requests.md#release-notes) in the block below.
-->

```release-note
```

This fixes the `go vet` errors brought about by go 1.7 testing re (#28742).

The are all pretty trivial and mostly related to literal composites.

also related to #16086
2016-08-15 13:10:08 -07:00
Kubernetes Submit Queue 612e3c2634 Merge pull request #30222 from hodovska/port-forward-cmd-struct
Automatic merge from submit-queue

kubectl/port-forward: complete/validate/run structure

```kubectl port-forward``` command is converted to a complete/validate/run kubectl command structure specified here: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/kubectl-conventions.md#command-conventions
In this PR is also exposed the ready and stop channel for API consumer.

Fixes #16504
2016-08-12 20:58:53 -07:00
Dominika Hodovska c5babe2396 expose ready/stop channel 2016-08-12 15:45:57 +02:00
Piotr Szczesniak a53cfd28fb Autogenerated changes 2016-08-12 15:13:44 +02:00
Kubernetes Submit Queue d2543c30d8 Merge pull request #30277 from wojtek-t/optimize_controllers
Automatic merge from submit-queue

Avoid computing DeepEqual in controllers all the time

Computing DeepCopy was responsible for ~33% of cpu usage of controller-manager before this PR.

<!--
Checklist for submitting a Pull Request

Please remove this comment block before submitting.

1. Please read our [contributor guidelines](https://github.com/kubernetes/kubernetes/blob/master/CONTRIBUTING.md).
2. See our [developer guide](https://github.com/kubernetes/kubernetes/blob/master/docs/devel/development.md).
3. If you want this PR to automatically close an issue when it is merged,
   add `fixes #<issue number>` or `fixes #<issue number>, fixes #<issue number>`
   to close multiple issues (see: https://github.com/blog/1506-closing-issues-via-pull-requests).
4. Follow the instructions for [labeling and writing a release note for this PR](https://github.com/kubernetes/kubernetes/blob/master/docs/devel/pull-requests.md#release-notes) in the block below.
-->

```release-note
* Use the release-note-* labels to set the release note state 
* Clear this block to use the PR title as the release note 
-OR-
* Enter your extended release note here (newlines are formatted as bullets)
```

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.kubernetes.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.kubernetes.io/reviews/kubernetes/kubernetes/30277)
<!-- Reviewable:end -->
2016-08-12 03:20:58 -07:00
Daniel Smith f1fd638962 fix register.go files up + add test import 2016-08-11 17:06:54 -07:00
Kubernetes Submit Queue 035ec518af Merge pull request #28387 from caesarxuchao/gc-latency-measure
Automatic merge from submit-queue

[GarbageCollector] measure latency

First commit is #27600.

In e2e tests, I measure the average time an item spend in the eventQueue(~1.5 ms), dirtyQueue(~13ms), and orphanQueue(~37ms). There is no stress test in e2e yet, so the number may not be useful.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.kubernetes.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.kubernetes.io/reviews/kubernetes/kubernetes/28387)
<!-- Reviewable:end -->
2016-08-11 02:33:55 -07:00
Wojciech Tyczynski 1c9e623045 Remove dead variable from reflector 2016-08-11 08:32:37 +02:00
Jess Frazelle 7e9d82129e
fix go vet errors
Signed-off-by: Jess Frazelle <jessfraz@google.com>

fix composites

Signed-off-by: Jess Frazelle <me@jessfraz.com>
2016-08-10 16:45:41 -07:00
Kubernetes Submit Queue 48b7aca2c9 Merge pull request #29672 from lixiaobing10051267/masterLen
Automatic merge from submit-queue

Add handling empty index key that may cause panic issue

if len(indexKeys) == 0, "return indexKeys[0]" will cause unexpected result.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.kubernetes.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.kubernetes.io/reviews/kubernetes/kubernetes/29672)
<!-- Reviewable:end -->
2016-08-10 14:29:45 -07:00
Chao Xu 41572cb22d add metrics to gc 2016-08-10 12:45:06 -07:00
Davanum Srinivas b15219034d Prevent panic in 'kubectl exec' when redirecting stdout
Just add some nil checks to make sure we don't trip over when
we redirect output from exec to a file.

Fixes #30290
2016-08-09 14:52:55 -04:00
Kubernetes Submit Queue f218aa4b10 Merge pull request #30236 from mikedanese/csr-approval
Automatic merge from submit-queue

csr: add approval to the typed client

ref #30163

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.kubernetes.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.kubernetes.io/reviews/kubernetes/kubernetes/30236)
<!-- Reviewable:end -->
2016-08-08 22:54:19 -07:00
Chao Xu 4d2350632c only store typeMeta and objectMeta in the gc store 2016-08-08 17:23:13 -07:00
Mike Danese c131fbaf17 csr: add approval to the typed client 2016-08-08 16:05:05 -07:00
Chao Xu 58b6dee275 install authorization group in 1.4 client 2016-08-06 11:21:41 -07:00
Kubernetes Submit Queue 9083ee971e Merge pull request #29137 from janetkuo/scheduledjob-controller
Automatic merge from submit-queue

Scheduledjob controller

Supersedes #25952; first 7 commits come from #25816

<!--
Checklist for submitting a Pull Request

Please remove this comment block before submitting.

1. Please read our [contributor guidelines](https://github.com/kubernetes/kubernetes/blob/master/CONTRIBUTING.md).
2. See our [developer guide](https://github.com/kubernetes/kubernetes/blob/master/docs/devel/development.md).
3. If you want this PR to automatically close an issue when it is merged,
   add `fixes #<issue number>` or `fixes #<issue number>, fixes #<issue number>`
   to close multiple issues (see: https://github.com/blog/1506-closing-issues-via-pull-requests).
4. Follow the instructions for [labeling and writing a release note for this PR](https://github.com/kubernetes/kubernetes/blob/master/docs/devel/pull-requests.md#release-notes) in the block below.
-->

```release-note
```
2016-08-05 18:07:48 -07:00
Kubernetes Submit Queue 2537f66f0e Merge pull request #29230 from luxas/goimport
Automatic merge from submit-queue

Run goimport for the whole repo

While removing GOMAXPROC and running goimports, I noticed quite a lot of other files also needed a goimport format. Didn't commit `*.generated.go`, `*.deepcopy.go` or files in `vendor`

This is more for testing if it builds.
The only strange thing here is the gopkg.in/gcfg.v1 => github.com/scalingdata/gcfg replace.
cc @jfrazelle @thockin
2016-08-05 16:22:01 -07:00
Janet Kuo da57c93a8a Fix errors, verification and test failures; add unit test for sj UpdateStatus 2016-08-05 13:35:39 -07:00
Eric Tune 8675e014fb ScheduledJob controller 2016-08-05 13:34:50 -07:00
deads2k d9a203409a initial generated code for SAR 2016-08-05 11:37:43 -04:00
deads2k 32920b5617 add subjectaccessreviews resource 2016-08-05 11:20:56 -04:00
Kubernetes Submit Queue e7d01097dc Merge pull request #29971 from caesarxuchao/fix-kubectl-rolling-update-with-gc
Automatic merge from submit-queue

[GarbageCollector] Fix kubectl rolling-update to work with GC

This changes the order of the [Rename()](https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/rolling_updater.go#L532) function. After the change, Rename() first deletes the old RC and orphans its pods, then creates the new RC, which will then have a chance to adopt the orphaned pods.

This also fixes the "should support rolling-update to same image" [test](https://github.com/kubernetes/kubernetes/blob/master/test/e2e/kubectl.go#L915) when the garbage collector is on.

Here is the detailed explanation on why the test would have failed:
`kubectl rolling-update` will [rename](https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/rolling_updater.go#L532-L546) the RC. It first creates the an identical RC (including spec.selectors) with the new name, then it deletes the existing RC. When GC is turned on, the newly created RC cannot adopt the existing pod, because it has a controllerRef pointing to the exising RC, so the new RC will create new pods and expect to see the creation. However, the new RC and the old RC have the same selector, so sometimes the old RC, instead of the new RC, has its [expectation lowered](https://github.com/kubernetes/kubernetes/blob/master/pkg/controller/replication/replication_controller.go#L346-L362), the new RC's expectation will stuck forever. The e2e test then times out when executing `kubectl delete newRC`, because there is the new RC will not scale down as its expectation is not fulfilled.

A side-note, we should fix [rm.getPodController()](https://github.com/kubernetes/kubernetes/blob/master/pkg/controller/replication/replication_controller.go#L346) to respect pod's controllerref, that will prevent similar bugs.

Also note that an old version `kubectl rolling-update` will not work with the GC. We cannot fix that.
2016-08-04 20:48:10 -07:00
Chao Xu 2558c239b8 remove logWatcher to logf 2016-08-04 10:28:18 -07:00
Kubernetes Submit Queue c2340870c6 Merge pull request #29952 from fabianofranz/handle_container_terminated_pod_running_condition
Automatic merge from submit-queue

Handle container terminated but pod still running in conditions

Sometimes when you have a pod with more than one container, and the container runs and terminates really fast, `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.
2016-08-04 07:13:08 -07:00
Kubernetes Submit Queue 544851a19f Merge pull request #29796 from deads2k/token-review
Automatic merge from submit-queue

Token review endpoint

Unrevert of #28788, which was rolled back because of https://github.com/kubernetes/kubernetes/issues/29375


@cjcullen @wojtek-t I'd like to remerge if possible.  Have we gotten the field checking mentioned here relaxed? https://github.com/kubernetes/kubernetes/pull/28788#discussion_r71918442
2016-08-03 20:48:31 -07:00
Kubernetes Submit Queue c2614aee9a Merge pull request #29500 from lixiaobing10051267/masterFound
Automatic merge from submit-queue

Check all places to break the loop when object found

Check all places to break the loop when object found.
2016-08-03 20:05:15 -07:00
Chao Xu 96c84303bd fix kubectl rolling-update when GC is enabled 2016-08-03 15:57:03 -07:00
deads2k 60dd4a5d26 interesting changes to add tokenreviews endpoint to implement webhook 2016-08-03 08:37:45 -04:00
deads2k eb79e2c859 generated code changes 2016-08-03 08:37:45 -04:00
Fabiano Franz 30cf0f9890 Handle container terminated but pod still running in conditions 2016-08-02 21:32:15 -03:00
Kris a87377c7a9 Adding a defered RESTMapper 2016-08-02 10:35:44 -07:00
Kris 4e1f1c10ff discovery: Adding a discover based RESTMapper
Added a PriorityRESTMapper that operates off of discovery information. I
made an auxiliary data type and function to help collect and organize
the information.
2016-08-02 10:35:44 -07:00
k8s-merge-robot 0fbd60fa30 Merge pull request #29187 from soltysh/multiversion_kubectl
Automatic merge from submit-queue

Create client from API version passed in config or use default

When creating a client read the `GroupVersion` value passed in the `restclient.Config`. If the passed `GroupVersion` does not match current group or is not enabled fallback to default `GroupVersion` for that group.

This PR should allow accessing `ScheduledJob` properly in `batch/v2alpha1`.

@smarterclayton @deads2k @caesarxuchao @lavalamp ptal
2016-08-02 06:10:26 -07:00
Lucas Käldström c88a07ce1a Run goimports 2016-08-02 15:12:39 +03:00
Timothy St. Clair 9a02bffe6d Update acquire to use newer JitterUntil vs. sleep with 0 timer which may
have caused a race in Until.
2016-07-29 11:10:00 -05:00
childsb f5bd7d471e API Changes for StorageClass 2016-07-28 19:01:01 -04:00
k8s-merge-robot aba7ae0d90 Merge pull request #29655 from smarterclayton/petset_client
Automatic merge from submit-queue

Add Apps() and PetSet client to client/unversioned

Also add a test fake
2016-07-28 13:54:16 -07:00
Harry Zhang cb14b35bde Refactor util clock into it's own pkg 2016-07-28 02:29:04 -04:00
Clayton Coleman d67187856f
No PetSet client in client/unversioned
Also add fakes
2016-07-27 10:08:58 -04:00
lixiaobing10051267 a9d631665e Add handling empty index key that may cause panic issue 2016-07-27 21:44:22 +08:00
k8s-merge-robot d897db4ac5 Merge pull request #28933 from smarterclayton/accept_content_types
Automatic merge from submit-queue

Use response content-type on restclient errors

Also allow a new AcceptContentTypes field to allow the client to ask for
a fallback serialization when getting responses from the server. This
allows a new client to ask for protobuf and JSON, falling back to JSON
when necessary.

The changes to request.go allow error responses from non-JSON servers to
be properly decoded.

@wojtek-t - also alters #28910 slightly (this is better output)
2016-07-26 22:56:53 -07:00
k8s-merge-robot ffff1ab63c Merge pull request #28319 from grodrigues3/revert-comments-tLogf
Automatic merge from submit-queue

reverted the code from 23688 that cause race condition with older version of Go

```release-note
* release-note-None
```


[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/.github/PULL_REQUEST_TEMPLATE.md?pixel)]()
2016-07-26 19:56:47 -07:00
Maciej Szulik 1e496fd8ce Create client from API version passed in config or use default
When creating a client read the GroupVersion value passed in the
restclient.Config. If the passed GroupVersion does not match current
group or is not enabled fallback to default GroupVersion for that group.
2016-07-26 11:54:25 +02:00
Clayton Coleman 203cf2be6f
Use response content-type on restclient errors
Also allow a new AcceptContentTypes field to allow the client to ask for
a fallback serialization when getting responses from the server. This
allows a new client to ask for protobuf and JSON, falling back to JSON
when necessary.

The changes to request.go allow error responses from non-JSON servers to
be properly decoded.
2016-07-24 12:08:40 -04:00
lixiaobing10051267 be8d081539 Check all places to break the loop when object found 2016-07-23 13:49:04 +08:00
k8s-merge-robot df2cf16ddb Merge pull request #26709 from hodovska/master
Automatic merge from submit-queue

Allow shareable resources for admission control plugins.

Changes allow admission control plugins to share resources. This is done via new PluginInitialization structure. The structure can be extended for other resources, for now it is an shared informer for namespace plugins (NamespiceLifecycle, NamespaceAutoProvisioning, NamespaceExists).

If a plugins needs some kind of shared resource e.g. client, the client shall be added to PluginInitializer and Wants methods implemented to every plugin which will use it.
2016-07-22 11:07:05 -07:00
Dominika Hodovska 037d116add Factory for SharedIndexInformers 2016-07-21 14:04:48 +02:00
Wojciech Tyczynski 4d0d115690 Revert "add tokenreviews endpoint to implement webhook" 2016-07-21 09:40:35 +02:00
k8s-merge-robot 8ead63f127 Merge pull request #28788 from deads2k/wire-authentication
Automatic merge from submit-queue

add tokenreviews endpoint to implement webhook

Wires up an API resource under `apis/authentication.k8s.io/v1beta1` to expose the webhook token authentication API as an API resource.  This allows one API server to use another for authentication and uses existing policy engines for the "authoritative" API server to controller access to the endpoint.

@cjcullen you wrote the initial type
2016-07-20 22:23:45 -07:00
deads2k 2c4a9f2e8d interesting changes to add tokenreviews endpoint to implement webhook 2016-07-20 15:11:56 -04:00
deads2k bfa2ff00b9 generated code changes 2016-07-20 15:11:56 -04:00
k8s-merge-robot 1ecd4efce6 Merge pull request #29169 from kevinjkj/kevinjkj-patch-4
Automatic merge from submit-queue

Add defer

Add defer?
2016-07-20 11:51:47 -07:00
k8s-merge-robot a279673de6 Merge pull request #25764 from gtank/certificates-api-controller-v3
Automatic merge from submit-queue

Certificate signing controller for TLS bootstrap (alpha)

The controller handles generating and signing certificates when a CertificateSigningRequest has the "Approved" condition. Uses cfssl to support a wide set of possible keys and algorithms. Depends on PR #25562, only the last two commits are relevant to this PR.

cc @mikedanese

[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/.github/PULL_REQUEST_TEMPLATE.md?pixel)]()
2016-07-19 18:45:31 -07:00
k8s-merge-robot 9ada26d6cd Merge pull request #29219 from caesarxuchao/fix-testeventf
Automatic merge from submit-queue

Don't do string(int)

This is causing https://github.com/kubernetes/kubernetes/pull/29147 to fail the unit test, because the bug prints control character to the test log, and the grep at this [line](https://github.com/kubernetes/kubernetes/blob/master/hack/make-rules/test.sh#L190) returns `Binary file (standard input) matches` error. I don't know why this bug isn't caught before.
2016-07-19 14:06:57 -07:00
Chao Xu 99d8868c7c don't use string(index) 2016-07-19 11:41:16 -07:00
George Tankersley 803c7ac299 certificates: implement certificates controller 2016-07-19 11:25:38 -07:00
k8s-merge-robot be8abdabf8 Merge pull request #27157 from soltysh/scheduledjob_test_2
Automatic merge from submit-queue

Scheduledjob test cont.

This continuation of #25737.

@erictune @caesarxuchao ptal

[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/.github/PULL_REQUEST_TEMPLATE.md?pixel)]()
2016-07-19 02:52:19 -07:00
Kevin Wang 074dab86b9 Add defer
Signed-off-by: Kevin Wang <wang.kanghua@zte.com.cn>
2016-07-19 11:53:01 +08:00
Maciej Szulik 647124bf5e ScheduledJob client and storage tests 2016-07-18 21:01:21 +02:00
Davanum Srinivas 2b0ed014b7 Use Go canonical import paths
Add canonical imports only in existing doc.go files.
https://golang.org/doc/go1.4#canonicalimports

Fixes #29014
2016-07-16 13:48:21 -04:00
k8s-merge-robot 50172148e4 Merge pull request #25273 from ncdc/exec-sigwinch
Automatic merge from submit-queue

Support terminal resizing for exec/attach/run

```release-note
Add support for terminal resizing for exec, attach, and run. Note that for Docker, exec sessions
inherit the environment from the primary process, so if the container was created with tty=false,
that means the exec session's TERM variable will default to "dumb". Users can override this by
setting TERM=xterm (or whatever is appropriate) to get the correct "smart" terminal behavior.
```

Fixes #13585
2016-07-14 07:26:49 -07:00
k8s-merge-robot ae990defcf Merge pull request #26956 from joe2far/fix-typos
Automatic merge from submit-queue

Fixed several typos
2016-07-14 04:13:15 -07:00
k8s-merge-robot 8f08cb3391 Merge pull request #28910 from rmmh/body-log
Automatic merge from submit-queue

Log restclient request/response bodies using %#v.

These are now protobufs, so outputting them with %s dumps a large
amount of binary garbage into the log. %#v properly escapes exotic
characters.
2016-07-13 19:24:13 -07:00
k8s-merge-robot 6b6141f812 Merge pull request #28820 from caesarxuchao/patch-subresource
Automatic merge from submit-queue

[client-gen] Allow passing subresources in Patch method

Expand the Patch() method from:
```
Patch(name string, pt api.PatchType, data []byte)
```
to
```
Patch(name string, pt api.PatchType, data []byte, subresources ...string)
```

Continue on #27293. Fixes #26580.

cc @Random-Liu @lavalamp
2016-07-13 16:09:01 -07:00
Andy Goldstein 3b21a9901b Support terminal resizing for exec/attach/run
Add support for terminal resizing for exec, attach, and run. Note that for Docker, exec sessions
inherit the environment from the primary process, so if the container was created with tty=false,
that means the exec session's TERM variable will default to "dumb". Users can override this by
setting TERM=xterm (or whatever is appropriate) to get the correct "smart" terminal behavior.
2016-07-13 17:06:16 -04:00
Ryan Hitchman f1cd578363 Log restclient request/response bodies using %#v.
These are now protobufs, so outputting them with %s dumps a large
amount of binary garbage into the log. %#v properly escapes exotic
characters.
2016-07-13 11:37:16 -07:00
joe2far 5ead89b5bb Fixed several typos 2016-07-13 15:06:24 +01:00
Chao Xu c2fb39102b generated changes 2016-07-12 11:09:28 -07:00
Chao Xu dc2e12d2f8 manual changes to patch subresource 2016-07-12 11:09:27 -07:00
Madhusudan.C.S eedc9d13d2 Add known versions to release 1.4 clientset. 2016-07-12 10:44:24 -07:00
k8s-merge-robot 98030ded05 Merge pull request #28781 from wojtek-t/optimize_priorities_2
Automatic merge from submit-queue

Change storeToNodeConditionLister to return []*api.Node instead of api.NodeList for performance



Currently copies that are made while copying/creating api.NodeList are significant part of scheduler profile, and a bunch of them are made in places, that are not-parallelizable.
Ref #28590
2016-07-12 06:18:15 -07:00
Wojciech Tyczynski d14fe0f269 Change storeToNodeConditionLister to return []*api.Node instead of api.NodeList for performance 2016-07-11 21:02:33 +02:00
Clayton Coleman 2132ecc28d
Allow a FIFO client to requeue under lock
The Pop method should allow a caller to requeue an item while under the
fifo lock, to avoid races on deletes.
2016-07-10 17:32:21 -04:00
k8s-merge-robot 01c0f8cb54 Merge pull request #28587 from wojtek-t/remove_codec_from_content_config
Automatic merge from submit-queue

Remove Codec from ContentConfig.

This is the remaining cleanup after adding NegotiatedSerializer to ContentConfig.
2016-07-08 21:12:24 -07:00
Wojciech Tyczynski 7403564366 Remove Codec from ContentConfig. 2016-07-08 13:53:09 +02:00
k8s-merge-robot 383d45f185 Merge pull request #28596 from wojtek-t/scheduler_optimizations
Automatic merge from submit-queue

Some scheduler optimizations

Ref #28590

This PR doesn't do anything fancy - it is just reducing amount of memory allocations in scheduler, which in turn significantly speeds up scheduler.
2016-07-08 02:34:06 -07:00
k8s-merge-robot 60c5985d02 Merge pull request #28500 from deads2k/migration
Automatic merge from submit-queue

don't migrate files you can't access

If you can't access a file, you shouldn't try to migrate it.

Ref https://github.com/openshift/origin/issues/9581

@fabianofranz
2016-07-07 17:32:51 -07:00
k8s-merge-robot 8ea57733b4 Merge pull request #28478 from smarterclayton/adaptation
Automatic merge from submit-queue

Autoscaling should be part of clientset.Adaption

@mfojtik
2016-07-07 16:57:36 -07:00
k8s-merge-robot 3494f8e2f9 Merge pull request #28581 from lixiaobing10051267/masternotesorder
Automatic merge from submit-queue

The notes are inconsistent with the code

 In file "pkg/client/cache/store.go, the notes of line 102 "name and namespace" is inconsistent with line 103 "return parts[0], parts[1], nil", because parts[0] is namespace, and parts[1] is name, It is easy to be confused, and better to modify the notes to "namespace and name".
2016-07-07 16:22:50 -07:00
k8s-merge-robot b3c2c9eb5d Merge pull request #27381 from dims/fix-issue-2967
Automatic merge from submit-queue

Fix problem specifying fqdn:port in command line

When specifying --server in kubectl for example, we end up
with failure if you use "localhost:8080" instead of
"127.0.0.1:8080". This is because of the way url.Parse
works as shown in snippet:
https://play.golang.org/p/luD57S6sEz

Essentially localhost ends up as the Scheme and NOT as the Host.
So we add another check to make sure we prepend the scheme
when Host ends up being empty as well. Tested with
"kubectl --server localhost:8080 get po"

Fixes #2967
2016-07-07 13:21:58 -07:00
Wojciech Tyczynski 7219802ac7 Pass pointer to node in NodCondition 2016-07-07 14:10:17 +02:00
k8s-merge-robot 2da247ffbc Merge pull request #26977 from joe2far/fix-help-strings
Automatic merge from submit-queue

Make kubectl help strings consistent
2016-07-07 00:12:22 -07:00
lixiaobing10051267 9915e89107 The notes are in reverse order 2016-07-07 14:45:16 +08:00
k8s-merge-robot bb763df8d5 Merge pull request #28530 from lixiaobing10051267/msterwascreated
Automatic merge from submit-queue

"was not created" should be "was created"

In file pkg\client\restclient/request_test.go, line #1089, "t.Errorf("expected object was not created")" , here "was not created" should be "was created" because the if condition is "if wasCreated".
2016-07-06 23:37:02 -07:00
k8s-merge-robot 0c696dc95b Merge pull request #27848 from liubin/fix-typos
Automatic merge from submit-queue

fix some typos

Just a minor typos fix.


Signed-off-by: bin liu <liubin0329@gmail.com>
2016-07-06 23:36:49 -07:00
Chao Xu a2980e56c9 stop update release_1_3 clientset; create release_1_4 2016-07-06 10:48:28 -07:00
lixiaobing10051267 10a26ab158 "was not created" should be "was created" 2016-07-06 17:42:40 +08:00
Davanum Srinivas 0d86251f5f
Fix problem specifying fqdn:port in command line
When specifying --server in kubectl for example, we end up
with failure if you use "localhost:8080" instead of
"127.0.0.1:8080". This is because of the way url.Parse
works as shown in snippet:
https://play.golang.org/p/luD57S6sEz

Essentially localhost ends up as the Scheme and NOT as the Host.
So we add another check to make sure we prepend the scheme
when Host ends up being empty as well. Tested with
"kubectl --server localhost:8080 get po"

Fixes #2967
2016-07-05 10:10:12 -04:00
deads2k 1b74a12053 don't migrate files you can't access 2016-07-05 09:33:32 -04:00
Wojciech Tyczynski 3c9b68698d Migrate scheduler integration tests 2016-07-05 13:34:26 +02:00
Clayton Coleman 9f28e88574
Autoscaling should be part of clientset.Adaption 2016-07-04 21:54:11 -04:00
bin liu 426fdc431a Merge branch 'master' into fix-typos 2016-07-04 11:20:47 +08:00
k8s-merge-robot 8562021366 Merge pull request #28254 from grodrigues3/Fix-TreeStateVersion-Check
Automatic merge from submit-queue

fixed the typo causing incorrect comparison with cVer and cVer; now checking against sVer

fixes #25252
2016-06-30 23:54:41 -07:00
Garrett Rodrigues 02e29a98b8 reverted the code from 23688 that cause race condition with older version of Go 2016-06-30 16:01:03 -07:00
k8s-merge-robot bc9820ce47 Merge pull request #28232 from cjcullen/webhook2
Automatic merge from submit-queue

Lock all possible kubecfg files at the beginning of ModifyConfig.

Prevent concurrent calls to ModifyConfig on the same (or overlapping) kubeconfig files.
2016-06-29 22:14:04 -07:00
k8s-merge-robot f2ddd60eb9 Merge pull request #26755 from david-mcmahon/fix-headers
Automatic merge from submit-queue

Remove "All rights reserved" from all the headers.

cc @thockin @zmerlynn @brendanburns
2016-06-29 18:46:07 -07:00
k8s-merge-robot d8d5ab29a5 Merge pull request #26756 from hongchaodeng/cli
Automatic merge from submit-queue

Change client default value of qps and burst to constant
2016-06-29 18:11:18 -07:00
David McMahon ef0c9f0c5b Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
Garrett Rodrigues 2cce015167 fixed the typo causing incorrect comparison with cVer and cVer; now checking against sVer 2016-06-29 17:39:41 -07:00
CJ Cullen 00576278b5 Lock all possible kubecfg files at the beginning of ModifyConfig. 2016-06-29 16:15:10 -07:00
k8s-merge-robot 7f3da674f7 Merge pull request #26680 from olegshaldybin/fake-clientset-registry
Automatic merge from submit-queue

Track object modifications in fake clientset

Fake clientset is used by unit tests extensively but it has some
shortcomings:

- no filtering on namespace and name: tests that want to test objects in
  multiple namespaces end up getting all objects from this clientset,
  as it doesn't perform any filtering based on name and namespace;

- updates and deletes don't modify the clientset state, so some tests
  can get unexpected results if they modify/delete objects using the
  clientset;

- it's possible to insert multiple objects with the same
  kind/name/namespace, this leads to confusing behavior, as retrieval is
  based on the insertion order, but anchors on the last added object as
  long as no more objects are added.

This change changes core.ObjectRetriever implementation to track object
adds, updates and deletes.

Some unit tests were depending on the previous (and somewhat incorrect)
behavior. These are fixed in the following few commits.
2016-06-29 06:04:33 -07:00
joe2far 25b4341dc7 Make kubectl help strings consistent 2016-06-29 12:50:24 +01:00
Hongchao Deng 55d3597456 change default value of QPS and burst to constant 2016-06-28 21:45:35 -07:00
Hongchao Deng ca17e4745f docs: client default config of qps and burst 2016-06-28 21:45:35 -07:00
k8s-merge-robot 32eccd413f Merge pull request #25562 from gtank/certificates-api-v9
Automatic merge from submit-queue

TLS bootstrap API group (alpha)

This PR only covers the new types and related client/storage code- the vast majority of the line count is codegen. The implementation differs slightly from the current proposal document based on discussions in design thread (#20439). The controller logic and kubelet support mentioned in the proposal are forthcoming in separate requests.

I submit that #18762 ("Creating a new API group is really hard") is, if anything, understating it. I've tried to structure the commits to illustrate the process.

@mikedanese @erictune @smarterclayton @deads2k

```release-note-experimental
An alpha implementation of the the TLS bootstrap API described in docs/proposals/kubelet-tls-bootstrap.md.
```

[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/.github/PULL_REQUEST_TEMPLATE.md?pixel)]()
2016-06-28 13:25:22 -07:00
George Tankersley c9c6fff269 codegen: GENERATE ALL THE THINGS 2016-06-28 12:05:41 -07:00
Oleg Shaldybin 1f48cd27e7 Expect namespace deletion in NamespaceController
Using new fake clientset registry exposes the actual flow on pending
namespace finalization: get namespace, create finalizer, list pods and
delete namespace if there are no pods.
2016-06-28 11:54:13 -07:00
Oleg Shaldybin d445d4082d Regenerate clientsets 2016-06-28 10:59:54 -07:00
Oleg Shaldybin 10e75946a2 Track object modifications in fake clientset
Fake clientset is used by unit tests extensively but it has some
shortcomings:

- no filtering on namespace and name: tests that want to test objects in
  multiple namespaces end up getting all objects from this clientset,
  as it doesn't perform any filtering based on name and namespace;

- updates and deletes don't modify the clientset state, so some tests
  can get unexpected results if they modify/delete objects using the
  clientset;

- it's possible to insert multiple objects with the same
  kind/name/namespace, this leads to confusing behavior, as retrieval is
  based on the insertion order, but anchors on the last added object as
  long as no more objects are added.

This change changes core.ObjectRetriever implementation to track object
adds, updates and deletes.

Some unit tests were depending on the previous (and somewhat incorrect)
behavior. These are fixed in the following few commits.
2016-06-28 10:59:54 -07:00
k8s-merge-robot 31804fb971 Merge pull request #26857 from rajdeepd/client_test
Automatic merge from submit-queue

Test cases for Rest Client
2016-06-27 22:06:40 -07:00
George Tankersley b084d202bb client/unversioned: add certificates client 2016-06-27 14:29:16 -07:00
k8s-merge-robot b4db89c457 Merge pull request #27644 from enj/dev/enj/issues/9307
Automatic merge from submit-queue

Use preferred group version when discovery fails due to 403

```
kubectl get pods --as bob
```
Returns:
```
error: failed to negotiate an api version; server supports: map[], client supports: map[autoscaling/v1:{} rbac.authorization.k8s.io/v1alpha1:{} federation/v1alpha1:{} batch/v1:{} v1:{} authentication.k8s.io/v1beta1:{} apps/v1alpha1:{} componentconfig/v1alpha1:{} authorization.k8s.io/v1beta1:{} batch/v2alpha1:{} extensions/v1beta1:{} policy/v1alpha1:{}]
```
It should return:
```
User "deads" cannot "impersonate" "users" with name "bob" in project ""
```

`serverVersions` is empty when discovery fails, thus we fallback to the `preferredGV`.

See openshift/origin#9307 and [openshift/origin/pull/9389](https://github.com/openshift/origin/pull/9389) for further details.
2016-06-26 21:11:12 -07:00
k8s-merge-robot 93037844c1 Merge pull request #27293 from caesarxuchao/add-patch-to-clientset
Automatic merge from submit-queue

[client-gen]Add Patch to clientset

* add the Patch() method to the clientset. 
* I have to rename the existing Patch() method of `Event` to PatchWithEventNamespace() to avoid overriding.
* some minor changes to the fake Patch action.

cc @Random-Liu since he asked for the method
@kubernetes/sig-api-machinery 

ref #26580 

```release-note
Add the Patch method to the generated clientset.
```
2016-06-25 19:15:11 -07:00
k8s-merge-robot cbab337b99 Merge pull request #27242 from smarterclayton/discovery_prefix
Automatic merge from submit-queue

Make discovery client parameterizable to legacy prefix
2016-06-25 17:26:05 -07:00
k8s-merge-robot 59b88d7ab6 Merge pull request #26925 from ZTE-PaaS/249043822-patch-1
Automatic merge from submit-queue

optimize deleteFromIndices method of thread_safe_store

As all methods of thread_safe_store are threadsafe, so i think, in deleteFromIndices method, if the index is nil, need not run the for structure below
2016-06-25 12:57:50 -07:00
k8s-merge-robot 07d24e4557 Merge pull request #28004 from mikedanese/fix-nil
Automatic merge from submit-queue

return nil from NewClientConfig instead of empty struct

This is a go convention and fixes an nil pointer in kubelet when passing in bad command line options:

```
I0624 04:12:33.333246   25404 plugins.go:141] Loaded network plugin "kubenet"
E0624 04:12:33.333390   25404 runtime.go:58] Recovered from panic: "invalid memory address or nil pointer dereference" (runtime error: invalid memory address or nil pointer dereference)
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/util/runtime/runtime.go:52
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/util/runtime/runtime.go:40
/usr/local/go/src/runtime/asm_amd64.s:472
/usr/local/go/src/runtime/panic.go:443
/usr/local/go/src/runtime/panic.go:62
/usr/local/go/src/runtime/sigpanic_unix.go:24
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/unversioned/service.go:132
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/kubelet/kubelet.go:254
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/client/cache/listwatch.go:80
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/client/cache/reflector.go:262
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/client/cache/reflector.go:204
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/util/wait/wait.go:86
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/util/wait/wait.go:87
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/util/wait/wait.go:49
```
cc @caesarxuchao @lavalamp
2016-06-24 15:15:08 -07:00
Kris 88e2a31978 Adding lock files for kubeconfig updating 2016-06-24 13:11:52 -07:00
Mike Danese 3162197c23 autogenerated 2016-06-23 22:15:03 -07:00
k8s-merge-robot d36375954e Merge pull request #27733 from caesarxuchao/gc-parametercodec
Automatic merge from submit-queue

let dynamic client handle non-registered ListOptions

And register v1.ListOptions in the policy group.

Fix #27622

@lavalamp @smarterclayton @krousey
2016-06-22 17:36:16 -07:00