Make sure the volume name is not empty when the PVC is bound

Current logic to check whether a PVC is fully bound are:
1. PVC's volume name is not empty
2. Annotation "pv.kubernetes.io/bind-completed" is properly set

The behavior in the test case only set the annotation, and leave the
volume name to be set by a `FakePVController`.

This will cause a problem for us to run some testcase like scheduler's
perf test, scheduling pod with volume as an example, the first try will
always hit "unbound immediate PersistentVolumeClaims" exception.

As a result, the metric data "schedule_attempts_total", or "scheduling_algorithm_duration_seconds"
will not accurate enough.

Signed-off-by: Dave Chen <dave.chen@arm.com>
This commit is contained in:
Dave Chen 2020-12-11 16:57:51 +08:00
parent 873e928bea
commit b9d9a5ebed

View File

@ -1369,6 +1369,7 @@ func CreatePodWithPersistentVolume(client clientset.Interface, namespace string,
pv.Status.Phase = v1.VolumeBound pv.Status.Phase = v1.VolumeBound
// bind pvc to "pv-$i" // bind pvc to "pv-$i"
pvc.Spec.VolumeName = pv.Name
pvc.Status.Phase = v1.ClaimBound pvc.Status.Phase = v1.ClaimBound
} else { } else {
pv.Status.Phase = v1.VolumeAvailable pv.Status.Phase = v1.VolumeAvailable