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
17d0074d
Commit
17d0074d
authored
Jan 05, 2016
by
Minhan Xia
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #19302 from yujuhong/fix_restarts
Fix container restarts caused by kubelet restarts
parents
8b72fff9
343240d5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
15 deletions
+13
-15
kubelet.go
pkg/kubelet/kubelet.go
+13
-15
No files found.
pkg/kubelet/kubelet.go
View file @
17d0074d
...
@@ -1709,30 +1709,28 @@ func (kl *Kubelet) syncPod(pod *api.Pod, mirrorPod *api.Pod, runningPod kubecont
...
@@ -1709,30 +1709,28 @@ func (kl *Kubelet) syncPod(pod *api.Pod, mirrorPod *api.Pod, runningPod kubecont
var
apiPodStatus
api
.
PodStatus
var
apiPodStatus
api
.
PodStatus
var
podStatus
*
kubecontainer
.
PodStatus
var
podStatus
*
kubecontainer
.
PodStatus
// Always generate the kubecontainer.PodStatus to know whether there are
// running containers associated with the pod.
podStatusPtr
,
apiPodStatusPtr
,
err
:=
kl
.
containerRuntime
.
GetPodStatusAndAPIPodStatus
(
pod
)
if
err
!=
nil
{
glog
.
Errorf
(
"Unable to get status for pod %q: %v"
,
format
.
Pod
(
pod
),
err
)
return
err
}
apiPodStatus
=
*
apiPodStatusPtr
podStatus
=
podStatusPtr
if
updateType
==
kubetypes
.
SyncPodCreate
{
if
updateType
==
kubetypes
.
SyncPodCreate
{
// This is the first time we are syncing the pod. Record the latency
// This is the first time we are syncing the pod. Record the latency
// since kubelet first saw the pod if firstSeenTime is set.
// since kubelet first saw the pod if firstSeenTime is set.
if
!
firstSeenTime
.
IsZero
()
{
if
!
firstSeenTime
.
IsZero
()
{
metrics
.
PodWorkerStartLatency
.
Observe
(
metrics
.
SinceInMicroseconds
(
firstSeenTime
))
metrics
.
PodWorkerStartLatency
.
Observe
(
metrics
.
SinceInMicroseconds
(
firstSeenTime
))
}
}
// kubelet may have just been restarted. Re-use the last known
// apiPodStatus.
apiPodStatus
=
pod
.
Status
apiPodStatus
=
pod
.
Status
apiPodStatus
.
StartTime
=
&
unversioned
.
Time
{
Time
:
start
}
apiPodStatus
.
StartTime
=
&
unversioned
.
Time
{
Time
:
start
}
kl
.
statusManager
.
SetPodStatus
(
pod
,
apiPodStatus
)
kl
.
statusManager
.
SetPodStatus
(
pod
,
apiPodStatus
)
podStatus
=
&
kubecontainer
.
PodStatus
{
glog
.
V
(
3
)
.
Infof
(
"Reusing api pod status for new pod %q"
,
format
.
Pod
(
pod
))
ID
:
pod
.
UID
,
Name
:
pod
.
Name
,
Namespace
:
pod
.
Namespace
,
}
glog
.
V
(
3
)
.
Infof
(
"Not generating pod status for new pod %q"
,
format
.
Pod
(
pod
))
}
else
{
podStatusPtr
,
apiPodStatusPtr
,
err
:=
kl
.
containerRuntime
.
GetPodStatusAndAPIPodStatus
(
pod
)
if
err
!=
nil
{
glog
.
Errorf
(
"Unable to get status for pod %q: %v"
,
format
.
Pod
(
pod
),
err
)
return
err
}
apiPodStatus
=
*
apiPodStatusPtr
podStatus
=
podStatusPtr
}
}
pullSecrets
,
err
:=
kl
.
getPullSecretsForPod
(
pod
)
pullSecrets
,
err
:=
kl
.
getPullSecretsForPod
(
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