NFSMount storage plugin for kubelet.
* If you want to test this out when an actual NFS export a good place to start is by running the NFS server in a container: docker run -d --name nfs --privileged cpuguy83/nfs-server /tmp More detail can be found here: https://github.com/cpuguy83/docker-nfs-server
This commit is contained in:
@@ -18,6 +18,7 @@ package validation
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||
@@ -290,6 +291,10 @@ func validateSource(source *api.VolumeSource) errs.ValidationErrorList {
|
||||
numVolumes++
|
||||
allErrs = append(allErrs, validateSecretVolumeSource(source.Secret).Prefix("secret")...)
|
||||
}
|
||||
if source.NFS != nil {
|
||||
numVolumes++
|
||||
allErrs = append(allErrs, validateNFS(source.NFS).Prefix("nfs")...)
|
||||
}
|
||||
if numVolumes != 1 {
|
||||
allErrs = append(allErrs, errs.NewFieldInvalid("", source, "exactly 1 volume type is required"))
|
||||
}
|
||||
@@ -340,6 +345,20 @@ func validateSecretVolumeSource(secretSource *api.SecretVolumeSource) errs.Valid
|
||||
return allErrs
|
||||
}
|
||||
|
||||
func validateNFS(nfs *api.NFSVolumeSource) errs.ValidationErrorList {
|
||||
allErrs := errs.ValidationErrorList{}
|
||||
if nfs.Server == "" {
|
||||
allErrs = append(allErrs, errs.NewFieldRequired("server"))
|
||||
}
|
||||
if nfs.Path == "" {
|
||||
allErrs = append(allErrs, errs.NewFieldRequired("path"))
|
||||
}
|
||||
if !path.IsAbs(nfs.Path) {
|
||||
allErrs = append(allErrs, errs.NewFieldInvalid("path", nfs.Path, "must be an absolute path"))
|
||||
}
|
||||
return allErrs
|
||||
}
|
||||
|
||||
var supportedPortProtocols = util.NewStringSet(string(api.ProtocolTCP), string(api.ProtocolUDP))
|
||||
|
||||
func validatePorts(ports []api.ContainerPort) errs.ValidationErrorList {
|
||||
|
Reference in New Issue
Block a user