Added NFS to PV structs

This commit is contained in:
markturansky 2015-04-30 12:16:51 -04:00
parent e25210d367
commit 68ce264a6d
7 changed files with 20 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

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