Merge pull request #7564 from markturansky/nfs_pv

Added NFS to PV structs
This commit is contained in:
Abhi Shah 2015-05-07 13:51:40 -07:00
commit 42aa4ead7e
8 changed files with 36 additions and 0 deletions

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -2253,6 +2253,14 @@ func convert_v1beta3_PersistentVolumeSource_To_api_PersistentVolumeSource(in *Pe
} else {
out.Glusterfs = nil
}
if in.NFS != nil {
out.NFS = new(newer.NFSVolumeSource)
if err := convert_v1beta3_NFSVolumeSource_To_api_NFSVolumeSource(in.NFS, out.NFS, s); err != nil {
return err
}
} else {
out.NFS = nil
}
return nil
}
@ -2292,6 +2300,14 @@ func convert_api_PersistentVolumeSource_To_v1beta3_PersistentVolumeSource(in *ne
} else {
out.Glusterfs = nil
}
if in.NFS != nil {
out.NFS = new(NFSVolumeSource)
if err := convert_api_NFSVolumeSource_To_v1beta3_NFSVolumeSource(in.NFS, out.NFS, s); err != nil {
return err
}
} else {
out.NFS = nil
}
return nil
}

View File

@ -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 {

View File

@ -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"))
}