Remove PV annotations for quobyte provisioner

This commit is contained in:
Jan Safranek
2016-10-24 15:22:46 +02:00
parent cc84673ebe
commit 472c2d6e8c
2 changed files with 57 additions and 95 deletions

View File

@@ -147,36 +147,6 @@ func GetSecretForPV(secretNamespace, secretName, volumePluginName string, kubeCl
return secret, nil
}
// AddVolumeAnnotations adds a golang Map as annotation to a PersistentVolume
func AddVolumeAnnotations(pv *api.PersistentVolume, annotations map[string]string) {
if pv.Annotations == nil {
pv.Annotations = map[string]string{}
}
for k, v := range annotations {
pv.Annotations[k] = v
}
}
// ParseVolumeAnnotations reads the defined annoations from a PersistentVolume
func ParseVolumeAnnotations(pv *api.PersistentVolume, parseAnnotations []string) (map[string]string, error) {
result := map[string]string{}
if pv.Annotations == nil {
return result, fmt.Errorf("cannot parse volume annotations: no annotations found")
}
for _, annotation := range parseAnnotations {
if val, ok := pv.Annotations[annotation]; ok {
result[annotation] = val
} else {
return result, fmt.Errorf("cannot parse volume annotations: annotation %s not found", annotation)
}
}
return result, nil
}
func GetClassForVolume(kubeClient clientset.Interface, pv *api.PersistentVolume) (*storage.StorageClass, error) {
// TODO: replace with a real attribute after beta
className, found := pv.Annotations["volume.beta.kubernetes.io/storage-class"]