mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Added NFS to PV structs
This commit is contained in:
parent
e25210d367
commit
68ce264a6d
@ -222,6 +222,8 @@ type PersistentVolumeSource struct {
|
||||
HostPath *HostPathVolumeSource `json:"hostPath"`
|
||||
// Glusterfs represents a Glusterfs volume that is attached to a host and exposed to the pod
|
||||
Glusterfs *GlusterfsVolumeSource `json:"glusterfs"`
|
||||
// NFS represents an NFS mount on the host that shares a pod's lifetime
|
||||
NFS *NFSVolumeSource `json:"nfs"`
|
||||
}
|
||||
|
||||
type PersistentVolumeClaimVolumeSource struct {
|
||||
|
@ -1609,6 +1609,9 @@ func init() {
|
||||
if err := s.Convert(&in.Glusterfs, &out.Glusterfs, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.Convert(&in.NFS, &out.NFS, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
},
|
||||
func(in *newer.PersistentVolumeSource, out *PersistentVolumeSource, s conversion.Scope) error {
|
||||
@ -1624,6 +1627,9 @@ func init() {
|
||||
if err := s.Convert(&in.Glusterfs, &out.Glusterfs, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.Convert(&in.NFS, &out.NFS, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
},
|
||||
func(in *PersistentVolumeSpec, out *newer.PersistentVolumeSpec, s conversion.Scope) error {
|
||||
|
@ -247,6 +247,8 @@ type PersistentVolumeSource struct {
|
||||
HostPath *HostPathVolumeSource `json:"hostPath" description:"a HostPath provisioned by a developer or tester; for develment use only"`
|
||||
// Glusterfs represents a Glusterfs volume that is attached to a host and exposed to the pod
|
||||
Glusterfs *GlusterfsVolumeSource `json:"glusterfs" description:"Glusterfs volume resource provisioned by an admin"`
|
||||
// NFS represents an NFS mount on the host
|
||||
NFS *NFSVolumeSource `json:"nfs" description:"NFS volume resource provisioned by an admin"`
|
||||
}
|
||||
|
||||
type PersistentVolume struct {
|
||||
|
@ -145,6 +145,8 @@ type PersistentVolumeSource struct {
|
||||
HostPath *HostPathVolumeSource `json:"hostPath" description:"a HostPath provisioned by a developer or tester; for develment use only"`
|
||||
// Glusterfs represents a Glusterfs volume that is attached to a host and exposed to the pod
|
||||
Glusterfs *GlusterfsVolumeSource `json:"glusterfs" description:"Glusterfs volume resource provisioned by an admin"`
|
||||
// NFS represents an NFS mount on the host
|
||||
NFS *NFSVolumeSource `json:"nfs" description:"NFS volume resource provisioned by an admin"`
|
||||
}
|
||||
|
||||
type PersistentVolumeClaimVolumeSource struct {
|
||||
|
@ -107,6 +107,8 @@ type PersistentVolumeSource struct {
|
||||
HostPath *HostPathVolumeSource `json:"hostPath" description:"a HostPath provisioned by a developer or tester; for develment use only"`
|
||||
// Glusterfs represents a Glusterfs volume that is attached to a host and exposed to the pod
|
||||
Glusterfs *GlusterfsVolumeSource `json:"glusterfs" description:"Glusterfs volume resource provisioned by an admin"`
|
||||
// NFS represents an NFS mount on the host
|
||||
NFS *NFSVolumeSource `json:"nfs" description:"NFS volume resource provisioned by an admin"`
|
||||
}
|
||||
|
||||
type PersistentVolumeClaimVolumeSource struct {
|
||||
|
@ -247,6 +247,8 @@ type PersistentVolumeSource struct {
|
||||
HostPath *HostPathVolumeSource `json:"hostPath" description:"a HostPath provisioned by a developer or tester; for develment use only"`
|
||||
// Glusterfs represents a Glusterfs volume that is attached to a host and exposed to the pod
|
||||
Glusterfs *GlusterfsVolumeSource `json:"glusterfs" description:"Glusterfs volume resource provisioned by an admin"`
|
||||
// NFS represents an NFS mount on the host
|
||||
NFS *NFSVolumeSource `json:"nfs" description:"NFS volume resource provisioned by an admin"`
|
||||
}
|
||||
|
||||
type PersistentVolume struct {
|
||||
|
@ -465,6 +465,10 @@ func ValidatePersistentVolume(pv *api.PersistentVolume) errs.ValidationErrorList
|
||||
numVolumes++
|
||||
allErrs = append(allErrs, validateGlusterfs(pv.Spec.Glusterfs).Prefix("glusterfs")...)
|
||||
}
|
||||
if pv.Spec.NFS != nil {
|
||||
numVolumes++
|
||||
allErrs = append(allErrs, validateNFS(pv.Spec.NFS).Prefix("nfs")...)
|
||||
}
|
||||
if numVolumes != 1 {
|
||||
allErrs = append(allErrs, errs.NewFieldInvalid("", pv.Spec.PersistentVolumeSource, "exactly 1 volume type is required"))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user