Directory renamed to Dir to match json property
This commit is contained in:
@@ -85,22 +85,22 @@ type Volume struct {
|
||||
|
||||
type VolumeSource struct {
|
||||
// Only one of the following sources may be specified
|
||||
// HostDirectory represents a pre-existing directory on the host machine that is directly
|
||||
// HostDir represents a pre-existing directory on the host machine that is directly
|
||||
// exposed to the container. This is generally used for system agents or other privileged
|
||||
// things that are allowed to see the host machine. Most containers will NOT need this.
|
||||
// TODO(jonesdl) We need to restrict who can use host directory mounts and
|
||||
// who can/can not mount host directories as read/write.
|
||||
HostDirectory *HostDirectory `yaml:"hostDir" json:"hostDir"`
|
||||
// EmptyDirectory represents a temporary directory that shares a pod's lifetime.
|
||||
EmptyDirectory *EmptyDirectory `yaml:"emptyDir" json:"emptyDir"`
|
||||
HostDir *HostDir `yaml:"hostDir" json:"hostDir"`
|
||||
// EmptyDir represents a temporary directory that shares a pod's lifetime.
|
||||
EmptyDir *EmptyDir `yaml:"emptyDir" json:"emptyDir"`
|
||||
}
|
||||
|
||||
// HostDirectory represents bare host directory volume.
|
||||
type HostDirectory struct {
|
||||
// HostDir represents bare host directory volume.
|
||||
type HostDir struct {
|
||||
Path string `yaml:"path" json:"path"`
|
||||
}
|
||||
|
||||
type EmptyDirectory struct{}
|
||||
type EmptyDir struct{}
|
||||
|
||||
// Protocol defines network protocols supported for things like conatiner ports.
|
||||
type Protocol string
|
||||
|
@@ -83,22 +83,22 @@ type Volume struct {
|
||||
|
||||
type VolumeSource struct {
|
||||
// Only one of the following sources may be specified
|
||||
// HostDirectory represents a pre-existing directory on the host machine that is directly
|
||||
// HostDir represents a pre-existing directory on the host machine that is directly
|
||||
// exposed to the container. This is generally used for system agents or other privileged
|
||||
// things that are allowed to see the host machine. Most containers will NOT need this.
|
||||
// TODO(jonesdl) We need to restrict who can use host directory mounts and
|
||||
// who can/can not mount host directories as read/write.
|
||||
HostDirectory *HostDirectory `yaml:"hostDir" json:"hostDir"`
|
||||
// EmptyDirectory represents a temporary directory that shares a pod's lifetime.
|
||||
EmptyDirectory *EmptyDirectory `yaml:"emptyDir" json:"emptyDir"`
|
||||
HostDir *HostDir `yaml:"hostDir" json:"hostDir"`
|
||||
// EmptyDir represents a temporary directory that shares a pod's lifetime.
|
||||
EmptyDir *EmptyDir `yaml:"emptyDir" json:"emptyDir"`
|
||||
}
|
||||
|
||||
// HostDirectory represents bare host directory volume.
|
||||
type HostDirectory struct {
|
||||
// HostDir represents bare host directory volume.
|
||||
type HostDir struct {
|
||||
Path string `yaml:"path" json:"path"`
|
||||
}
|
||||
|
||||
type EmptyDirectory struct{}
|
||||
type EmptyDir struct{}
|
||||
|
||||
// Protocol defines network protocols supported for things like conatiner ports.
|
||||
type Protocol string
|
||||
|
@@ -83,22 +83,22 @@ type Volume struct {
|
||||
|
||||
type VolumeSource struct {
|
||||
// Only one of the following sources may be specified
|
||||
// HostDirectory represents a pre-existing directory on the host machine that is directly
|
||||
// HostDir represents a pre-existing directory on the host machine that is directly
|
||||
// exposed to the container. This is generally used for system agents or other privileged
|
||||
// things that are allowed to see the host machine. Most containers will NOT need this.
|
||||
// TODO(jonesdl) We need to restrict who can use host directory mounts and
|
||||
// who can/can not mount host directories as read/write.
|
||||
HostDirectory *HostDirectory `yaml:"hostDir" json:"hostDir"`
|
||||
// EmptyDirectory represents a temporary directory that shares a pod's lifetime.
|
||||
EmptyDirectory *EmptyDirectory `yaml:"emptyDir" json:"emptyDir"`
|
||||
HostDir *HostDir `yaml:"hostDir" json:"hostDir"`
|
||||
// EmptyDir represents a temporary directory that shares a pod's lifetime.
|
||||
EmptyDir *EmptyDir `yaml:"emptyDir" json:"emptyDir"`
|
||||
}
|
||||
|
||||
// HostDirectory represents bare host directory volume.
|
||||
type HostDirectory struct {
|
||||
// HostDir represents bare host directory volume.
|
||||
type HostDir struct {
|
||||
Path string `yaml:"path" json:"path"`
|
||||
}
|
||||
|
||||
type EmptyDirectory struct{}
|
||||
type EmptyDir struct{}
|
||||
|
||||
// Protocol defines network protocols supported for things like conatiner ports.
|
||||
type Protocol string
|
||||
|
@@ -126,22 +126,22 @@ type Volume struct {
|
||||
|
||||
type VolumeSource struct {
|
||||
// Only one of the following sources may be specified
|
||||
// HostDirectory represents a pre-existing directory on the host machine that is directly
|
||||
// HostDir represents a pre-existing directory on the host machine that is directly
|
||||
// exposed to the container. This is generally used for system agents or other privileged
|
||||
// things that are allowed to see the host machine. Most containers will NOT need this.
|
||||
// TODO(jonesdl) We need to restrict who can use host directory mounts and who can/can not
|
||||
// mount host directories as read/write.
|
||||
HostDirectory *HostDirectory `json:"hostDir" yaml:"hostDir"`
|
||||
// EmptyDirectory represents a temporary directory that shares a pod's lifetime.
|
||||
EmptyDirectory *EmptyDirectory `json:"emptyDir" yaml:"emptyDir"`
|
||||
HostDir *HostDir `json:"hostDir" yaml:"hostDir"`
|
||||
// EmptyDir represents a temporary directory that shares a pod's lifetime.
|
||||
EmptyDir *EmptyDir `json:"emptyDir" yaml:"emptyDir"`
|
||||
}
|
||||
|
||||
// HostDirectory represents bare host directory volume.
|
||||
type HostDirectory struct {
|
||||
// HostDir represents bare host directory volume.
|
||||
type HostDir struct {
|
||||
Path string `json:"path" yaml:"path"`
|
||||
}
|
||||
|
||||
type EmptyDirectory struct{}
|
||||
type EmptyDir struct{}
|
||||
|
||||
// Protocol defines network protocols supported for things like conatiner ports.
|
||||
type Protocol string
|
||||
|
@@ -56,11 +56,11 @@ func validateVolumes(volumes []api.Volume) (util.StringSet, errs.ErrorList) {
|
||||
func validateSource(source *api.VolumeSource) errs.ErrorList {
|
||||
numVolumes := 0
|
||||
allErrs := errs.ErrorList{}
|
||||
if source.HostDirectory != nil {
|
||||
if source.HostDir != nil {
|
||||
numVolumes++
|
||||
allErrs = append(allErrs, validateHostDir(source.HostDirectory).Prefix("hostDirectory")...)
|
||||
allErrs = append(allErrs, validateHostDir(source.HostDir).Prefix("hostDirectory")...)
|
||||
}
|
||||
if source.EmptyDirectory != nil {
|
||||
if source.EmptyDir != nil {
|
||||
numVolumes++
|
||||
//EmptyDirs have nothing to validate
|
||||
}
|
||||
@@ -70,7 +70,7 @@ func validateSource(source *api.VolumeSource) errs.ErrorList {
|
||||
return allErrs
|
||||
}
|
||||
|
||||
func validateHostDir(hostDir *api.HostDirectory) errs.ErrorList {
|
||||
func validateHostDir(hostDir *api.HostDir) errs.ErrorList {
|
||||
allErrs := errs.ErrorList{}
|
||||
if hostDir.Path == "" {
|
||||
allErrs = append(allErrs, errs.NewNotFound("path", hostDir.Path))
|
||||
|
@@ -37,9 +37,9 @@ func expectPrefix(t *testing.T, prefix string, errs errors.ErrorList) {
|
||||
func TestValidateVolumes(t *testing.T) {
|
||||
successCase := []api.Volume{
|
||||
{Name: "abc"},
|
||||
{Name: "123", Source: &api.VolumeSource{HostDirectory: &api.HostDirectory{"/mnt/path2"}}},
|
||||
{Name: "abc-123", Source: &api.VolumeSource{HostDirectory: &api.HostDirectory{"/mnt/path3"}}},
|
||||
{Name: "empty", Source: &api.VolumeSource{EmptyDirectory: &api.EmptyDirectory{}}},
|
||||
{Name: "123", Source: &api.VolumeSource{HostDir: &api.HostDir{"/mnt/path2"}}},
|
||||
{Name: "abc-123", Source: &api.VolumeSource{HostDir: &api.HostDir{"/mnt/path3"}}},
|
||||
{Name: "empty", Source: &api.VolumeSource{EmptyDir: &api.EmptyDir{}}},
|
||||
}
|
||||
names, errs := validateVolumes(successCase)
|
||||
if len(errs) != 0 {
|
||||
@@ -309,8 +309,8 @@ func TestValidateManifest(t *testing.T) {
|
||||
{
|
||||
Version: "v1beta1",
|
||||
ID: "abc",
|
||||
Volumes: []api.Volume{{Name: "vol1", Source: &api.VolumeSource{HostDirectory: &api.HostDirectory{"/mnt/vol1"}}},
|
||||
{Name: "vol2", Source: &api.VolumeSource{HostDirectory: &api.HostDirectory{"/mnt/vol2"}}}},
|
||||
Volumes: []api.Volume{{Name: "vol1", Source: &api.VolumeSource{HostDir: &api.HostDir{"/mnt/vol1"}}},
|
||||
{Name: "vol2", Source: &api.VolumeSource{HostDir: &api.HostDir{"/mnt/vol2"}}}},
|
||||
Containers: []api.Container{
|
||||
{
|
||||
Name: "abc",
|
||||
|
Reference in New Issue
Block a user