Просмотр исходного кода

Support spec.capacity.store in InstanceIDField for CSV Provider

scott.arnold 5 лет назад
Родитель
Сommit
67e0a69fb6
1 измененных файлов с 8 добавлено и 0 удалено
  1. 8 0
      pkg/cloud/csvprovider.go

+ 8 - 0
pkg/cloud/csvprovider.go

@@ -278,6 +278,14 @@ func PVValueFromMapField(m string, n *v1.PersistentVolume) string {
 			klog.V(4).Infof("[ERROR] Unsupported InstanceIDField %s in CSV For PV", m)
 			return ""
 		}
+	} else if len(mf) > 2 && mf[0] == "spec" {
+		if mf[1] == "capacity" && mf[2] == "storage" {
+			skey := n.Spec.Capacity["Storage"]
+			return skey.String()
+		} else {
+			klog.V(4).Infof("[ERROR] Unsupported InstanceIDField %s in CSV For PV", m)
+			return ""
+		}
 	} else {
 		klog.V(4).Infof("[ERROR] Unsupported InstanceIDField %s in CSV For PV", m)
 		return ""