Commit Graph

1188 Commits (2d6c632de2f9ac15005c188913f779a81b392c81)

Author SHA1 Message Date
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
k8s-merge-robot 532491aab6 Merge pull request #28095 from saad-ali/fixRacyVolumesInUse
Automatic merge from submit-queue

Kubelet should mark VolumeInUse before checking if it is Attached

Kubelet should mark VolumeInUse before checking if it is Attached.
Controller should fetch fresh copy of node object before detach instead of relying on node informer cache.

Fixes #27836
2016-06-28 15:59:17 -07:00
saadali e06b32b1ef Mark VolumeInUse before checking if it is Attached
Ensure that kublet marks VolumeInUse before checking if it is Attached.
Also ensures that the attach/detach controller always fetches a fresh
copy of the node object before detach (instead ofKubelet relying on node
informer cache).
2016-06-28 14:05:59 -07:00
Oleg Shaldybin a58b4cf59d Don't panic in NodeController if pod update fails
Previously it was trying to use a nil pod variable if error was returned
from the pod update call.
2016-06-28 11:54:13 -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 aff173f7d1 Fix expectations in deployment controller test
Since fake clientset now correctly tracks objects created by deployment
controller, it triggers different controller behavior: controller only
creates replica set once and updates deployment once.
2016-06-28 11:54:13 -07:00
Oleg Shaldybin 3b15d5be19 Use correct namespace in unit tests that use fake clientset
Fake clientset no longer needs to be prepopulated with records: keeping
them in leads to the name conflict on creates. Also, since fake
clientset now respects namespaces, we need to correctly populate them.
2016-06-28 11:26:34 -07:00
k8s-merge-robot 8c5be726d8 Merge pull request #28147 from jsafrane/clone-error-checks
Automatic merge from submit-queue

Fix error checks after cloning.

We should not use clone result When cloning fails. Fixes issues found in #28108.
2016-06-28 10:29:53 -07:00
deads2k 3ad54d1812 add lastsyncresourceversion to sharedinformer 2016-06-28 07:42:15 -04:00
Jan Safranek d78946240e Fix error checks after cloning.
We should not use clone result When cloning fails. Fixes issues found in #28108.
2016-06-28 10:01:52 +02:00
k8s-merge-robot e32b871637 Merge pull request #26771 from kargakis/use-pod-namespacer
Automatic merge from submit-queue

kubectl: fix sort logic for logs

@kubernetes/kubectl
2016-06-27 21:33:59 -07:00
k8s-merge-robot 3e5cdd796c Merge pull request #23858 from liggitt/satoken-queue
Automatic merge from submit-queue

Convert service account token controller to use a work queue

Converts the service account token controller to use a work queue. This allows parallelization of token generation (useful when there are several simultaneous namespaces or service accounts being created). It also lets us requeue failures to be retried sooned than the next sync period (which can be very long).

Fixes an issue seen when a namespace is created with secrets quotaed, and the token controller tries to create a token secret prior to the quota status having been initialized. In that case, the secret is rejected at admission, and the token controller wasn't retrying until the resync period.
2016-06-27 16:43:14 -07:00
k8s-merge-robot be682148fb Merge pull request #28108 from jsafrane/fix-cache-init
Automatic merge from submit-queue

Fix initialization of volume controller caches.

Fix `PersistentVolumeController.initializeCaches()` to pass pointers to volume or claim to  `storeObjectUpdate()` and add extra functions to enforce that the right types are checked in the future.

Fixes #28076
2016-06-27 14:18:51 -07:00
Xiang Li 880432ca71 daemon/controller.go: minor code cleanup 2016-06-27 10:43:06 -07:00
Jordan Liggitt f45d9dc2f8 Convert service account token controller to use a work queue 2016-06-27 13:01:24 -04:00
Jan Safranek 169076e7da Fix initialization of volume controller caches.
Fix PersistentVolumeController.initializeCaches() to pass pointers to volume
or claim to storeObjectUpdate() and add extra functions to enforce that the
right types are checked in the future.


Fixes #28076
2016-06-27 13:08:02 +02: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 1effc5af91 Merge pull request #28002 from asalkeld/init-cache-error
Automatic merge from submit-queue

Fix startup type error in initializeCaches

The following error was getting logged:
PersistentVolumeController can't initialize caches, expected list of volumes, got:
&{TypeMeta:{Kind: APIVersion:} ListMeta:{SelfLink:/api/v1/persistentvolumes ResourceVersion:11} Items:[]}

The tests make extensive use of NewFakeControllerSource which uses api.List
instead of api.PersistentVolumeList. So use reflect to help iterate over the
items then assert the item type.

fixes #27757
2016-06-25 14:13:15 -07:00
k8s-merge-robot 601173c2fe Merge pull request #26916 from caesarxuchao/podgc
Automatic merge from submit-queue

rename the gc for terminated pods to "podgc"

to avoid name collision with the [generic garbage collector](https://github.com/kubernetes/kubernetes/blob/master/pkg/controller/garbagecollector/garbagecollector.go)
2016-06-25 12:24:07 -07:00
k8s-merge-robot d1407ecdd3 Merge pull request #26867 from xiang90/daemon
Automatic merge from submit-queue

daemon/controller.go: refactor worker

1. function name is better to be verb or verb+noun

2. remove unnecessary func call
2016-06-25 11:43:49 -07:00
k8s-merge-robot 464eff2bf2 Merge pull request #26504 from nowprovision/patch-1
Automatic merge from submit-queue

Fix error handling in endpoint controller
2016-06-25 07:43:49 -07:00
k8s-merge-robot fc1937f68f Merge pull request #20273 from kargakis/allow-scaling-paused-deployments
Automatic merge from submit-queue

Proportionally scale paused and rolling deployments

Enable paused and rolling deployments to be proportionally scaled.
Also have cleanup policy work for paused deployments.

Fixes #20853
Fixes #20966
Fixes #20754

@bgrant0607 @janetkuo @ironcladlou @nikhiljindal

<!-- Reviewable:start -->
---
This change is [<img src="http://reviewable.k8s.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](http://reviewable.k8s.io/reviews/kubernetes/kubernetes/20273)
<!-- Reviewable:end -->
2016-06-24 19:41:51 -07:00
Angus Salkeld b4f7e67d25 Fix startup type error in initializeCaches
The following error was getting logged:
PersistentVolumeController can't initialize caches, expected list of volumes, got:
&{TypeMeta:{Kind: APIVersion:} ListMeta:{SelfLink:/api/v1/persistentvolumes ResourceVersion:11} Items:[]}
2016-06-25 10:15:27 +10:00
k8s-merge-robot 8509b35cf2 Merge pull request #27637 from hongchaodeng/rc-clean
Automatic merge from submit-queue

RC: rename wait -> wg

We already have a package called "wait". We should differentiate the name.

/cc @caesarxuchao
2016-06-24 13:57:13 -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
Chao Xu d9f07925be let dynamic client handle non-registered ListOptions;
register ListOptions for apis/policy
2016-06-22 13:18:50 -07:00
saadali dfe8e606c1 Fix device path used by volume WaitForAttach 2016-06-22 12:56:58 -07:00
k8s-merge-robot 5289de0501 Merge pull request #27837 from saad-ali/blockKubeletDetachFix
Automatic merge from submit-queue

Prevent detach before node status update

The PR prevents the attach/detach controller from start a detach operation before updating the node status (to remove the volume from the list of attached volumes).

Fixes https://github.com/kubernetes/kubernetes/issues/27836
2016-06-22 10:10:58 -07:00
saadali 773ac20880 Prevent detach before node status update 2016-06-22 04:45:50 -07:00
k8s-merge-robot 07471cf90f Merge pull request #27553 from justinsb/pvc_zone_spreading_2
Automatic merge from submit-queue

AWS/GCE: Spread PetSet volume creation across zones, create GCE volumes in non-master zones

Long term we plan on integrating this into the scheduler, but in the
short term we use the volume name to place it onto a zone.
    
We hash the volume name so we don't bias to the first few zones.
    
If the volume name "looks like" a PetSet volume name (ending with
-<number>) then we use the number as an offset.  In that case we hash
the base name.
2016-06-22 01:22:16 -07:00
Jing Xu 0fefb23f94 implement desiredWorld populator to sync up with informer
This change implements the desiredStateOfWorld populator to sync up with
the pod informer. It periodically check each pod in the
desiredStateOfworld and verify whether it is still in pod informer
cache. If it not, remove it from the desiredStateOfWorld
2016-06-21 17:09:35 -07:00
k8s-merge-robot 459757cf08 Merge pull request #27728 from janetkuo/deployment-cleanup-unhealthy
Automatic merge from submit-queue

Deployment controller's cleanupUnhealthyReplicas should respect minReadySeconds

```release-note
Fixed an issue that Deployment may be scaled down further than allowed by maxUnavailable when minReadySeconds is set.
```

Fixes #26834

Detected by a flake in deployment rollover e2e test (the only test that specifies `minReadySeconds`).

cc @kubernetes/deployment @pwittrock 
cc @mqliang who first added `cleanupUnhealthyReplicas` in deployment controller 

[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/.github/PULL_REQUEST_TEMPLATE.md?pixel)]()
2016-06-21 11:46:12 -07:00
k8s-merge-robot ec518005a8 Merge pull request #27567 from saad-ali/blockKubeletOnAttachController
Automatic merge from submit-queue

Kubelet Volume Manager Wait For Attach Detach Controller and Backoff on Error

* Closes https://github.com/kubernetes/kubernetes/issues/27483
  * Modified Attach/Detach controller to report `Node.Status.AttachedVolumes` on successful attach (unique volume name along with device path).
  * Modified Kubelet Volume Manager wait for Attach/Detach controller to report success before proceeding with attach.
* Closes https://github.com/kubernetes/kubernetes/issues/27492
  * Implemented an exponential backoff mechanism for for volume manager and attach/detach controller to prevent operations (attach/detach/mount/unmount/wait for controller attach/etc) from executing back to back unchecked.
* Closes https://github.com/kubernetes/kubernetes/issues/26679
  * Modified volume `Attacher.WaitForAttach()` methods to uses the device path reported by the Attach/Detach controller in `Node.Status.AttachedVolumes` instead of calling out to cloud providers.
2016-06-20 20:36:08 -07:00
saadali e716ddc771 Controller wait for attach and exponential backoff
Modify attach/detach controller to keep track of volumes to report
attached in Node VolumeToAttach status.

Modify kubelet volume manager to wait for volume to show up in Node
VolumeToAttach status.

Implement exponential backoff for errors in volume manager and attach
detach controller
2016-06-20 18:19:55 -07:00
Janet Kuo 726ba45b59 Deployment controller's cleanupUnhealthyReplicas should respect minReadySeconds 2016-06-20 15:03:57 -07:00
k8s-merge-robot d19c8ed825 Merge pull request #27609 from ZTE-PaaS/zhangke-patch-001
Automatic merge from submit-queue

EndpointController syncService log error

Here key param should service nor rc
2016-06-20 13:06:44 -07:00
Michail Kargakis f3d2e3ff22 controller: proportionally scale paused and rolling deployments
Enable paused and rolling deployments to be proportionally scaled.
Also have cleanup policy work for paused deployments.
2016-06-20 12:13:35 +02:00
k8s-merge-robot d8b463dfd2 Merge pull request #27128 from markturansky/disable_provisioning
Automatic merge from submit-queue

Allow disabling of dynamic provisioning

Allow administrators to opt-out of dynamic provisioning.  Provisioning is still on by default, which is the current behavior.

Per a conversation with @jsafrane, a boolean toggle was added and plumbed through into the controller.  Deliberate disabling will simply return nil from `provisionClaim` whereas a misconfigured provisioner will continue on and generate error events for the PVC.

@kubernetes/rh-storage @saad-ali @thockin  @abhgupta
2016-06-20 02:10:43 -07:00
k8s-merge-robot 0730ffbff7 Merge pull request #27434 from jsafrane/pv-events-message
Automatic merge from submit-queue

Fill PV.Status.Message with deleter/recycler errors.

Instead of empty `Message` `kubectl describe pv` now shows:

```
Name:		nfs
Labels:		<none>
Status:		Failed
Claim:		default/nfs
Reclaim Policy:	Recycle
Access Modes:	RWX
Capacity:	1Mi
Message:	Recycler failed: Pod was active on the node longer than specified deadline
Source:
    Type:	NFS (an NFS mount that lasts the lifetime of a pod)
    Server:	10.999.999.999
    Path:	/
    ReadOnly:	false
```

This is actually a regression since 1.2

@kubernetes/sig-storage
2016-06-20 01:36:28 -07:00
saadali 926bb4cca0 Add patch status to Node internalclientset 2016-06-19 23:54:02 -07:00
markturansky 16ec36c591 added toggle to disable dynamic provisioning 2016-06-20 01:15:23 -04:00
Justin Santa Barbara e711cbf912 GCE/AWS: Spread PetSet volume creation across zones
Long term we plan on integrating this into the scheduler, but in the
short term we use the volume name to place it onto a zone.

We hash the volume name so we don't bias to the first few zones.

If the volume name "looks like" a PetSet volume name (ending with
-<number>) then we use the number as an offset.  In that case we hash
the base name.

Fixes #27256
2016-06-17 23:27:31 -04:00
Hongchao Deng b9c8c0fc23 RC: rename wait -> wg
We already have a package called "wait". We should make the name different.
2016-06-17 12:16:15 -07:00
goltermann 218645b346 Fix several spelling errors in comments. 2016-06-17 10:41:18 -07:00
Chao Xu a29f6aa8ae add Patch to clientsets 2016-06-17 10:30:58 -07:00
Ke Zhang c8471f2c3e EndpointController syncService log error 2016-06-17 17:05:50 +08:00
k8s-merge-robot 646a872f15 Merge pull request #27415 from caesarxuchao/fix-oldrc
Automatic merge from submit-queue

fix updatePod() of RS and RC controllers

Fix updatePod of replication controller manager and replica set controller to handle pod label updates that match no RC or RS.

Fix #27405
2016-06-16 17:09:53 -07:00
Chao Xu 63fb075f0a fix updatePod of replication controller manager and replica set controller to
handle pod label updates that match no rc or rs
2016-06-15 10:34:26 -07:00
saadali 542f2dc708 Introduce new kubelet volume manager
This commit adds a new volume manager in kubelet that synchronizes
volume mount/unmount (and attach/detach, if attach/detach controller
is not enabled).

This eliminates the race conditions between the pod creation loop
and the orphaned volumes loops. It also removes the unmount/detach
from the `syncPod()` path so volume clean up never blocks the
`syncPod` loop.
2016-06-15 09:34:08 -07:00
saadali 9b6a505f8a Rename UniqueDeviceName to UniqueVolumeName
Rename UniqueDeviceName to UniqueVolumeName and move helper functions
from attacherdetacher to volumehelper package.
Introduce UniquePodName alias
2016-06-15 09:32:12 -07:00