diff --git a/pkg/api/types.go b/pkg/api/types.go index c172ca4e8fc..ed4f75bf133 100644 --- a/pkg/api/types.go +++ b/pkg/api/types.go @@ -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 { diff --git a/pkg/api/v1/conversion.go b/pkg/api/v1/conversion.go index a5aa0665569..032c5300786 100644 --- a/pkg/api/v1/conversion.go +++ b/pkg/api/v1/conversion.go @@ -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 { diff --git a/pkg/api/v1/types.go b/pkg/api/v1/types.go index ae1c424449f..baa8b431653 100644 --- a/pkg/api/v1/types.go +++ b/pkg/api/v1/types.go @@ -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 { diff --git a/pkg/api/v1beta1/types.go b/pkg/api/v1beta1/types.go index 951a2f92d73..de8ada33a15 100644 --- a/pkg/api/v1beta1/types.go +++ b/pkg/api/v1beta1/types.go @@ -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 { diff --git a/pkg/api/v1beta2/types.go b/pkg/api/v1beta2/types.go index a1b3d0d31aa..6275b6784f2 100644 --- a/pkg/api/v1beta2/types.go +++ b/pkg/api/v1beta2/types.go @@ -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 { diff --git a/pkg/api/v1beta3/types.go b/pkg/api/v1beta3/types.go index b0ff3fd8647..4482931d485 100644 --- a/pkg/api/v1beta3/types.go +++ b/pkg/api/v1beta3/types.go @@ -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 { diff --git a/pkg/api/validation/validation.go b/pkg/api/validation/validation.go index 1dff82c7646..2889a91f6c6 100644 --- a/pkg/api/validation/validation.go +++ b/pkg/api/validation/validation.go @@ -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")) }