Commit Graph

2551 Commits (032e450ec41f2fb06420e4fd1b0aac44f58c2ff5)

Author SHA1 Message Date
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
Clayton Coleman 95116c776e
Authorization should be registered in testapi 2016-11-01 22:55:58 -04:00
Clayton Coleman 8987019931
Improve the common kinds API test to catch more errors 2016-11-01 22:55:58 -04:00
Mike Danese 030cb6927b kubeadm: fix central api tests 2016-11-01 16:48:45 -07:00
Clayton Coleman ab673bbc9a
generated: alternative unsafe conversions 2016-10-31 11:00:29 -04:00
Kubernetes Submit Queue 9a219eb803 Merge pull request #34651 from smarterclayton/negotiate
Automatic merge from submit-queue

Simplify negotiation in server in preparation for multi version support

This is a pre-factor for #33900 to simplify runtime.NegotiatedSerializer, tighten up a few abstractions that may break when clients can request different client versions, and pave the way for better negotiation.

View this as pure simplification.
2016-10-29 03:32:02 -07:00
Connor Doyle c93646e8da Support opaque integer resource accounting.
- Prevents kubelet from overwriting capacity during sync.
- Handles opaque integer resources in the scheduler.
  - Adds scheduler predicate tests for opaque resources.
- Validates opaque int resources:
  - Ensures supplied opaque int quantities in node capacity,
    node allocatable, pod request and pod limit are integers.
  - Adds tests for new validation logic (node update and pod spec).
- Added e2e tests for opaque integer resources.
2016-10-28 10:15:13 -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
Janet Kuo 10aee82ae3 Rename PetSet API to StatefulSet 2016-10-27 17:25:10 -07:00
Kubernetes Submit Queue dcdbf27d4f Merge pull request #34648 from nikhiljindal/NSCasDel
Automatic merge from submit-queue

Adding cascading deletion support to federated namespaces

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

With this change, whenever a federated namespace is deleted with `DeleteOptions.OrphanDependents = false`, then federation namespace controller first deletes the corresponding namespaces from all underlying clusters before deleting the federated namespace.

cc @kubernetes/sig-cluster-federation @caesarxuchao


```release-note
Adding support for DeleteOptions.OrphanDependents for federated namespaces. Setting it to false while deleting a federated namespace also deletes the corresponding namespace from all registered clusters.
```
2016-10-26 21:04:03 -07:00
nikhiljindal f955d556f8 Adding cascading deletion support to federated namespaces 2016-10-26 16:54:12 -07:00
Clayton Coleman b5a46d914e
generated: conversions 2016-10-26 12:48:45 -04:00
Clayton Coleman 3ff5cb6ec7
Move resource.Quantity rounding to defaulter
This reverts commit feb56cc486.
2016-10-26 12:21:27 -04:00
Wojciech Tyczynski bbb410c7af generated: Safe conversions 2016-10-26 11:20:37 +02:00
Wojciech Tyczynski feb56cc486 Revert "Move resource.Quantity rounding to defaulter"
This reverts commit 5b18b4e515.
2016-10-26 10:21:54 +02:00
Clayton Coleman d1c39c0a76
generated: Unsafe conversions 2016-10-25 19:30:34 -04:00
Clayton Coleman 5b18b4e515
Move resource.Quantity rounding to defaulter 2016-10-25 19:28:41 -04:00
Clayton Coleman 07bd50be0d
Internal weight field for affinity must be int32 2016-10-25 19:28:40 -04:00
Clayton Coleman 65042efb0f
Add conversion instructions 2016-10-25 19:28:40 -04:00
Kubernetes Submit Queue c0b7b75713 Merge pull request #35057 from rhcarvalho/typos
Automatic merge from submit-queue

Fix some typos

<!--  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**: fixes a typo an its auto-generated repetitions.

**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-10-25 11:02:08 -07:00
Kubernetes Submit Queue e3067f326f Merge pull request #34634 from mwielgus/pod-unschedulable
Automatic merge from submit-queue

Make "Unschedulable" reason a constant in api

String "Unschedulable" is used in couple places in K8S:
* scheduler
* federation replicaset and deployment controllers
* cluster autoscaler
* rescheduler
This PR makes the string a part of API so it not changed.

cc: @davidopp @fgrzadkowski @wojtek-t
2016-10-25 09:30:49 -07: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 bdaf502ff4 Merge pull request #34094 from nebril/hless-to-nonhless-ip
Automatic merge from submit-queue

Deny service ClusterIP update from `None`

**What this PR does / why we need it**: Headless service should not be transformed into a service with ClusterIP, therefore update of this field if it's set to `None` is disallowed.

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

**Release note**:
```release-note
Changing service ClusterIP from `None` is not allowed anymore.
```
2016-10-21 14:34:56 -07:00
Maciej Kwiek d1c32b8194 Test cases for service ClusterIP updates
Test cases from ClusterIP using types to other ClusterIP using types
(ClusterIP, NodePort, LoadBalancer) added.
2016-10-21 13:11:57 +02:00
Kubernetes Submit Queue c98eb3867f Merge pull request #35199 from kargakis/remove-last-probe-time
Automatic merge from submit-queue

Remove last probe time from replica sets

While experimenting with Deployment conditions I found out that if we are going to use lastProbeTime as we are supposed to be using it then we hotloop between updates (see https://github.com/kubernetes/kubernetes/pull/19343#issuecomment-255096778 for more info)

cc: @smarterclayton @soltysh
2016-10-21 01:47:01 -07:00
Maciej Kwiek 7df1afe71f Deny ClusterIP update for services using it
If the service is of the type using the ClusterIP (ClusterIP, NodePort,
LoadBalancer), the update of ClusterIP is prohibited.
2016-10-21 09:53:39 +02:00
Kubernetes Submit Queue c6df88991d Merge pull request #35194 from wojtek-t/efficient_selector
Automatic merge from submit-queue

Optimize label selector

The number of values for a given label is generally pretty small (in huge majority of cases it is exactly one value).
Currently computing selectors is up to 50% of CPU usage in both apiserver and scheduler.

Changing the structure in which those values are stored from map to slice improves the performance of typical usecase for computing selectors.

Early results:
- scheduler throughput it ~15% higher
- apiserver cpu-usage is also lower (seems to be also ~10-15%)
2016-10-20 20:45:22 -07:00
Kubernetes Submit Queue e6b5b076b8 Merge pull request #33957 from bprashanth/esipp-beta
Automatic merge from submit-queue

Loadbalanced client src ip preservation enters beta

Sounds like we're going to try out the proposal (https://github.com/kubernetes/kubernetes/issues/30819#issuecomment-249877334) for annotations -> fields on just one feature in 1.5 (scheduler). Or do we want to just convert to fields right now?
2016-10-20 06:53:07 -07:00
Wojciech Tyczynski 9c91da7a22 More efficient selector 2016-10-20 15:16:58 +02:00
Michail Kargakis a4694ef1af Generated changes for lastProbeTime removal 2016-10-20 15:16:46 +02:00
Michail Kargakis 628e630424 Remove lastProbeTime from rc/rs conditions 2016-10-20 15:03:06 +02:00
Kubernetes Submit Queue 41c9bbcc02 Merge pull request #34514 from derekwaynecarr/validation-fixes
Automatic merge from submit-queue

requests.storage is a standard resource name

The value `requests.storage` is a valid standard resource name but was omitted from the standard list.
2016-10-19 21:16:35 -07:00
bprashanth 5029bb06e9 Validation 2016-10-19 14:51:57 -07:00
Kubernetes Submit Queue 2de1f5c07e Merge pull request #34407 from brendandburns/kubectl-schema
Automatic merge from submit-queue

Add validation that detects repeated keys in the labels and annotations maps

Fixes #2965  (a nearly 2 year old feature request!)

@kubernetes/kubectl 

@eparis
2016-10-19 14:01:00 -07:00
bprashanth a46a849b9e Promote source ip annotations to beta 2016-10-19 13:39:37 -07:00
derekwaynecarr d5c45e8892 requests.storage is a standard resource name 2016-10-19 15:54:08 -04:00
Kubernetes Submit Queue 91b7e1f9c3 Merge pull request #34638 from screeley44/k8-get-sc
Automatic merge from submit-queue

Adding default StorageClass annotation printout for resource_printer and describer and some refactoring

adding ISDEFAULT for _kubectl get storageclass_ output

```
[root@screeley-sc1 gce]# kubectl get storageclass
NAME            TYPE                   ISDEFAULT
another-class   kubernetes.io/gce-pd   NO        
generic1-slow   kubernetes.io/gce-pd   YES       
generic2-fast   kubernetes.io/gce-pd   YES       
```

```release-note
Add ISDEFAULT to kubectl get storageClass output
```

@kubernetes/sig-storage
2016-10-19 11:36:08 -07:00
Scott Creeley 86f1a94be5 Adding default StorageClass annotation printout for resource_printer 2016-10-19 10:59:07 -04:00
Kubernetes Submit Queue 3fc8cff07d Merge pull request #35071 from thockin/volume-mount-merge-key
Automatic merge from submit-queue

Change merge key for VolumeMount to mountPath

Fixes #34800
2016-10-19 00:21:03 -07:00
Kubernetes Submit Queue 2ea4e1f066 Merge pull request #33352 from smarterclayton/unified_defaulters
Automatic merge from submit-queue

Split conversion and defaulting

Separate conversion and defaulting.   Defaulting occurs mixed with conversion today - change the server so that the `VersioningCodec` performs defaulting on the external type during decoding.  

* Add a new method to `Scheme` - `func (*runtime.Scheme) Default(runtime.Object)` - that takes an object and performs defaulting.  
* Call `Default` during decoding and at static initialization time
* Use the new `defaulter-gen` to generate top level object defaulters (`v1.Pod`) at build time for any type that needs to perform defaulting.  
* Add tests and alter the existing code to adapt as necessary
* Fix a few bugs in conversions that depended on defaulting behavior

---

Step 1 of decoupling conversion and defaulting. The generator will assist in creating top level defaulters that in a single method invoke all nested defaulters, preventing the need to recurse via reflection or conversion. These top level defaulters will be registered in the scheme and invoked instead of the nested recursion path. This will set the stage for a future generator, capable of creating defaulters from embedded struct tags on external types. However, we must gradually switch these over.

The immediate goal here is to split defaulting and conversion so that the unsafe convertor can be used to maximum potential (we would be able to use direct memory conversion for any identical nested struct, even those that must be defaulted).

The generator uses `k8s:defaulter-gen=TypeMeta` on most public packages to flag any top level type that has defaulters to get a `SetObjectDefaults_NAME` function created (types that don't have defaulters won't have functions).  This also creates a `RegisterDefaults` method that applies a default to an interface{} and returns true if the object was handled.  Existing defaults are left as is.

Add a test to verify old and new path generate the same outcomes.  Defaulter will move to gengo before this is merged, and subsequent PRs will remove defaulting during conversion and have the VersioningCodec apply defaults.
2016-10-18 20:34:13 -07:00
Kubernetes Submit Queue 103dc654a9 Merge pull request #35023 from k82cn/remove_empty_line
Automatic merge from submit-queue

Removed empty line.
2016-10-18 18:27:29 -07:00
Clayton Coleman 3ee591d7ab
Invoke init container defaulting in conversion
Because annotations...

Remove old references to DefaultingInterface in manual conversions.
2016-10-18 21:07:35 -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
Clayton Coleman 742fb698d4
generated: Remove defaulting from conversion 2016-10-18 21:07:34 -04:00
Clayton Coleman 4f8d1a86e5
Add a defaulting test that verifies old and new defaults are equivalent 2016-10-18 21:07:34 -04:00
Clayton Coleman 89b3a0d863
Register new defaulting functions 2016-10-18 21:07:34 -04:00
Clayton Coleman 745690a2d4
generated: Defaulters 2016-10-18 21:07:33 -04:00
Clayton Coleman 4324e39393
Flag all packages as needing defaulters 2016-10-18 21:07:33 -04:00
Clayton Coleman 5062406b77
Hand generated conversion should check nil 2016-10-18 21:07:32 -04:00