Check kube client is valid

This commit is contained in:
Harry Zhang
2016-12-20 17:06:35 +08:00
parent 2bd077df6d
commit 443ae87b7e
2 changed files with 24 additions and 5 deletions

View File

@@ -149,6 +149,9 @@ func GetSecretForPV(secretNamespace, secretName, volumePluginName string, kubeCl
}
func GetClassForVolume(kubeClient clientset.Interface, pv *v1.PersistentVolume) (*storage.StorageClass, error) {
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 {