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
1117da4a
Commit
1117da4a
authored
Jul 24, 2014
by
Danny Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SetUp now returns an error.
SetUp returns an error, kubelet now skips pod if error occurs.
parent
41eb15bc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
13 deletions
+22
-13
kubelet.go
pkg/kubelet/kubelet.go
+6
-2
volume.go
pkg/volume/volume.go
+16
-11
No files found.
pkg/kubelet/kubelet.go
View file @
1117da4a
...
...
@@ -223,7 +223,10 @@ func (kl *Kubelet) mountExternalVolumes(manifest *api.ContainerManifest) (volume
continue
}
podVolumes
[
vol
.
Name
]
=
extVolume
extVolume
.
SetUp
()
err
=
extVolume
.
SetUp
()
if
err
!=
nil
{
return
nil
,
err
}
}
return
podVolumes
,
nil
}
...
...
@@ -319,7 +322,8 @@ func (kl *Kubelet) syncPod(pod *Pod, dockerContainers DockerContainers, keepChan
podVolumes
,
err
:=
kl
.
mountExternalVolumes
(
&
pod
.
Manifest
)
if
err
!=
nil
{
glog
.
Errorf
(
"Unable to mount volumes for pod %s: (%v)"
,
podFullName
,
err
)
glog
.
Errorf
(
"Unable to mount volumes for pod %s: (%v) Skipping pod."
,
podFullName
,
err
)
return
err
}
for
_
,
container
:=
range
pod
.
Manifest
.
Containers
{
...
...
pkg/volume/volume.go
View file @
1117da4a
...
...
@@ -22,7 +22,6 @@ import (
"path"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/golang/glog"
)
// All volume types are expected to implement this interface
...
...
@@ -30,12 +29,12 @@ type Interface interface {
// Prepares and mounts/unpacks the volume to a directory path.
// This procedure must be idempotent.
// TODO(jonesdl) SetUp should return an error if it fails.
SetUp
()
SetUp
()
error
// Returns the directory path the volume is mounted to.
GetPath
()
string
// Unmounts the volume and removes traces of the SetUp procedure.
// This procedure must be idempotent.
TearDown
()
TearDown
()
error
}
// Host Directory volumes represent a bare host directory mount.
...
...
@@ -46,9 +45,13 @@ type HostDirectory struct {
// Host directory mounts require no setup or cleanup, but still
// need to fulfill the interface definitions.
func
(
hostVol
*
HostDirectory
)
SetUp
()
{}
func
(
hostVol
*
HostDirectory
)
SetUp
()
error
{
return
nil
}
func
(
hostVol
*
HostDirectory
)
TearDown
()
{}
func
(
hostVol
*
HostDirectory
)
TearDown
()
error
{
return
nil
}
func
(
hostVol
*
HostDirectory
)
GetPath
()
string
{
return
hostVol
.
Path
...
...
@@ -63,18 +66,20 @@ type EmptyDirectory struct {
}
// SetUp creates the new directory.
func
(
emptyDir
*
EmptyDirectory
)
SetUp
()
{
func
(
emptyDir
*
EmptyDirectory
)
SetUp
()
error
{
path
:=
emptyDir
.
GetPath
()
if
_
,
err
:=
os
.
Stat
(
path
);
os
.
IsNotExist
(
err
)
{
os
.
MkdirAll
(
path
,
0750
)
}
else
{
glog
.
Warningf
(
"Directory already exists: (%v)"
,
path
)
err
:=
os
.
MkdirAll
(
path
,
0750
)
if
err
!=
nil
{
return
err
}
return
nil
}
// TODO(jonesdl) when we can properly invoke TearDown(), we should delete
// the directory created by SetUp.
func
(
emptyDir
*
EmptyDirectory
)
TearDown
()
{}
func
(
emptyDir
*
EmptyDirectory
)
TearDown
()
error
{
return
nil
}
func
(
emptyDir
*
EmptyDirectory
)
GetPath
()
string
{
return
path
.
Join
(
emptyDir
.
RootDir
,
emptyDir
.
PodID
,
"volumes"
,
"empty"
,
emptyDir
.
Name
)
...
...
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