From 3fbf9cb451e4b4e1b64ed081381aa824701d1f7b Mon Sep 17 00:00:00 2001 From: Jan Safranek Date: Mon, 3 Apr 2017 15:33:56 +0200 Subject: [PATCH] Fix deletion of Gluster volumes GetClassForVolume should check pv.spec.storageClassName together with beta annotation. --- pkg/volume/util/util.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/volume/util/util.go b/pkg/volume/util/util.go index 035b2f0609a..187ccc98daa 100644 --- a/pkg/volume/util/util.go +++ b/pkg/volume/util/util.go @@ -152,10 +152,9 @@ func GetClassForVolume(kubeClient clientset.Interface, pv *v1.PersistentVolume) if kubeClient == nil { return nil, fmt.Errorf("Cannot get kube client") } - // TODO: replace with a real attribute after beta - className, found := pv.Annotations["volume.beta.kubernetes.io/storage-class"] - if !found { - return nil, fmt.Errorf("Volume has no class annotation") + className := v1.GetPersistentVolumeClass(pv) + if className == "" { + return nil, fmt.Errorf("Volume has no storage class") } class, err := kubeClient.StorageV1beta1().StorageClasses().Get(className, metav1.GetOptions{})