Commit Graph

1044 Commits (b2a01d4d94090b5efd81d0b71cb21bbb932c053a)

Author SHA1 Message Date
k8s-merge-robot c63ac4e664 Merge pull request #24331 from jsafrane/devel/refactor-binder
Automatic merge from submit-queue

Refactor persistent volume controller

Here is complete persistent controller as designed in https://github.com/pmorie/pv-haxxz/blob/master/controller.go

It's feature complete and compatible with current binder/recycler/provisioner. No new features, it *should* be much more stable and predictable.

Testing
--
The unit test framework is quite complicated, still it was necessary to reach reasonable coverage (78% in `persistentvolume_controller.go`). The untested part are error cases, which are quite hard to test in reasonable way - sure, I can inject a VersionConflictError on any object update and check the error bubbles up to appropriate places, but the real test would be to run `syncClaim`/`syncVolume` again and check it recovers appropriately from the error in the next periodic sync. That's the hard part.

Organization
---
The PR starts with `rm -rf kubernetes/pkg/controller/persistentvolume`. I find it easier to read when I see only the new controller without old pieces scattered around.
[`types.go` from the old controller is reused to speed up matching a bit, the code looks solid and has 95% unit test coverage].

I tried to split the PR into smaller patches, let me know what you think.

~~TODO~~
--

* ~~Missing: provisioning, recycling~~.
* ~~Fix integration tests~~
* ~~Fix e2e tests~~

@kubernetes/sig-storage

<!-- 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/24331)
<!-- Reviewable:end -->

Fixes #15632
2016-05-19 03:06:46 -07:00
k8s-merge-robot 4f09f51486 Merge pull request #24800 from thockin/validation_pt8-3
Automatic merge from submit-queue

Make name validators return string slices

Part of the larger validation PR, broken out for easier review and merge.  Builds on previous PRs in the series.
2016-05-19 02:15:27 -07:00
Daniel Smith 6dc1437015 Merge pull request #25671 from deads2k/fix-add-indexer
make addIndexers safe for sharedInformer
2016-05-18 14:48:43 -07:00
k8s-merge-robot 48c90f15c5 Merge pull request #24509 from caesarxuchao/primitive-gc
Automatic merge from submit-queue

Adding garbage collector controller

Adding the propagator and garbage processor of the gc.

Design doc is at https://github.com/kubernetes/kubernetes/blob/master/docs/proposals/garbage-collection.md

<!-- 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/24509)
<!-- Reviewable:end -->
2016-05-18 03:14:25 -07:00
Jan Safranek 01b20d8e77 Generate shorter provisioned PV names.
GCE PD names are generated out of provisioned PV.Name, therefore it should be
as short as possible and still unique.
2016-05-18 10:06:51 +02:00
Jan Safranek 79b91b9ee0 Refactor persistent volume initialization
There should be only one initialization function, shared by the real
controller and unit tests.
2016-05-18 10:06:51 +02:00
Jan Safranek 7f549511e2 Big move and rename
- remove persistentvolume_ prefix from all files
- split controller.go into controller.go and controller_base.go (to have them
  under 1500 lines for github)
2016-05-18 10:06:51 +02:00
Jan Safranek c5fe1f943c Fixed binder logging
- we need the original volume/claim in error paths
- don't report version conflicts as errors (they happen pretty often and we
  recover from them)
2016-05-18 10:06:51 +02:00
Jan Safranek 41adcc5496 Speed up binding of provisioned volumes
This fixes e2e test for provisioning - it expects that provisioned volumes
are bound quickly.

Majority of this patch is update of test framework needs to initialize the
controller appropriately.
2016-05-18 10:06:51 +02:00
Jan Safranek c6f05c8056 provisioning: Add unit testso for provisioning errors. 2016-05-18 10:06:51 +02:00
Jan Safranek c24b33793c unit test: Add possibility to inject kubeclient errors. 2016-05-18 10:06:51 +02:00
Jan Safranek 92dc159ab6 Delete provisioned volumes that are not needed.
We should delete volumes that are provisioned for a claim and the claim
gets bound to different volume during the provisioning.
2016-05-18 10:06:51 +02:00
Jan Safranek 9fb0f7a3fd provisioning: Unit tests 2016-05-18 10:06:51 +02:00
Jan Safranek 514d595881 provisioning: Implement provisioner 2016-05-18 10:06:51 +02:00
Jan Safranek 75b0e2ad63 provisioning: Refactor volume plugins.
NewPersistentVolumeTemplate() and Provision() are merged into one call.
2016-05-18 10:06:51 +02:00
Jan Safranek dd7890c362 delete: Implement Deleter 2016-05-18 10:06:51 +02:00
Jan Safranek 22e68d4622 recycler: unit tests
- Add reclaim policy to newVolume() call.
- Implement reactor Volumes().Get().
- Implement mock volume plugin.
- Add recycler tests.
- Add a synchronization condition to controller.scheduleOperation
  - we need to pause the controller here, let the test to do some bad things
    to the controller and test error cases in recycleVolumeOperation.

Test framework gets more and more complicated... But this is the last piece,
I promise.
2016-05-18 10:06:24 +02:00
Jan Safranek a08d826ca5 Make a separate functions to emit events and change status.
These two seem to be always used together.
2016-05-18 10:06:24 +02:00
Jan Safranek 1feb346830 recycler: implement recycler
Also update the old unit test to pass. New unit tests will be added in
subsequent commit.
2016-05-18 10:06:24 +02:00
Jan Safranek 56cae2dc20 unit test framework: Wait for all running operations to finish during all tests. 2016-05-18 10:06:24 +02:00
Jan Safranek cf68370371 recycler: Maintain a list of long-running operations.
We need to keep list of running recyclers, deleters and provisioners in
memory in order not to start a new recycling/deleting/provisioning twice
for the same volume/claim.

This will be eventually replaced by GoRoutineMap from PR #24838.
2016-05-18 10:06:24 +02:00
Jan Safranek 4e47f69cba recycler: Implement volume host interfaces.
We need the controller to implement volume.VolumeHost interface to be able
to call recycle plugins.
2016-05-18 10:06:24 +02:00
Jan Safranek a17f0d5949 Move release logic to standalone function. 2016-05-18 10:06:23 +02:00
Jan Safranek 7b73384fda Add controller method tests. 2016-05-18 10:05:14 +02:00
Tim Hockin 152c86ab06 Make name validators return string slices 2016-05-18 00:48:01 -07:00
k8s-merge-robot a24f03c3c9 Merge pull request #25669 from deads2k/fix-npe
Automatic merge from submit-queue

prevent nil pointer when starting controllers before running the shar…

Fixes https://github.com/kubernetes/kubernetes/issues/25643.

https://github.com/kubernetes/kubernetes/pull/23795 changed initialization order, so the controller isn't guaranteed to be present at startup.

@mqliang @wojtek-t I'm pretty sure that we're not guaranteed to get back the correct `cache.Indexer` or `cache.Store` either.  I'll look at re-plumbing the `AddIndexer` path to use the same instance so that its safe to use again.
2016-05-17 07:54:12 -07:00
Jan Safranek af295719f6 Add events. 2016-05-17 15:14:11 +02:00
Jan Safranek 61019b2401 Process deleted PVs
To speed up marking claims as "lost".
2016-05-17 15:14:10 +02:00
Jan Safranek 50b61ae168 Add "multi-sync" tests.
These test will call syncVolume/syncClaim until they reach consistent state.
2016-05-17 15:14:09 +02:00
Jan Safranek f4f252e81c Implement syncVolume. 2016-05-17 15:14:08 +02:00
Jan Safranek 5949b956f5 Implement syncClaim with bound claims. 2016-05-17 15:14:06 +02:00
Jan Safranek eff6b50b93 Bind unbound claims in syncClaim. 2016-05-17 15:14:06 +02:00
Jan Safranek e620bfc9cc Add unit test framework.
It's quite complicated one, see subsequent commits for usage.
2016-05-17 15:14:05 +02:00
Jan Safranek a195802d3e Make standalone function to check for (pre-)bound volumes.
Note the semantic change, we now check for UID=""
2016-05-17 15:14:04 +02:00
Jan Safranek 20305f9235 Don't process events until fully initialized.
We do not want to process any volume / claim events until both PV and claim
caches are fully loaded.
2016-05-17 15:14:03 +02:00
Jan Safranek 71aa892a86 Implement volume controller skeleton.
This is a simple controller that watches changes of PersistentVolumes and
PersistentVolumeClaims.
2016-05-17 15:14:02 +02:00
Jan Safranek b86e5923b2 Rename types.go to persistentvolume_index.go
With some changes:
- make some method private, nobody seems to use them.
- adapt to framework.NewIndexerInformer instead of using custom cache.
2016-05-17 15:14:01 +02:00
k8s-merge-robot a57fd9adfb Merge pull request #25651 from 249043822/249043822-patch-1
Automatic merge from submit-queue

MatchingCache lock optimize
2016-05-17 01:56:03 -07:00
deads2k 4a39cc9dd3 make addIndexers safe for sharedInformer 2016-05-16 10:15:05 -04:00
deads2k 4af1c546b4 prevent nil pointer when starting controllers before running the shared informer 2016-05-16 09:53:45 -04:00
zhangke 49f4f242a8 Update lookup_cache.go
MatchingCache struct hold a RWLock, so Get operation of Cache should use RLock properly, nor WLock
2016-05-16 15:26:30 +08:00
Wojciech Tyczynski 626ff900ad Explicitly enqueue controllers on failures and increase resync period 2016-05-16 08:52:01 +02:00
Chao Xu c73406bcfe the garbage collector controller 2016-05-15 16:04:19 -07:00
k8s-merge-robot 3b18a12eb9 Merge pull request #24736 from jayunit100/hpa-computeimpl
Automatic merge from submit-queue

Horizontal autoscalaer tolerance breaching verifier

@piosz @jszczepkowski This is the original HPA test without the other modifications, it makes explicit the mathematics of the logic in case changes ever occur.

<!-- 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/24736)
<!-- Reviewable:end -->
2016-05-14 21:28:34 -07:00
k8s-merge-robot f6c2560f68 Merge pull request #25565 from wojtek-t/traces_in_replication_controller
Automatic merge from submit-queue

Add traces to ReplicationController

Ref #25563
2016-05-13 03:41:31 -07:00
Wojciech Tyczynski 327c9486e1 Add traces to ReplicationController 2016-05-13 10:30:45 +02:00
jay vyas db3d1b6942 horizontal pod autoscaler tolerance breaching verifier 2016-05-12 22:27:42 -04:00
Saad Ali 19169889d4 Merge pull request #24908 from pmorie/daemon-controller-loc
Reduce LOC in daemon controller tests
2016-05-12 15:51:55 -07:00
k8s-merge-robot 08440b5dcc Merge pull request #24836 from Clarifai/gpu-impl
Automatic merge from submit-queue

WIP v0 NVIDIA GPU support

```release-note
* Alpha support for scheduling pods on machines with NVIDIA GPUs whose kubelets use the `--experimental-nvidia-gpus` flag, using the alpha.kubernetes.io/nvidia-gpu resource 
```

Implements part of #24071 for  #23587

I am not familiar with the scheduler enough to know what to do with the scores. Mostly punting for now.

Missing items from the implementation plan: limitranger, rkt support, kubectl
support and docs

cc @erictune @davidopp @dchen1107 @vishh @Hui-Zhi @gopinatht
2016-05-12 14:04:15 -07:00
k8s-merge-robot 15919f336f Merge pull request #25284 from bprashanth/service_unready
Automatic merge from submit-queue

Add a service annotation that allows endpoints for unready pods

See https://github.com/kubernetes/kubernetes/issues/25283 for context 
@smarterclayton @thockin yes?

<!-- 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/25284)
<!-- Reviewable:end -->
2016-05-12 12:05:27 -07:00