Commit Graph

51 Commits

Author SHA1 Message Date
Konstantin Misyutin
1d7cefe9c4 Move volume helpers to "k8s.io/component-helpers/storage/volume".
This patch aims to simplify decoupling "pkg/scheduler/framework/plugins"
from internal "k8s.io/kubernetes" packages. More described in
issue #89930 and PR #102953.

Some helpers from "k8s.io/kubernetes/pkg/controller/volume/persistentvolume"
package moved to "k8s.io/component-helpers/storage/volume" package:

- IsDelayBindingMode
- GetBindVolumeToClaim
- IsVolumeBoundToClaim
- FindMatchingVolume
- CheckVolumeModeMismatches
- CheckAccessModes
- GetVolumeNodeAffinity

Also "CheckNodeAffinity" from "k8s.io/kubernetes/pkg/volume/util"
package moved to "k8s.io/component-helpers/storage/volume" package
to prevent diamond dependency conflict.

Signed-off-by: Konstantin Misyutin <konstantin.misyutin@huawei.com>
2022-03-16 15:43:09 +08:00
Deepak Kinni
d37f14d0ae Support for in-tree PV Deletion protection finalizer
Signed-off-by: Deepak Kinni <dkinni@vmware.com>
2022-03-10 21:37:43 -08:00
Jan Safranek
0f9832d095 Fix PV name in unit test
Test 5-5 should use PV with "5-5"i in the name. It makes log analysys
much easier.
2022-01-03 15:20:12 +01:00
Jan Safranek
045ca75c03 Deflake PV metrics unit test
Test 5-7 tries to delete a PVC at the very same time when it detects that
the PV controller started processing the PVC. The controller then sometimes
can't update the PVC and generate an event for it that the test expects.

From PV controller logs (not shown in CI):
> I1221 14:36:34.548160  104481 pv_controller.go:815] updating PersistentVolumeClaim[default/claim5-7] status: set phase Lost failed: cannot update claim claim5-7: claim not found

Typical error in CI:
> FAIL: TestControllerSync (83.22s)
> framework_test.go:202: Event "Warning ClaimLost" not emitted

Therefore wait for the PVC to be fully processed before deleting the PVC to
avoid races.
2021-12-21 15:36:44 +01:00
Jan Safranek
e323306ce0 Add new watchers to PV controller tests
Add fake Pod and Node watchers to the tests. It only reduces test noise:

Failed to watch *v1.Pod: unhandled watch: testing.WatchActionImpl{ActionImpl:testing.ActionImpl{Namespace:"", Verb:"watch", Resource:schema.GroupVersionResource{Group:"", Version:"v1", Resource:"pods"}, Subresource:""}, WatchRestrictions:testing.WatchRestrictions{Labels:labels.internalSelector(nil), Fields:fields.andTerm{}, ResourceVersion:""}}
2021-12-21 15:36:34 +01:00
Léiyì Zhang
275fdf0884 fixing unit test failures induced by turning on CSIMigrationGCE
disable CSIMigrationGCE in some unit tests
2021-11-16 19:26:30 +00:00
Jan Safranek
bb8157d780 Fix deletion protection unit test
The test should not depend on current set of default feature gates, it
should always ensure the ones necessary for the tests are set.
2021-11-12 10:47:15 +01:00
Deepak Kinni
bfd5f23a0b PV controller changes to support PV Deletion protection finalizer
Signed-off-by: Deepak Kinni <dkinni@vmware.com>
2021-11-08 10:35:58 -08:00
Mike Dame
4960d0976a Wire contexts to Core controllers 2021-11-01 10:29:00 -04:00
Jiawei Wang
8de0f11946 Add GA AnnStorageProvisioner annotation to PVC
This PR adds GA AnnStorageProvisioner annotation to
a PVC if the PVC requires dynamic provisioning. This
also deprecates the beta AnnStorageProvisioner annotation
and it will be removed in a later release.
2021-08-26 12:46:47 -07:00
Kubernetes Prow Robot
5155865ae2
Merge pull request #99326 from sunpa93/fs_resize_fix
fix: use pv annotation to trigger filesystem resize when necessary
2021-03-09 11:05:18 -08:00
Sung Jun Park
5f69cf74d8 fix: when newly binding pvc to a pv, adjust pvc.status.capacity to pv's annotation that denotes the pre-resize capacity of the original pvc that pv was bound to if it has one
test: confirm that pvc's status capacity is adjusted if pv has a pre-resize capacity annotation
2021-03-09 07:55:10 +00:00
Jan Safranek
219cbc818a Refactor CSI migration plugin manager to get featureGates as a parameter
This allows caller to provide fake ones for testing of various corner cases
(migration on A/D controller disabled while enabled on kubelet).
2021-03-08 13:50:01 +01:00
Kubernetes Prow Robot
096819c963
Merge pull request #95909 from pohly/pv-controller-delete-pv-fix
PV controller: don't delete PVs when PVC is not known yet
2020-11-02 02:00:52 -08:00
Patrick Ohly
24f5764787 pv controller test: more test cases
The main goal was to cover retrieval of a PVC from the apiserver when
it isn't known yet. This is achieved by adding PVCs and (for the sake
of completeness) PVs to the reactor, but not the controller, when a
special annotation is set. The approach with a special annotation was
chosen because it doesn't affect other tests.

The other test cases were added while checking the existing tests
because (at least at first glance) the situations seemed to be not
covered.
2020-10-28 10:52:11 +01:00
Patrick Ohly
22f81e9e0b pv controller test: use sub tests
This makes it possible to run individual tests.
2020-10-28 10:39:59 +01:00
knight42
e89e72b637
test: ensure WaitForCacheSync is called after starting sharedInformerFacotry
Signed-off-by: knight42 <anonymousknight96@gmail.com>
2020-09-15 16:02:35 +08:00
Kubernetes Prow Robot
5ce93a2ab5
Merge pull request #93673 from zhouya0/pv_controller_test_add_time_out
Cleanup wait forever loops in pv_controller_test.go
2020-08-28 08:04:17 -07:00
zhouya0
8724a8ea6b Cleanup wait forever loops in pv_controller_test.go 2020-08-04 16:19:32 +08:00
Jordan Liggitt
c4c946d35d Deflake TestControllerSync 2020-08-03 11:56:14 -04:00
Davanum Srinivas
442a69c3bd
switch over k/k to use klog v2
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-05-16 07:54:27 -04:00
Hemant Kumar
d9f7a1f311 Don't call delete for already deleted volumes 2020-02-18 15:59:47 -05:00
David Zhu
b7817a2981 Add annotation annealing for migration for PVs and PVCs during syncVolume and syncClaim. This allows external-provisioners to pick up and delete volumes when they have been rolled up from previous kubernetes versions. 2020-01-27 16:14:53 -08:00
David Zhu
92cb06a2e7 Refactor CSI Translation Library into a struct that is injected into various components to simplify unit testing in future 2019-09-27 12:59:53 -07:00
Dr. Stefan Schimanski
7816ad7991 persistentvolume-controller: fix data race of non-deepcopied objects in fake client 2019-09-02 15:23:55 +02:00
Yi Tang
8c13f9dea3 fix pv controller not find pv for pvc provisioning 2019-07-26 16:24:30 +08:00
xiangqian
9688511595 record provision and deletion latency metric
instead of using provisioner from storage class directly, uses plugin name firstly
2019-05-29 14:15:30 -07:00
Yecheng Fu
2d0d226371 Move all private annotations to shared package and update code 2019-05-05 09:43:43 +08:00
Yecheng Fu
0b6c028c8a Extract testing VolumeReactor into a separate package 2019-05-02 14:45:52 +08:00
Davanum Srinivas
7b8c9acc09
remove unused code
Change-Id: If821920ec8872e326b7d85437ad8d2620807799d
2019-04-19 08:36:31 -04:00
Jordan Liggitt
73dcfe12da Stop checking VolumeScheduling feature gate 2018-12-27 17:45:45 -05:00
Michelle Au
fd64c08240 Fix storage feature gate test setting 2018-11-16 10:49:40 -05:00
Davanum Srinivas
954996e231
Move from glog to klog
- Move from the old github.com/golang/glog to k8s.io/klog
- klog as explicit InitFlags() so we add them as necessary
- we update the other repositories that we vendor that made a similar
change from glog to klog
  * github.com/kubernetes/repo-infra
  * k8s.io/gengo/
  * k8s.io/kube-openapi/
  * github.com/google/cadvisor
- Entirely remove all references to glog
- Fix some tests by explicit InitFlags in their init() methods

Change-Id: I92db545ff36fcec83afe98f550c9e630098b3135
2018-11-10 07:50:31 -05:00
lichuqiang
4c43d626f2 related test update 2018-08-29 10:30:16 +08:00
lichuqiang
446f36559e pv_controller change for provisioning 2018-05-24 17:12:38 +08:00
Michelle Au
58823a75a4 In findMatchingVolumes:
- Delay binding until Pod is scheduled
- Check for PV node affinity and access modes
- Exclude volumes from being matching
2017-11-21 21:42:35 -08:00
Kenneth Owens
5941f7b69f Merge pull request #49016 from jsafrane/pv-controller-no-resync
PV controller: resync informers manually
merging to unblock the submit queue
2017-08-01 16:39:40 -07:00
Jacob Simpson
29c1b81d4c Scripted migration from clientset_generated to client-go. 2017-07-17 15:05:37 -07:00
Jan Safranek
0eface85e4 PV controller: resync informers manually
We want relatively short resync period of PV/PVCs and at the same time we
don't want to force such short resync to all shared informer consumers.
Therefore we need to make our own periodic resync.
2017-07-17 13:39:08 +02:00
Chao Xu
60604f8818 run hack/update-all 2017-06-22 11:31:03 -07:00
Chao Xu
f4989a45a5 run root-rewrite-v1-..., compile 2017-06-22 10:25:57 -07:00
NickrenREN
eca490bbdd Remove claimClass check and upgradeVolumeFrom1_2() function 2017-04-19 19:12:32 +08:00
NickrenREN
e0ef5bfd40 Exit from NewController() for PersistentVolumeController when InitPlugins() failed just like NewAttachDetachController() does 2017-04-12 13:43:09 +08:00
Jan Safranek
52adaa16e0 PV controller: use attributes instead of beta annotations in unit tests 2017-03-02 10:23:56 +01:00
Matthew Wong
33f98d4db3 Switch pv controller to shared informers 2017-02-16 10:08:23 -05:00
deads2k
9488e2ba30 move testing/core to client-go 2017-01-26 13:54:40 -05:00
deads2k
b0b156b381 make tools/cache authoritative 2017-01-25 08:29:45 -05:00
Jan Safranek
0fd5f2028d Add work queues to PV controller
PV controller should not use Controller.Requeue, as as it is not available in
shared informers. We need to implement our own work queues instead where we
can enqueue volumes/claims as we want.
2017-01-02 15:17:24 +01:00
Chao Xu
03d8820edc rename /release_1_5 to /clientset 2016-12-14 12:39:48 -08:00
Chao Xu
7eeb71f698 cmd/kube-controller-manager 2016-11-23 15:53:09 -08:00