kubernetes/pkg/controller/volume/persistentvolume
Patrick Ohly 5686664a1d PV controller: don't delete PVs when PVC is not known yet
Normally, the PV controller knows about the PVC that triggers the
creation of a PV before it sees the PV, because the PV controller must
set the volume.beta.kubernetes.io/storage-provisioner annotation that
tells an external provisioner to create the PV.

When restarting, the PV controller first syncs its caches, so that
case is also covered.

However, the creator of a PVC might decided to set that annotation
itself to speed up volume creation. While unusual, it's not forbidden
and thus part of the external Kubernetes API. Whether it makes sense
depends on the intentions of the user.

When that is done and there is heavy load, an external provisioner
might see the PVC and create a PV before the PV controller sees the
PVC. If the PV controller then encounters the PV before the PVC, it
incorrectly concludes that the PV needs to be deleted instead of being
bound.

The same issue occurred earlier for external binding and the existing
code for looking up a PVC in the cache or in the apiserver solves the
issue also for volume provisioning, it just needs to be enabled also
for PVs without the pv.kubernetes.io/bound-by-controller annotation.
2020-10-27 11:26:58 +01:00
..
config Autogenerated code 2019-10-24 20:21:00 +02:00
metrics Deal with auto-generated files. 2019-11-07 10:30:12 +08:00
options Fix golint issues in pkg/controller/volume/persistentvolume/options 2019-11-04 21:45:21 +01:00
testing Run hack/update-vendor.sh 2020-05-16 07:54:33 -04:00
util Promote block volume features to GA 2020-02-28 20:48:38 +01:00
binder_test.go Promote block volume features to GA 2020-02-28 20:48:38 +01:00
BUILD auto-generated files 2020-06-03 14:51:21 +08:00
delete_test.go Move all private annotations to shared package and update code 2019-05-05 09:43:43 +08:00
framework_test.go emit correct event when unbound delay binding claim is used by pod 2020-05-29 19:36:13 +08:00
index.go Refactor PV scheduling library into separate package 2019-05-02 14:45:52 +08:00
index_test.go Promote block volume features to GA 2020-02-28 20:48:38 +01:00
OWNERS Create OWNERS in volume scheduling package 2019-05-04 16:46:12 +08:00
provision_test.go 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
pv_controller.go PV controller: don't delete PVs when PVC is not known yet 2020-10-27 11:26:58 +01:00
pv_controller_base.go GenericEphemeralVolume: initial implementation 2020-07-09 23:29:24 +02:00
pv_controller_test.go Merge pull request #93673 from zhouya0/pv_controller_test_add_time_out 2020-08-28 08:04:17 -07:00
recycle_test.go fix some typos in recycle_test.go 2019-08-15 11:34:46 +08:00
volume_host.go switch over k/k to use klog v2 2020-05-16 07:54:27 -04:00