mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-14 06:13:19 +00:00
Regenerate everything
Kubernetes-commit: 9487552e4171562a56b3a45ee2de7aa0e5ee9f9d
This commit is contained in:
committed by
Kubernetes Publisher
parent
f2dbd57c78
commit
7eb14114aa
@@ -557,3 +557,42 @@ func PodAnnotationsFromSysctls(sysctls []Sysctl) string {
|
|||||||
}
|
}
|
||||||
return strings.Join(kvs, ",")
|
return strings.Join(kvs, ",")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetPersistentVolumeClass returns StorageClassName.
|
||||||
|
func GetPersistentVolumeClass(volume *PersistentVolume) string {
|
||||||
|
// Use beta annotation first
|
||||||
|
if class, found := volume.Annotations[BetaStorageClassAnnotation]; found {
|
||||||
|
return class
|
||||||
|
}
|
||||||
|
|
||||||
|
return volume.Spec.StorageClassName
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetPersistentVolumeClaimClass returns StorageClassName. If no storage class was
|
||||||
|
// requested, it returns "".
|
||||||
|
func GetPersistentVolumeClaimClass(claim *PersistentVolumeClaim) string {
|
||||||
|
// Use beta annotation first
|
||||||
|
if class, found := claim.Annotations[BetaStorageClassAnnotation]; found {
|
||||||
|
return class
|
||||||
|
}
|
||||||
|
|
||||||
|
if claim.Spec.StorageClassName != nil {
|
||||||
|
return *claim.Spec.StorageClassName
|
||||||
|
}
|
||||||
|
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
// PersistentVolumeClaimHasClass returns true if given claim has set StorageClassName field.
|
||||||
|
func PersistentVolumeClaimHasClass(claim *PersistentVolumeClaim) bool {
|
||||||
|
// Use beta annotation first
|
||||||
|
if _, found := claim.Annotations[BetaStorageClassAnnotation]; found {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
if claim.Spec.StorageClassName != nil {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
@@ -375,6 +375,12 @@ type PersistentVolumeClaimVolumeSource struct {
|
|||||||
ReadOnly bool
|
ReadOnly bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
// BetaStorageClassAnnotation represents the beta/previous StorageClass annotation.
|
||||||
|
// It's currently still used and will be held for backwards compatibility
|
||||||
|
BetaStorageClassAnnotation = "volume.beta.kubernetes.io/storage-class"
|
||||||
|
)
|
||||||
|
|
||||||
// +genclient=true
|
// +genclient=true
|
||||||
// +nonNamespaced=true
|
// +nonNamespaced=true
|
||||||
|
|
||||||
|
@@ -591,3 +591,42 @@ func GetAffinityFromPodAnnotations(annotations map[string]string) (*Affinity, er
|
|||||||
}
|
}
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetPersistentVolumeClass returns StorageClassName.
|
||||||
|
func GetPersistentVolumeClass(volume *PersistentVolume) string {
|
||||||
|
// Use beta annotation first
|
||||||
|
if class, found := volume.Annotations[BetaStorageClassAnnotation]; found {
|
||||||
|
return class
|
||||||
|
}
|
||||||
|
|
||||||
|
return volume.Spec.StorageClassName
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetPersistentVolumeClaimClass returns StorageClassName. If no storage class was
|
||||||
|
// requested, it returns "".
|
||||||
|
func GetPersistentVolumeClaimClass(claim *PersistentVolumeClaim) string {
|
||||||
|
// Use beta annotation first
|
||||||
|
if class, found := claim.Annotations[BetaStorageClassAnnotation]; found {
|
||||||
|
return class
|
||||||
|
}
|
||||||
|
|
||||||
|
if claim.Spec.StorageClassName != nil {
|
||||||
|
return *claim.Spec.StorageClassName
|
||||||
|
}
|
||||||
|
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
// PersistentVolumeClaimHasClass returns true if given claim has set StorageClassName field.
|
||||||
|
func PersistentVolumeClaimHasClass(claim *PersistentVolumeClaim) bool {
|
||||||
|
// Use beta annotation first
|
||||||
|
if _, found := claim.Annotations[BetaStorageClassAnnotation]; found {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
if claim.Spec.StorageClassName != nil {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
@@ -421,6 +421,17 @@ type PersistentVolumeSource struct {
|
|||||||
PortworxVolume *PortworxVolumeSource `json:"portworxVolume,omitempty" protobuf:"bytes,18,opt,name=portworxVolume"`
|
PortworxVolume *PortworxVolumeSource `json:"portworxVolume,omitempty" protobuf:"bytes,18,opt,name=portworxVolume"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
// AlphaStorageClassAnnotation represents the previous alpha storage class
|
||||||
|
// annotation. It's currently still used and will be held for backwards
|
||||||
|
// compatibility
|
||||||
|
AlphaStorageClassAnnotation = "volume.alpha.kubernetes.io/storage-class"
|
||||||
|
|
||||||
|
// BetaStorageClassAnnotation represents the beta/previous StorageClass annotation.
|
||||||
|
// It's currently still used and will be held for backwards compatibility
|
||||||
|
BetaStorageClassAnnotation = "volume.beta.kubernetes.io/storage-class"
|
||||||
|
)
|
||||||
|
|
||||||
// +genclient=true
|
// +genclient=true
|
||||||
// +nonNamespaced=true
|
// +nonNamespaced=true
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user