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
3082bb29
Commit
3082bb29
authored
Apr 27, 2015
by
Victor Marmol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove pullImageAndRunContainer().
Relevant logic is now in shared helpers.
parent
b232eef5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
20 deletions
+13
-20
kubelet.go
pkg/kubelet/kubelet.go
+13
-20
No files found.
pkg/kubelet/kubelet.go
View file @
3082bb29
...
@@ -867,8 +867,7 @@ func (kl *Kubelet) pullImage(pod *api.Pod, container *api.Container) error {
...
@@ -867,8 +867,7 @@ func (kl *Kubelet) pullImage(pod *api.Pod, container *api.Container) error {
if
ref
!=
nil
{
if
ref
!=
nil
{
kl
.
recorder
.
Eventf
(
ref
,
"failed"
,
"Failed to inspect image %q: %v"
,
container
.
Image
,
err
)
kl
.
recorder
.
Eventf
(
ref
,
"failed"
,
"Failed to inspect image %q: %v"
,
container
.
Image
,
err
)
}
}
glog
.
Errorf
(
"Failed to inspect image %q: %v; skipping pod %q container %q"
,
container
.
Image
,
err
,
kubecontainer
.
GetPodFullName
(
pod
),
container
.
Name
)
return
fmt
.
Errorf
(
"failed to inspect image %q: %v"
,
container
.
Image
,
err
)
return
err
}
}
if
container
.
ImagePullPolicy
==
api
.
PullAlways
||
if
container
.
ImagePullPolicy
==
api
.
PullAlways
||
...
@@ -978,23 +977,6 @@ func shouldContainerBeRestarted(container *api.Container, pod *api.Pod, podStatu
...
@@ -978,23 +977,6 @@ func shouldContainerBeRestarted(container *api.Container, pod *api.Pod, podStatu
return
true
return
true
}
}
// Attempts to start a container pulling the image before that if necessary. It returns DockerID of a started container
// if it was successful, and a non-nil error otherwise.
func
(
kl
*
Kubelet
)
pullImageAndRunContainer
(
pod
*
api
.
Pod
,
container
*
api
.
Container
,
podInfraContainerID
dockertools
.
DockerID
)
(
dockertools
.
DockerID
,
error
)
{
if
err
:=
kl
.
pullImage
(
pod
,
container
);
err
!=
nil
{
return
""
,
err
}
// TODO(dawnchen): Check RestartPolicy.DelaySeconds before restart a container
namespaceMode
:=
fmt
.
Sprintf
(
"container:%v"
,
podInfraContainerID
)
containerID
,
err
:=
kl
.
containerManager
.
RunContainer
(
pod
,
container
,
kl
,
kl
.
handlerRunner
,
namespaceMode
,
namespaceMode
)
if
err
!=
nil
{
// TODO(bburns) : Perhaps blacklist a container after N failures?
glog
.
Errorf
(
"Error running pod %q container %q: %v"
,
kubecontainer
.
GetPodFullName
(
pod
),
container
.
Name
,
err
)
return
""
,
err
}
return
containerID
,
nil
}
// Structure keeping information on changes that need to happen for a pod. The semantics is as follows:
// Structure keeping information on changes that need to happen for a pod. The semantics is as follows:
// - startInfraContainer is true if new Infra Containers have to be started and old one (if running) killed.
// - startInfraContainer is true if new Infra Containers have to be started and old one (if running) killed.
// Additionally if it is true then containersToKeep have to be empty
// Additionally if it is true then containersToKeep have to be empty
...
@@ -1228,7 +1210,18 @@ func (kl *Kubelet) syncPod(pod *api.Pod, mirrorPod *api.Pod, runningPod kubecont
...
@@ -1228,7 +1210,18 @@ func (kl *Kubelet) syncPod(pod *api.Pod, mirrorPod *api.Pod, runningPod kubecont
// Start everything
// Start everything
for
container
:=
range
containerChanges
.
containersToStart
{
for
container
:=
range
containerChanges
.
containersToStart
{
glog
.
V
(
4
)
.
Infof
(
"Creating container %+v"
,
pod
.
Spec
.
Containers
[
container
])
glog
.
V
(
4
)
.
Infof
(
"Creating container %+v"
,
pod
.
Spec
.
Containers
[
container
])
kl
.
pullImageAndRunContainer
(
pod
,
&
pod
.
Spec
.
Containers
[
container
],
podInfraContainerID
)
containerSpec
:=
&
pod
.
Spec
.
Containers
[
container
]
if
err
:=
kl
.
pullImage
(
pod
,
containerSpec
);
err
!=
nil
{
glog
.
Warningf
(
"Failed to pull image %q from pod %q and container %q: %v"
,
containerSpec
.
Image
,
kubecontainer
.
GetPodFullName
(
pod
),
containerSpec
.
Name
,
err
)
continue
}
// TODO(dawnchen): Check RestartPolicy.DelaySeconds before restart a container
namespaceMode
:=
fmt
.
Sprintf
(
"container:%v"
,
podInfraContainerID
)
_
,
err
:=
kl
.
containerManager
.
RunContainer
(
pod
,
containerSpec
,
kl
,
kl
.
handlerRunner
,
namespaceMode
,
namespaceMode
)
if
err
!=
nil
{
// TODO(bburns) : Perhaps blacklist a container after N failures?
glog
.
Errorf
(
"Error running pod %q container %q: %v"
,
kubecontainer
.
GetPodFullName
(
pod
),
containerSpec
.
Name
,
err
)
}
}
}
if
isStaticPod
(
pod
)
{
if
isStaticPod
(
pod
)
{
...
...
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