From b841b15e27f00e7fabfae22eff2c7948866d5248 Mon Sep 17 00:00:00 2001 From: Yecheng Fu Date: Thu, 12 Jul 2018 14:45:41 +0800 Subject: [PATCH] Invalidate CheckVolumeBinding predicate cache on PV update. --- pkg/scheduler/factory/factory.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/scheduler/factory/factory.go b/pkg/scheduler/factory/factory.go index 8c4f56e4c8b..bbafe8eea5c 100644 --- a/pkg/scheduler/factory/factory.go +++ b/pkg/scheduler/factory/factory.go @@ -404,6 +404,11 @@ func (c *configFactory) onPvUpdate(old, new interface{}) { func (c *configFactory) invalidatePredicatesForPvUpdate(oldPV, newPV *v1.PersistentVolume) { invalidPredicates := sets.NewString() + // CheckVolumeBinding predicate calls SchedulerVolumeBinder.FindPodVolumes + // which will cache PVs in PodBindingCache. When PV got updated, we should + // invalidate cache, otherwise PVAssumeCache.Assume will fail with out of sync + // error. + invalidPredicates.Insert(predicates.CheckVolumeBindingPred) for k, v := range newPV.Labels { // If PV update modifies the zone/region labels. if isZoneRegionLabel(k) && !reflect.DeepEqual(v, oldPV.Labels[k]) {