@@ -40,24 +40,28 @@ RECLAIM POLICY : {{.ReclaimPolicy}}
40
40
`
41
41
)
42
42
43
- // GetLocalHostpath returns a list of local -hostpath columes
43
+ // GetLocalHostpath returns a list of localpv -hostpath columes
44
44
func GetLocalHostpath (c * client.K8sClient , pvList * corev1.PersistentVolumeList , openebsNS string ) ([]metav1.TableRow , error ) {
45
45
var rows []metav1.TableRow
46
46
for _ , pv := range pvList .Items {
47
47
// Ignore all the other volumes that is not of cas-type local-hostpath
48
- if util .GetCasTypeFromPV (& pv ) != util .LocalHostpathCasType {
48
+ // dynamic-local-provisioner has this label for PVs openebs.io/cas-type=local-hostpath
49
+ // this might be fixed later
50
+ if util .GetCasTypeFromPV (& pv ) != util .LocalHostpathCasLabel {
49
51
continue
50
52
}
51
-
52
53
name := pv .Name
53
54
capacity := pv .Spec .Capacity .Storage ()
54
55
sc := pv .Spec .StorageClassName
55
56
attached := pv .Status .Phase
56
- attachedNode , customStatus , ns , storageVersion := pv .Labels ["nodeID" ], "N/A" , "N/A" , "N/A"
57
-
58
- deployment , err := c .GetDeploymentList ("openebs.io/component-name=openebs-localpv-provisioner" )
59
- if err == nil {
60
- storageVersion = deployment .Items [0 ].Labels ["openebs.io/version" ]
57
+ attachedNode := pv .Spec .NodeAffinity .Required .NodeSelectorTerms [0 ].MatchExpressions [0 ].Values [0 ]
58
+ var storageVersion , ns , customStatus string
59
+ deploy , err := c .GetDeploymentList ("openebs.io/component-name=openebs-localpv-provisioner" )
60
+ if err == nil && len (deploy .Items ) == 1 {
61
+ storageVersion = deploy .Items [0 ].Labels ["openebs.io/version" ]
62
+ ns = deploy .Items [0 ].Namespace
63
+ } else {
64
+ storageVersion = "N/A"
61
65
}
62
66
63
67
accessMode := pv .Spec .AccessModes [0 ]
@@ -70,8 +74,8 @@ func GetLocalHostpath(c *client.K8sClient, pvList *corev1.PersistentVolumeList,
70
74
return rows , nil
71
75
}
72
76
73
- // DescribeLocalHostpathVolume describes a local -hostpath PersistentVolume
74
- func DescribeLocalHostpathVolume (c * client.K8sClient , vol * corev1.PersistentVolume ) error {
77
+ // DescribeLocalHostpathVolume describes a localpv -hostpath PersistentVolume
78
+ func DescribeLocalHostpathVolume (_ * client.K8sClient , vol * corev1.PersistentVolume ) error {
75
79
// Get Local-volume Information
76
80
localHostpathVolInfo := util.LocalHostPathVolInfo {
77
81
VolumeInfo : util.VolumeInfo {
@@ -85,7 +89,7 @@ func DescribeLocalHostpathVolume(c *client.K8sClient, vol *corev1.PersistentVolu
85
89
},
86
90
Path : vol .Spec .PersistentVolumeSource .Local .Path ,
87
91
ReclaimPolicy : string (vol .Spec .PersistentVolumeReclaimPolicy ),
88
- CasType : util .LocalHostpathCasType ,
92
+ CasType : util .LocalPvHostpathCasType ,
89
93
}
90
94
91
95
// Print the Volume information
0 commit comments