mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-02 19:28:16 +00:00
Adding default StorageClass annotation printout for resource_printer
This commit is contained in:
@@ -34,6 +34,7 @@ import (
|
||||
"k8s.io/kubernetes/pkg/api/testapi"
|
||||
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||
"k8s.io/kubernetes/pkg/apis/storage"
|
||||
storageutil "k8s.io/kubernetes/pkg/apis/storage/util"
|
||||
"k8s.io/kubernetes/pkg/client/cache"
|
||||
clientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
|
||||
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake"
|
||||
@@ -650,7 +651,7 @@ func newVolume(name, capacity, boundToClaimUID, boundToClaimName string, phase a
|
||||
switch a {
|
||||
case annDynamicallyProvisioned:
|
||||
volume.Annotations[a] = mockPluginName
|
||||
case annClass:
|
||||
case storageutil.StorageClassAnnotation:
|
||||
volume.Annotations[a] = "gold"
|
||||
default:
|
||||
volume.Annotations[a] = "yes"
|
||||
@@ -699,13 +700,13 @@ func withMessage(message string, volumes []*api.PersistentVolume) []*api.Persist
|
||||
return volumes
|
||||
}
|
||||
|
||||
// volumeWithClass saves given class into annClass annotation.
|
||||
// volumeWithClass saves given class into storage.StorageClassAnnotation annotation.
|
||||
// Meant to be used to compose claims specified inline in a test.
|
||||
func volumeWithClass(className string, volumes []*api.PersistentVolume) []*api.PersistentVolume {
|
||||
if volumes[0].Annotations == nil {
|
||||
volumes[0].Annotations = map[string]string{annClass: className}
|
||||
volumes[0].Annotations = map[string]string{storageutil.StorageClassAnnotation: className}
|
||||
} else {
|
||||
volumes[0].Annotations[annClass] = className
|
||||
volumes[0].Annotations[storageutil.StorageClassAnnotation] = className
|
||||
}
|
||||
return volumes
|
||||
}
|
||||
@@ -747,7 +748,7 @@ func newClaim(name, claimUID, capacity, boundToVolume string, phase api.Persiste
|
||||
claim.Annotations = make(map[string]string)
|
||||
for _, a := range annotations {
|
||||
switch a {
|
||||
case annClass:
|
||||
case storageutil.StorageClassAnnotation:
|
||||
claim.Annotations[a] = "gold"
|
||||
default:
|
||||
claim.Annotations[a] = "yes"
|
||||
@@ -774,13 +775,13 @@ func newClaimArray(name, claimUID, capacity, boundToVolume string, phase api.Per
|
||||
}
|
||||
}
|
||||
|
||||
// claimWithClass saves given class into annClass annotation.
|
||||
// claimWithClass saves given class into storage.StorageClassAnnotation annotation.
|
||||
// Meant to be used to compose claims specified inline in a test.
|
||||
func claimWithClass(className string, claims []*api.PersistentVolumeClaim) []*api.PersistentVolumeClaim {
|
||||
if claims[0].Annotations == nil {
|
||||
claims[0].Annotations = map[string]string{annClass: className}
|
||||
claims[0].Annotations = map[string]string{storageutil.StorageClassAnnotation: className}
|
||||
} else {
|
||||
claims[0].Annotations[annClass] = className
|
||||
claims[0].Annotations[storageutil.StorageClassAnnotation] = className
|
||||
}
|
||||
return claims
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user