From fd22f48f5bba3523c7d5ed1bc2ff102cb656ca9d Mon Sep 17 00:00:00 2001 From: Tim Hockin Date: Mon, 18 May 2015 13:26:09 -0700 Subject: [PATCH] rename StorageType StorageMedium --- pkg/api/types.go | 10 +++++----- pkg/api/v1/conversion_generated.go | 4 ++-- pkg/api/v1/types.go | 10 +++++----- pkg/api/v1beta1/types.go | 10 +++++----- pkg/api/v1beta2/types.go | 10 +++++----- pkg/api/v1beta3/conversion_generated.go | 4 ++-- pkg/api/v1beta3/types.go | 10 +++++----- pkg/volume/empty_dir/empty_dir.go | 14 +++++++------- pkg/volume/empty_dir/empty_dir_test.go | 4 ++-- pkg/volume/secret/secret.go | 2 +- test/e2e/empty_dir.go | 4 ++-- 11 files changed, 41 insertions(+), 41 deletions(-) diff --git a/pkg/api/types.go b/pkg/api/types.go index a17f1f41385..18dd3dcbb48 100644 --- a/pkg/api/types.go +++ b/pkg/api/types.go @@ -354,15 +354,15 @@ type EmptyDirVolumeSource struct { // this will cover the most common needs. // Optional: what type of storage medium should back this directory. // The default is "" which means to use the node's default medium. - Medium StorageType `json:"medium"` + Medium StorageMedium `json:"medium"` } -// StorageType defines ways that storage can be allocated to a volume. -type StorageType string +// StorageMedium defines ways that storage can be allocated to a volume. +type StorageMedium string const ( - StorageTypeDefault StorageType = "" // use whatever the default is for the node - StorageTypeMemory StorageType = "Memory" // use memory (tmpfs) + StorageMediumDefault StorageMedium = "" // use whatever the default is for the node + StorageMediumMemory StorageMedium = "Memory" // use memory (tmpfs) ) // Protocol defines network protocols supported for things like conatiner ports. diff --git a/pkg/api/v1/conversion_generated.go b/pkg/api/v1/conversion_generated.go index dc9fc8cda93..efeb5419e4d 100644 --- a/pkg/api/v1/conversion_generated.go +++ b/pkg/api/v1/conversion_generated.go @@ -657,7 +657,7 @@ func convert_v1_EmptyDirVolumeSource_To_api_EmptyDirVolumeSource(in *EmptyDirVol if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*EmptyDirVolumeSource))(in) } - out.Medium = newer.StorageType(in.Medium) + out.Medium = newer.StorageMedium(in.Medium) return nil } @@ -665,7 +665,7 @@ func convert_api_EmptyDirVolumeSource_To_v1_EmptyDirVolumeSource(in *newer.Empty if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*newer.EmptyDirVolumeSource))(in) } - out.Medium = StorageType(in.Medium) + out.Medium = StorageMedium(in.Medium) return nil } diff --git a/pkg/api/v1/types.go b/pkg/api/v1/types.go index e314d6a06b0..dbbcd6b69b2 100644 --- a/pkg/api/v1/types.go +++ b/pkg/api/v1/types.go @@ -366,7 +366,7 @@ type HostPathVolumeSource struct { type EmptyDirVolumeSource struct { // Optional: what type of storage medium should back this directory. // The default is "" which means to use the node's default medium. - Medium StorageType `json:"medium,omitempty" description:"type of storage used to back the volume; must be an empty string (default) or Memory"` + Medium StorageMedium `json:"medium,omitempty" description:"type of storage used to back the volume; must be an empty string (default) or Memory"` } // GlusterfsVolumeSource represents a Glusterfs Mount that lasts the lifetime of a pod @@ -382,12 +382,12 @@ type GlusterfsVolumeSource struct { ReadOnly bool `json:"readOnly,omitempty" description:"glusterfs volume to be mounted with read-only permissions"` } -// StorageType defines ways that storage can be allocated to a volume. -type StorageType string +// StorageMedium defines ways that storage can be allocated to a volume. +type StorageMedium string const ( - StorageTypeDefault StorageType = "" // use whatever the default is for the node - StorageTypeMemory StorageType = "Memory" // use memory (tmpfs) + StorageMediumDefault StorageMedium = "" // use whatever the default is for the node + StorageMediumMemory StorageMedium = "Memory" // use memory (tmpfs) ) // Protocol defines network protocols supported for things like conatiner ports. diff --git a/pkg/api/v1beta1/types.go b/pkg/api/v1beta1/types.go index 99333a91929..262d643e221 100644 --- a/pkg/api/v1beta1/types.go +++ b/pkg/api/v1beta1/types.go @@ -267,15 +267,15 @@ type HostPathVolumeSource struct { type EmptyDirVolumeSource struct { // Optional: what type of storage medium should back this directory. // The default is "" which means to use the node's default medium. - Medium StorageType `json:"medium" description:"type of storage used to back the volume; must be an empty string (default) or Memory"` + Medium StorageMedium `json:"medium" description:"type of storage used to back the volume; must be an empty string (default) or Memory"` } -// StorageType defines ways that storage can be allocated to a volume. -type StorageType string +// StorageMedium defines ways that storage can be allocated to a volume. +type StorageMedium string const ( - StorageTypeDefault StorageType = "" // use whatever the default is for the node - StorageTypeMemory StorageType = "Memory" // use memory (tmpfs) + StorageMediumDefault StorageMedium = "" // use whatever the default is for the node + StorageMediumMemory StorageMedium = "Memory" // use memory (tmpfs) ) // Protocol defines network protocols supported for things like conatiner ports. diff --git a/pkg/api/v1beta2/types.go b/pkg/api/v1beta2/types.go index b978cb86ac4..3a5bdc5ca57 100644 --- a/pkg/api/v1beta2/types.go +++ b/pkg/api/v1beta2/types.go @@ -235,15 +235,15 @@ type HostPathVolumeSource struct { type EmptyDirVolumeSource struct { // Optional: what type of storage medium should back this directory. // The default is "" which means to use the node's default medium. - Medium StorageType `json:"medium" description:"type of storage used to back the volume; must be an empty string (default) or Memory"` + Medium StorageMedium `json:"medium" description:"type of storage used to back the volume; must be an empty string (default) or Memory"` } -// StorageType defines ways that storage can be allocated to a volume. -type StorageType string +// StorageMedium defines ways that storage can be allocated to a volume. +type StorageMedium string const ( - StorageTypeDefault StorageType = "" // use whatever the default is for the node - StorageTypeMemory StorageType = "Memory" // use memory (tmpfs) + StorageMediumDefault StorageMedium = "" // use whatever the default is for the node + StorageMediumMemory StorageMedium = "Memory" // use memory (tmpfs) ) // SecretVolumeSource adapts a Secret into a VolumeSource diff --git a/pkg/api/v1beta3/conversion_generated.go b/pkg/api/v1beta3/conversion_generated.go index da35ff9a2a1..9691ce5efae 100644 --- a/pkg/api/v1beta3/conversion_generated.go +++ b/pkg/api/v1beta3/conversion_generated.go @@ -471,7 +471,7 @@ func convert_v1beta3_EmptyDirVolumeSource_To_api_EmptyDirVolumeSource(in *EmptyD if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*EmptyDirVolumeSource))(in) } - out.Medium = newer.StorageType(in.Medium) + out.Medium = newer.StorageMedium(in.Medium) return nil } @@ -479,7 +479,7 @@ func convert_api_EmptyDirVolumeSource_To_v1beta3_EmptyDirVolumeSource(in *newer. if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*newer.EmptyDirVolumeSource))(in) } - out.Medium = StorageType(in.Medium) + out.Medium = StorageMedium(in.Medium) return nil } diff --git a/pkg/api/v1beta3/types.go b/pkg/api/v1beta3/types.go index a4d104b7efd..4ed3f34d4de 100644 --- a/pkg/api/v1beta3/types.go +++ b/pkg/api/v1beta3/types.go @@ -366,7 +366,7 @@ type HostPathVolumeSource struct { type EmptyDirVolumeSource struct { // Optional: what type of storage medium should back this directory. // The default is "" which means to use the node's default medium. - Medium StorageType `json:"medium,omitempty" description:"type of storage used to back the volume; must be an empty string (default) or Memory"` + Medium StorageMedium `json:"medium,omitempty" description:"type of storage used to back the volume; must be an empty string (default) or Memory"` } // GlusterfsVolumeSource represents a Glusterfs Mount that lasts the lifetime of a pod @@ -382,12 +382,12 @@ type GlusterfsVolumeSource struct { ReadOnly bool `json:"readOnly,omitempty" description:"glusterfs volume to be mounted with read-only permissions"` } -// StorageType defines ways that storage can be allocated to a volume. -type StorageType string +// StorageMedium defines ways that storage can be allocated to a volume. +type StorageMedium string const ( - StorageTypeDefault StorageType = "" // use whatever the default is for the node - StorageTypeMemory StorageType = "Memory" // use memory (tmpfs) + StorageMediumDefault StorageMedium = "" // use whatever the default is for the node + StorageMediumMemory StorageMedium = "Memory" // use memory (tmpfs) ) // Protocol defines network protocols supported for things like conatiner ports. diff --git a/pkg/volume/empty_dir/empty_dir.go b/pkg/volume/empty_dir/empty_dir.go index 8a6bc25fcb9..7951e7ab7d6 100644 --- a/pkg/volume/empty_dir/empty_dir.go +++ b/pkg/volume/empty_dir/empty_dir.go @@ -80,7 +80,7 @@ func (plugin *emptyDirPlugin) newBuilderInternal(spec *volume.Spec, pod *api.Pod // Legacy mode instances can be cleaned up but not created anew. return nil, fmt.Errorf("legacy mode: can not create new instances") } - medium := api.StorageTypeDefault + medium := api.StorageMediumDefault if spec.VolumeSource.EmptyDir != nil { // Support a non-specified source as EmptyDir. medium = spec.VolumeSource.EmptyDir.Medium } @@ -109,7 +109,7 @@ func (plugin *emptyDirPlugin) newCleanerInternal(volName string, podUID types.UI ed := &emptyDir{ podUID: podUID, volName: volName, - medium: api.StorageTypeDefault, // might be changed later + medium: api.StorageMediumDefault, // might be changed later mounter: mounter, mountDetector: mountDetector, plugin: plugin, @@ -140,7 +140,7 @@ const ( type emptyDir struct { podUID types.UID volName string - medium api.StorageType + medium api.StorageMedium mounter mount.Interface mountDetector mountDetector plugin *emptyDirPlugin @@ -159,9 +159,9 @@ func (ed *emptyDir) SetUpAt(dir string) error { return fmt.Errorf("legacy mode: can not create new instances") } switch ed.medium { - case api.StorageTypeDefault: + case api.StorageMediumDefault: return ed.setupDefault(dir) - case api.StorageTypeMemory: + case api.StorageMediumMemory: return ed.setupTmpfs(dir) default: return fmt.Errorf("unknown storage medium %q", ed.medium) @@ -231,10 +231,10 @@ func (ed *emptyDir) TearDownAt(dir string) error { return err } if isMnt && medium == mediumMemory { - ed.medium = api.StorageTypeMemory + ed.medium = api.StorageMediumMemory return ed.teardownTmpfs(dir) } - // assume StorageTypeDefault + // assume StorageMediumDefault return ed.teardownDefault(dir) } diff --git a/pkg/volume/empty_dir/empty_dir_test.go b/pkg/volume/empty_dir/empty_dir_test.go index dba5243a6a8..c813142bef0 100644 --- a/pkg/volume/empty_dir/empty_dir_test.go +++ b/pkg/volume/empty_dir/empty_dir_test.go @@ -70,7 +70,7 @@ func TestPlugin(t *testing.T) { spec := &api.Volume{ Name: "vol1", - VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{Medium: api.StorageTypeDefault}}, + VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{Medium: api.StorageMediumDefault}}, } mounter := mount.FakeMounter{} mountDetector := fakeMountDetector{} @@ -130,7 +130,7 @@ func TestPluginTmpfs(t *testing.T) { spec := &api.Volume{ Name: "vol1", - VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{Medium: api.StorageTypeMemory}}, + VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{Medium: api.StorageMediumMemory}}, } mounter := mount.FakeMounter{} mountDetector := fakeMountDetector{} diff --git a/pkg/volume/secret/secret.go b/pkg/volume/secret/secret.go index 6a64d5ba9f0..c77a9f77677 100644 --- a/pkg/volume/secret/secret.go +++ b/pkg/volume/secret/secret.go @@ -89,7 +89,7 @@ func (sv *secretVolume) SetUp() error { // This is the spec for the volume that this plugin wraps. var wrappedVolumeSpec = &volume.Spec{ Name: "not-used", - VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{Medium: api.StorageTypeMemory}}, + VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{Medium: api.StorageMediumMemory}}, } func (sv *secretVolume) SetUpAt(dir string) error { diff --git a/test/e2e/empty_dir.go b/test/e2e/empty_dir.go index bf5298dd2f8..67dcc1bf74b 100644 --- a/test/e2e/empty_dir.go +++ b/test/e2e/empty_dir.go @@ -42,7 +42,7 @@ var _ = Describe("emptyDir", func() { It("volume on tmpfs should have the correct mode", func() { volumePath := "/test-volume" source := &api.EmptyDirVolumeSource{ - Medium: api.StorageTypeMemory, + Medium: api.StorageMediumMemory, } pod := testPodWithVolume(volumePath, source) @@ -60,7 +60,7 @@ var _ = Describe("emptyDir", func() { volumePath := "/test-volume" filePath := path.Join(volumePath, "test-file") source := &api.EmptyDirVolumeSource{ - Medium: api.StorageTypeMemory, + Medium: api.StorageMediumMemory, } pod := testPodWithVolume(volumePath, source)