mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 15:05:27 +00:00
Add MountOptions field to PV spec
This commit is contained in:
parent
b8fde17fc2
commit
0855f6a089
@ -455,6 +455,10 @@ type PersistentVolumeSpec struct {
|
||||
// means that this volume does not belong to any StorageClass.
|
||||
// +optional
|
||||
StorageClassName string
|
||||
// A list of mount options, e.g. ["ro", "soft"]. Not validated - mount will
|
||||
// simply fail if one is invalid.
|
||||
// +optional
|
||||
MountOptions []string
|
||||
}
|
||||
|
||||
// PersistentVolumeReclaimPolicy describes a policy for end-of-life maintenance of persistent volumes
|
||||
|
@ -389,12 +389,17 @@ func MountOptionFromSpec(spec *Spec, options ...string) []string {
|
||||
pv := spec.PersistentVolume
|
||||
|
||||
if pv != nil {
|
||||
// Use beta annotation first
|
||||
if mo, ok := pv.Annotations[v1.MountOptionAnnotation]; ok {
|
||||
moList := strings.Split(mo, ",")
|
||||
return JoinMountOptions(moList, options)
|
||||
}
|
||||
|
||||
if len(pv.Spec.MountOptions) > 0 {
|
||||
return JoinMountOptions(pv.Spec.MountOptions, options)
|
||||
}
|
||||
}
|
||||
|
||||
return options
|
||||
}
|
||||
|
||||
|
@ -519,6 +519,11 @@ type PersistentVolumeSpec struct {
|
||||
// means that this volume does not belong to any StorageClass.
|
||||
// +optional
|
||||
StorageClassName string `json:"storageClassName,omitempty" protobuf:"bytes,6,opt,name=storageClassName"`
|
||||
// A list of mount options, e.g. ["ro", "soft"]. Not validated - mount will
|
||||
// simply fail if one is invalid.
|
||||
// More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#mount-options
|
||||
// +optional
|
||||
MountOptions []string `json:"mountOptions,omitempty" protobuf:"bytes,7,opt,name=mountOptions"`
|
||||
}
|
||||
|
||||
// PersistentVolumeReclaimPolicy describes a policy for end-of-life maintenance of persistent volumes.
|
||||
|
Loading…
Reference in New Issue
Block a user