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
96049885
Commit
96049885
authored
Nov 17, 2015
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #16894 from alexhersh/manifest-fix
Auto commit by PR queue bot
parents
cd236c32
0584f9ba
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
19 deletions
+32
-19
kubelet.go
pkg/kubelet/kubelet.go
+23
-16
runonce.go
pkg/kubelet/runonce.go
+9
-3
No files found.
pkg/kubelet/kubelet.go
View file @
96049885
...
...
@@ -1499,6 +1499,29 @@ func (kl *Kubelet) syncPod(pod *api.Pod, mirrorPod *api.Pod, runningPod kubecont
return
err
}
// Create Mirror Pod for Static Pod if it doesn't already exist
if
kubepod
.
IsStaticPod
(
pod
)
{
if
mirrorPod
!=
nil
&&
!
kl
.
podManager
.
IsMirrorPodOf
(
mirrorPod
,
pod
)
{
// The mirror pod is semantically different from the static pod. Remove
// it. The mirror pod will get recreated later.
glog
.
Errorf
(
"Deleting mirror pod %q because it is outdated"
,
podFullName
)
if
err
:=
kl
.
podManager
.
DeleteMirrorPod
(
podFullName
);
err
!=
nil
{
glog
.
Errorf
(
"Failed deleting mirror pod %q: %v"
,
podFullName
,
err
)
}
}
if
mirrorPod
==
nil
{
glog
.
V
(
3
)
.
Infof
(
"Creating a mirror pod for static pod %q"
,
podFullName
)
if
err
:=
kl
.
podManager
.
CreateMirrorPod
(
pod
);
err
!=
nil
{
glog
.
Errorf
(
"Failed creating a mirror pod %q: %v"
,
podFullName
,
err
)
}
_
,
ok
:=
kl
.
podManager
.
GetMirrorPodByPod
(
pod
)
if
!
ok
{
glog
.
Errorf
(
"Mirror pod not available"
)
}
}
}
if
err
:=
kl
.
makePodDataDirs
(
pod
);
err
!=
nil
{
glog
.
Errorf
(
"Unable to make pod data directories for pod %q (uid %q): %v"
,
podFullName
,
uid
,
err
)
return
err
...
...
@@ -1597,22 +1620,6 @@ func (kl *Kubelet) syncPod(pod *api.Pod, mirrorPod *api.Pod, runningPod kubecont
}
}
if
kubepod
.
IsStaticPod
(
pod
)
{
if
mirrorPod
!=
nil
&&
!
kl
.
podManager
.
IsMirrorPodOf
(
mirrorPod
,
pod
)
{
// The mirror pod is semantically different from the static pod. Remove
// it. The mirror pod will get recreated later.
glog
.
Errorf
(
"Deleting mirror pod %q because it is outdated"
,
podFullName
)
if
err
:=
kl
.
podManager
.
DeleteMirrorPod
(
podFullName
);
err
!=
nil
{
glog
.
Errorf
(
"Failed deleting mirror pod %q: %v"
,
podFullName
,
err
)
}
}
if
mirrorPod
==
nil
{
glog
.
V
(
3
)
.
Infof
(
"Creating a mirror pod %q"
,
podFullName
)
if
err
:=
kl
.
podManager
.
CreateMirrorPod
(
pod
);
err
!=
nil
{
glog
.
Errorf
(
"Failed creating a mirror pod %q: %v"
,
podFullName
,
err
)
}
}
}
return
nil
}
...
...
pkg/kubelet/runonce.go
View file @
96049885
...
...
@@ -108,9 +108,15 @@ func (kl *Kubelet) runPod(pod *api.Pod, retryDelay time.Duration) error {
return
nil
}
glog
.
Infof
(
"pod %q containers not running: syncing"
,
pod
.
Name
)
// We don't create mirror pods in this mode; pass a dummy boolean value
// to sycnPod.
if
err
=
kl
.
syncPod
(
pod
,
nil
,
p
,
kubetypes
.
SyncPodUpdate
);
err
!=
nil
{
podFullName
:=
kubecontainer
.
GetPodFullName
(
pod
)
glog
.
Infof
(
"Creating a mirror pod for static pod %q"
,
podFullName
)
if
err
:=
kl
.
podManager
.
CreateMirrorPod
(
pod
);
err
!=
nil
{
glog
.
Errorf
(
"Failed creating a mirror pod %q: %v"
,
podFullName
,
err
)
}
mirrorPod
,
_
:=
kl
.
podManager
.
GetMirrorPodByPod
(
pod
)
if
err
=
kl
.
syncPod
(
pod
,
mirrorPod
,
p
,
kubetypes
.
SyncPodUpdate
);
err
!=
nil
{
return
fmt
.
Errorf
(
"error syncing pod: %v"
,
err
)
}
if
retry
>=
RunOnceMaxRetries
{
...
...
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