mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Fix deletion of Gluster volumes
GetClassForVolume should check pv.spec.storageClassName together with beta annotation.
This commit is contained in:
parent
70684584be
commit
3fbf9cb451
@ -152,10 +152,9 @@ func GetClassForVolume(kubeClient clientset.Interface, pv *v1.PersistentVolume)
|
|||||||
if kubeClient == nil {
|
if kubeClient == nil {
|
||||||
return nil, fmt.Errorf("Cannot get kube client")
|
return nil, fmt.Errorf("Cannot get kube client")
|
||||||
}
|
}
|
||||||
// TODO: replace with a real attribute after beta
|
className := v1.GetPersistentVolumeClass(pv)
|
||||||
className, found := pv.Annotations["volume.beta.kubernetes.io/storage-class"]
|
if className == "" {
|
||||||
if !found {
|
return nil, fmt.Errorf("Volume has no storage class")
|
||||||
return nil, fmt.Errorf("Volume has no class annotation")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class, err := kubeClient.StorageV1beta1().StorageClasses().Get(className, metav1.GetOptions{})
|
class, err := kubeClient.StorageV1beta1().StorageClasses().Get(className, metav1.GetOptions{})
|
||||||
|
Loading…
Reference in New Issue
Block a user