Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
fd22f48f
Commit
fd22f48f
authored
May 18, 2015
by
Tim Hockin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename StorageType StorageMedium
parent
f66ca25d
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
41 additions
and
41 deletions
+41
-41
types.go
pkg/api/types.go
+5
-5
conversion_generated.go
pkg/api/v1/conversion_generated.go
+2
-2
types.go
pkg/api/v1/types.go
+5
-5
types.go
pkg/api/v1beta1/types.go
+5
-5
types.go
pkg/api/v1beta2/types.go
+5
-5
conversion_generated.go
pkg/api/v1beta3/conversion_generated.go
+2
-2
types.go
pkg/api/v1beta3/types.go
+5
-5
empty_dir.go
pkg/volume/empty_dir/empty_dir.go
+7
-7
empty_dir_test.go
pkg/volume/empty_dir/empty_dir_test.go
+2
-2
secret.go
pkg/volume/secret/secret.go
+1
-1
empty_dir.go
test/e2e/empty_dir.go
+2
-2
No files found.
pkg/api/types.go
View file @
fd22f48f
...
@@ -354,15 +354,15 @@ type EmptyDirVolumeSource struct {
...
@@ -354,15 +354,15 @@ type EmptyDirVolumeSource struct {
// this will cover the most common needs.
// this will cover the most common needs.
// Optional: what type of storage medium should back this directory.
// Optional: what type of storage medium should back this directory.
// The default is "" which means to use the node's default medium.
// The default is "" which means to use the node's default medium.
Medium
Storage
Type
`json:"medium"`
Medium
Storage
Medium
`json:"medium"`
}
}
// Storage
Type
defines ways that storage can be allocated to a volume.
// Storage
Medium
defines ways that storage can be allocated to a volume.
type
Storage
Type
string
type
Storage
Medium
string
const
(
const
(
Storage
TypeDefault
StorageType
=
""
// use whatever the default is for the node
Storage
MediumDefault
StorageMedium
=
""
// use whatever the default is for the node
Storage
TypeMemory
StorageType
=
"Memory"
// use memory (tmpfs)
Storage
MediumMemory
StorageMedium
=
"Memory"
// use memory (tmpfs)
)
)
// Protocol defines network protocols supported for things like conatiner ports.
// Protocol defines network protocols supported for things like conatiner ports.
...
...
pkg/api/v1/conversion_generated.go
View file @
fd22f48f
...
@@ -657,7 +657,7 @@ func convert_v1_EmptyDirVolumeSource_To_api_EmptyDirVolumeSource(in *EmptyDirVol
...
@@ -657,7 +657,7 @@ func convert_v1_EmptyDirVolumeSource_To_api_EmptyDirVolumeSource(in *EmptyDirVol
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
defaulting
.
(
func
(
*
EmptyDirVolumeSource
))(
in
)
defaulting
.
(
func
(
*
EmptyDirVolumeSource
))(
in
)
}
}
out
.
Medium
=
newer
.
Storage
Type
(
in
.
Medium
)
out
.
Medium
=
newer
.
Storage
Medium
(
in
.
Medium
)
return
nil
return
nil
}
}
...
@@ -665,7 +665,7 @@ func convert_api_EmptyDirVolumeSource_To_v1_EmptyDirVolumeSource(in *newer.Empty
...
@@ -665,7 +665,7 @@ func convert_api_EmptyDirVolumeSource_To_v1_EmptyDirVolumeSource(in *newer.Empty
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
defaulting
.
(
func
(
*
newer
.
EmptyDirVolumeSource
))(
in
)
defaulting
.
(
func
(
*
newer
.
EmptyDirVolumeSource
))(
in
)
}
}
out
.
Medium
=
Storage
Type
(
in
.
Medium
)
out
.
Medium
=
Storage
Medium
(
in
.
Medium
)
return
nil
return
nil
}
}
...
...
pkg/api/v1/types.go
View file @
fd22f48f
...
@@ -366,7 +366,7 @@ type HostPathVolumeSource struct {
...
@@ -366,7 +366,7 @@ type HostPathVolumeSource struct {
type
EmptyDirVolumeSource
struct
{
type
EmptyDirVolumeSource
struct
{
// Optional: what type of storage medium should back this directory.
// Optional: what type of storage medium should back this directory.
// The default is "" which means to use the node's default medium.
// The default is "" which means to use the node's default medium.
Medium
Storage
Type
`json:"medium,omitempty" description:"type of storage used to back the volume; must be an empty string (default) or Memory"`
Medium
Storage
Medium
`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
// GlusterfsVolumeSource represents a Glusterfs Mount that lasts the lifetime of a pod
...
@@ -382,12 +382,12 @@ type GlusterfsVolumeSource struct {
...
@@ -382,12 +382,12 @@ type GlusterfsVolumeSource struct {
ReadOnly
bool
`json:"readOnly,omitempty" description:"glusterfs volume to be mounted with read-only permissions"`
ReadOnly
bool
`json:"readOnly,omitempty" description:"glusterfs volume to be mounted with read-only permissions"`
}
}
// Storage
Type
defines ways that storage can be allocated to a volume.
// Storage
Medium
defines ways that storage can be allocated to a volume.
type
Storage
Type
string
type
Storage
Medium
string
const
(
const
(
Storage
TypeDefault
StorageType
=
""
// use whatever the default is for the node
Storage
MediumDefault
StorageMedium
=
""
// use whatever the default is for the node
Storage
TypeMemory
StorageType
=
"Memory"
// use memory (tmpfs)
Storage
MediumMemory
StorageMedium
=
"Memory"
// use memory (tmpfs)
)
)
// Protocol defines network protocols supported for things like conatiner ports.
// Protocol defines network protocols supported for things like conatiner ports.
...
...
pkg/api/v1beta1/types.go
View file @
fd22f48f
...
@@ -267,15 +267,15 @@ type HostPathVolumeSource struct {
...
@@ -267,15 +267,15 @@ type HostPathVolumeSource struct {
type
EmptyDirVolumeSource
struct
{
type
EmptyDirVolumeSource
struct
{
// Optional: what type of storage medium should back this directory.
// Optional: what type of storage medium should back this directory.
// The default is "" which means to use the node's default medium.
// The default is "" which means to use the node's default medium.
Medium
Storage
Type
`json:"medium" description:"type of storage used to back the volume; must be an empty string (default) or Memory"`
Medium
Storage
Medium
`json:"medium" description:"type of storage used to back the volume; must be an empty string (default) or Memory"`
}
}
// Storage
Type
defines ways that storage can be allocated to a volume.
// Storage
Medium
defines ways that storage can be allocated to a volume.
type
Storage
Type
string
type
Storage
Medium
string
const
(
const
(
Storage
TypeDefault
StorageType
=
""
// use whatever the default is for the node
Storage
MediumDefault
StorageMedium
=
""
// use whatever the default is for the node
Storage
TypeMemory
StorageType
=
"Memory"
// use memory (tmpfs)
Storage
MediumMemory
StorageMedium
=
"Memory"
// use memory (tmpfs)
)
)
// Protocol defines network protocols supported for things like conatiner ports.
// Protocol defines network protocols supported for things like conatiner ports.
...
...
pkg/api/v1beta2/types.go
View file @
fd22f48f
...
@@ -235,15 +235,15 @@ type HostPathVolumeSource struct {
...
@@ -235,15 +235,15 @@ type HostPathVolumeSource struct {
type
EmptyDirVolumeSource
struct
{
type
EmptyDirVolumeSource
struct
{
// Optional: what type of storage medium should back this directory.
// Optional: what type of storage medium should back this directory.
// The default is "" which means to use the node's default medium.
// The default is "" which means to use the node's default medium.
Medium
Storage
Type
`json:"medium" description:"type of storage used to back the volume; must be an empty string (default) or Memory"`
Medium
Storage
Medium
`json:"medium" description:"type of storage used to back the volume; must be an empty string (default) or Memory"`
}
}
// Storage
Type
defines ways that storage can be allocated to a volume.
// Storage
Medium
defines ways that storage can be allocated to a volume.
type
Storage
Type
string
type
Storage
Medium
string
const
(
const
(
Storage
TypeDefault
StorageType
=
""
// use whatever the default is for the node
Storage
MediumDefault
StorageMedium
=
""
// use whatever the default is for the node
Storage
TypeMemory
StorageType
=
"Memory"
// use memory (tmpfs)
Storage
MediumMemory
StorageMedium
=
"Memory"
// use memory (tmpfs)
)
)
// SecretVolumeSource adapts a Secret into a VolumeSource
// SecretVolumeSource adapts a Secret into a VolumeSource
...
...
pkg/api/v1beta3/conversion_generated.go
View file @
fd22f48f
...
@@ -471,7 +471,7 @@ func convert_v1beta3_EmptyDirVolumeSource_To_api_EmptyDirVolumeSource(in *EmptyD
...
@@ -471,7 +471,7 @@ func convert_v1beta3_EmptyDirVolumeSource_To_api_EmptyDirVolumeSource(in *EmptyD
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
defaulting
.
(
func
(
*
EmptyDirVolumeSource
))(
in
)
defaulting
.
(
func
(
*
EmptyDirVolumeSource
))(
in
)
}
}
out
.
Medium
=
newer
.
Storage
Type
(
in
.
Medium
)
out
.
Medium
=
newer
.
Storage
Medium
(
in
.
Medium
)
return
nil
return
nil
}
}
...
@@ -479,7 +479,7 @@ func convert_api_EmptyDirVolumeSource_To_v1beta3_EmptyDirVolumeSource(in *newer.
...
@@ -479,7 +479,7 @@ func convert_api_EmptyDirVolumeSource_To_v1beta3_EmptyDirVolumeSource(in *newer.
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
if
defaulting
,
found
:=
s
.
DefaultingInterface
(
reflect
.
TypeOf
(
*
in
));
found
{
defaulting
.
(
func
(
*
newer
.
EmptyDirVolumeSource
))(
in
)
defaulting
.
(
func
(
*
newer
.
EmptyDirVolumeSource
))(
in
)
}
}
out
.
Medium
=
Storage
Type
(
in
.
Medium
)
out
.
Medium
=
Storage
Medium
(
in
.
Medium
)
return
nil
return
nil
}
}
...
...
pkg/api/v1beta3/types.go
View file @
fd22f48f
...
@@ -366,7 +366,7 @@ type HostPathVolumeSource struct {
...
@@ -366,7 +366,7 @@ type HostPathVolumeSource struct {
type
EmptyDirVolumeSource
struct
{
type
EmptyDirVolumeSource
struct
{
// Optional: what type of storage medium should back this directory.
// Optional: what type of storage medium should back this directory.
// The default is "" which means to use the node's default medium.
// The default is "" which means to use the node's default medium.
Medium
Storage
Type
`json:"medium,omitempty" description:"type of storage used to back the volume; must be an empty string (default) or Memory"`
Medium
Storage
Medium
`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
// GlusterfsVolumeSource represents a Glusterfs Mount that lasts the lifetime of a pod
...
@@ -382,12 +382,12 @@ type GlusterfsVolumeSource struct {
...
@@ -382,12 +382,12 @@ type GlusterfsVolumeSource struct {
ReadOnly
bool
`json:"readOnly,omitempty" description:"glusterfs volume to be mounted with read-only permissions"`
ReadOnly
bool
`json:"readOnly,omitempty" description:"glusterfs volume to be mounted with read-only permissions"`
}
}
// Storage
Type
defines ways that storage can be allocated to a volume.
// Storage
Medium
defines ways that storage can be allocated to a volume.
type
Storage
Type
string
type
Storage
Medium
string
const
(
const
(
Storage
TypeDefault
StorageType
=
""
// use whatever the default is for the node
Storage
MediumDefault
StorageMedium
=
""
// use whatever the default is for the node
Storage
TypeMemory
StorageType
=
"Memory"
// use memory (tmpfs)
Storage
MediumMemory
StorageMedium
=
"Memory"
// use memory (tmpfs)
)
)
// Protocol defines network protocols supported for things like conatiner ports.
// Protocol defines network protocols supported for things like conatiner ports.
...
...
pkg/volume/empty_dir/empty_dir.go
View file @
fd22f48f
...
@@ -80,7 +80,7 @@ func (plugin *emptyDirPlugin) newBuilderInternal(spec *volume.Spec, pod *api.Pod
...
@@ -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.
// Legacy mode instances can be cleaned up but not created anew.
return
nil
,
fmt
.
Errorf
(
"legacy mode: can not create new instances"
)
return
nil
,
fmt
.
Errorf
(
"legacy mode: can not create new instances"
)
}
}
medium
:=
api
.
Storage
Type
Default
medium
:=
api
.
Storage
Medium
Default
if
spec
.
VolumeSource
.
EmptyDir
!=
nil
{
// Support a non-specified source as EmptyDir.
if
spec
.
VolumeSource
.
EmptyDir
!=
nil
{
// Support a non-specified source as EmptyDir.
medium
=
spec
.
VolumeSource
.
EmptyDir
.
Medium
medium
=
spec
.
VolumeSource
.
EmptyDir
.
Medium
}
}
...
@@ -109,7 +109,7 @@ func (plugin *emptyDirPlugin) newCleanerInternal(volName string, podUID types.UI
...
@@ -109,7 +109,7 @@ func (plugin *emptyDirPlugin) newCleanerInternal(volName string, podUID types.UI
ed
:=
&
emptyDir
{
ed
:=
&
emptyDir
{
podUID
:
podUID
,
podUID
:
podUID
,
volName
:
volName
,
volName
:
volName
,
medium
:
api
.
Storage
Type
Default
,
// might be changed later
medium
:
api
.
Storage
Medium
Default
,
// might be changed later
mounter
:
mounter
,
mounter
:
mounter
,
mountDetector
:
mountDetector
,
mountDetector
:
mountDetector
,
plugin
:
plugin
,
plugin
:
plugin
,
...
@@ -140,7 +140,7 @@ const (
...
@@ -140,7 +140,7 @@ const (
type
emptyDir
struct
{
type
emptyDir
struct
{
podUID
types
.
UID
podUID
types
.
UID
volName
string
volName
string
medium
api
.
Storage
Type
medium
api
.
Storage
Medium
mounter
mount
.
Interface
mounter
mount
.
Interface
mountDetector
mountDetector
mountDetector
mountDetector
plugin
*
emptyDirPlugin
plugin
*
emptyDirPlugin
...
@@ -159,9 +159,9 @@ func (ed *emptyDir) SetUpAt(dir string) error {
...
@@ -159,9 +159,9 @@ func (ed *emptyDir) SetUpAt(dir string) error {
return
fmt
.
Errorf
(
"legacy mode: can not create new instances"
)
return
fmt
.
Errorf
(
"legacy mode: can not create new instances"
)
}
}
switch
ed
.
medium
{
switch
ed
.
medium
{
case
api
.
Storage
Type
Default
:
case
api
.
Storage
Medium
Default
:
return
ed
.
setupDefault
(
dir
)
return
ed
.
setupDefault
(
dir
)
case
api
.
Storage
Type
Memory
:
case
api
.
Storage
Medium
Memory
:
return
ed
.
setupTmpfs
(
dir
)
return
ed
.
setupTmpfs
(
dir
)
default
:
default
:
return
fmt
.
Errorf
(
"unknown storage medium %q"
,
ed
.
medium
)
return
fmt
.
Errorf
(
"unknown storage medium %q"
,
ed
.
medium
)
...
@@ -231,10 +231,10 @@ func (ed *emptyDir) TearDownAt(dir string) error {
...
@@ -231,10 +231,10 @@ func (ed *emptyDir) TearDownAt(dir string) error {
return
err
return
err
}
}
if
isMnt
&&
medium
==
mediumMemory
{
if
isMnt
&&
medium
==
mediumMemory
{
ed
.
medium
=
api
.
Storage
Type
Memory
ed
.
medium
=
api
.
Storage
Medium
Memory
return
ed
.
teardownTmpfs
(
dir
)
return
ed
.
teardownTmpfs
(
dir
)
}
}
// assume Storage
Type
Default
// assume Storage
Medium
Default
return
ed
.
teardownDefault
(
dir
)
return
ed
.
teardownDefault
(
dir
)
}
}
...
...
pkg/volume/empty_dir/empty_dir_test.go
View file @
fd22f48f
...
@@ -70,7 +70,7 @@ func TestPlugin(t *testing.T) {
...
@@ -70,7 +70,7 @@ func TestPlugin(t *testing.T) {
spec
:=
&
api
.
Volume
{
spec
:=
&
api
.
Volume
{
Name
:
"vol1"
,
Name
:
"vol1"
,
VolumeSource
:
api
.
VolumeSource
{
EmptyDir
:
&
api
.
EmptyDirVolumeSource
{
Medium
:
api
.
Storage
Type
Default
}},
VolumeSource
:
api
.
VolumeSource
{
EmptyDir
:
&
api
.
EmptyDirVolumeSource
{
Medium
:
api
.
Storage
Medium
Default
}},
}
}
mounter
:=
mount
.
FakeMounter
{}
mounter
:=
mount
.
FakeMounter
{}
mountDetector
:=
fakeMountDetector
{}
mountDetector
:=
fakeMountDetector
{}
...
@@ -130,7 +130,7 @@ func TestPluginTmpfs(t *testing.T) {
...
@@ -130,7 +130,7 @@ func TestPluginTmpfs(t *testing.T) {
spec
:=
&
api
.
Volume
{
spec
:=
&
api
.
Volume
{
Name
:
"vol1"
,
Name
:
"vol1"
,
VolumeSource
:
api
.
VolumeSource
{
EmptyDir
:
&
api
.
EmptyDirVolumeSource
{
Medium
:
api
.
Storage
Type
Memory
}},
VolumeSource
:
api
.
VolumeSource
{
EmptyDir
:
&
api
.
EmptyDirVolumeSource
{
Medium
:
api
.
Storage
Medium
Memory
}},
}
}
mounter
:=
mount
.
FakeMounter
{}
mounter
:=
mount
.
FakeMounter
{}
mountDetector
:=
fakeMountDetector
{}
mountDetector
:=
fakeMountDetector
{}
...
...
pkg/volume/secret/secret.go
View file @
fd22f48f
...
@@ -89,7 +89,7 @@ func (sv *secretVolume) SetUp() error {
...
@@ -89,7 +89,7 @@ func (sv *secretVolume) SetUp() error {
// This is the spec for the volume that this plugin wraps.
// This is the spec for the volume that this plugin wraps.
var
wrappedVolumeSpec
=
&
volume
.
Spec
{
var
wrappedVolumeSpec
=
&
volume
.
Spec
{
Name
:
"not-used"
,
Name
:
"not-used"
,
VolumeSource
:
api
.
VolumeSource
{
EmptyDir
:
&
api
.
EmptyDirVolumeSource
{
Medium
:
api
.
Storage
Type
Memory
}},
VolumeSource
:
api
.
VolumeSource
{
EmptyDir
:
&
api
.
EmptyDirVolumeSource
{
Medium
:
api
.
Storage
Medium
Memory
}},
}
}
func
(
sv
*
secretVolume
)
SetUpAt
(
dir
string
)
error
{
func
(
sv
*
secretVolume
)
SetUpAt
(
dir
string
)
error
{
...
...
test/e2e/empty_dir.go
View file @
fd22f48f
...
@@ -42,7 +42,7 @@ var _ = Describe("emptyDir", func() {
...
@@ -42,7 +42,7 @@ var _ = Describe("emptyDir", func() {
It
(
"volume on tmpfs should have the correct mode"
,
func
()
{
It
(
"volume on tmpfs should have the correct mode"
,
func
()
{
volumePath
:=
"/test-volume"
volumePath
:=
"/test-volume"
source
:=
&
api
.
EmptyDirVolumeSource
{
source
:=
&
api
.
EmptyDirVolumeSource
{
Medium
:
api
.
Storage
Type
Memory
,
Medium
:
api
.
Storage
Medium
Memory
,
}
}
pod
:=
testPodWithVolume
(
volumePath
,
source
)
pod
:=
testPodWithVolume
(
volumePath
,
source
)
...
@@ -60,7 +60,7 @@ var _ = Describe("emptyDir", func() {
...
@@ -60,7 +60,7 @@ var _ = Describe("emptyDir", func() {
volumePath
:=
"/test-volume"
volumePath
:=
"/test-volume"
filePath
:=
path
.
Join
(
volumePath
,
"test-file"
)
filePath
:=
path
.
Join
(
volumePath
,
"test-file"
)
source
:=
&
api
.
EmptyDirVolumeSource
{
source
:=
&
api
.
EmptyDirVolumeSource
{
Medium
:
api
.
Storage
Type
Memory
,
Medium
:
api
.
Storage
Medium
Memory
,
}
}
pod
:=
testPodWithVolume
(
volumePath
,
source
)
pod
:=
testPodWithVolume
(
volumePath
,
source
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment