pb-2151: Added check to make sure zone array is not empty in preparePVCResourceForApply
@@ -83,12 +83,17 @@ func (r *ResourceCollector) preparePVCResourceForApply(
if vol.PersistentVolumeClaim == pvc.Name {
for _, node := range nodes.Items {
nodeZone := node.Labels[v1.LabelTopologyZone]
+ if len(vol.Zones) != 0 {
if nodeZone == vol.Zones[0] {
+ if pvc.Annotations == nil {
+ pvc.Annotations = make(map[string]string)
+ }
pvc.Annotations[pvutil.AnnSelectedNode] = node.Name
break
}
}
}
+ }
}
