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
d713826a
Commit
d713826a
authored
Sep 07, 2015
by
feihujiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add pod name to error message when getting logs of a container
parent
8cc75a47
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
kubelet.go
pkg/kubelet/kubelet.go
+6
-6
No files found.
pkg/kubelet/kubelet.go
View file @
d713826a
...
@@ -2050,11 +2050,11 @@ func (kl *Kubelet) validateContainerStatus(podStatus *api.PodStatus, containerNa
...
@@ -2050,11 +2050,11 @@ func (kl *Kubelet) validateContainerStatus(podStatus *api.PodStatus, containerNa
cStatus
,
found
:=
api
.
GetContainerStatus
(
podStatus
.
ContainerStatuses
,
containerName
)
cStatus
,
found
:=
api
.
GetContainerStatus
(
podStatus
.
ContainerStatuses
,
containerName
)
if
!
found
{
if
!
found
{
return
""
,
fmt
.
Errorf
(
"container %q not found
in pod
"
,
containerName
)
return
""
,
fmt
.
Errorf
(
"container %q not found"
,
containerName
)
}
}
if
previous
{
if
previous
{
if
cStatus
.
LastTerminationState
.
Terminated
==
nil
{
if
cStatus
.
LastTerminationState
.
Terminated
==
nil
{
return
""
,
fmt
.
Errorf
(
"previous terminated container %q not found
in pod
"
,
containerName
)
return
""
,
fmt
.
Errorf
(
"previous terminated container %q not found"
,
containerName
)
}
}
cID
=
cStatus
.
LastTerminationState
.
Terminated
.
ContainerID
cID
=
cStatus
.
LastTerminationState
.
Terminated
.
ContainerID
}
else
{
}
else
{
...
@@ -2081,23 +2081,23 @@ func (kl *Kubelet) GetKubeletContainerLogs(podFullName, containerName, tail stri
...
@@ -2081,23 +2081,23 @@ func (kl *Kubelet) GetKubeletContainerLogs(podFullName, containerName, tail stri
pod
,
ok
:=
kl
.
GetPodByName
(
namespace
,
name
)
pod
,
ok
:=
kl
.
GetPodByName
(
namespace
,
name
)
if
!
ok
{
if
!
ok
{
return
fmt
.
Errorf
(
"unable to get logs for container %q in pod %q
: unable to find pod"
,
containerName
,
podFullNam
e
)
return
fmt
.
Errorf
(
"unable to get logs for container %q in pod %q
namespace %q: unable to find pod"
,
containerName
,
name
,
namespac
e
)
}
}
podStatus
,
found
:=
kl
.
statusManager
.
GetPodStatus
(
pod
.
UID
)
podStatus
,
found
:=
kl
.
statusManager
.
GetPodStatus
(
pod
.
UID
)
if
!
found
{
if
!
found
{
return
fmt
.
Errorf
(
"failed to get status for pod %q
"
,
podFullNam
e
)
return
fmt
.
Errorf
(
"failed to get status for pod %q
in namespace %q"
,
name
,
namespac
e
)
}
}
if
err
:=
kl
.
validatePodPhase
(
&
podStatus
);
err
!=
nil
{
if
err
:=
kl
.
validatePodPhase
(
&
podStatus
);
err
!=
nil
{
// No log is available if pod is not in a "known" phase (e.g. Unknown).
// No log is available if pod is not in a "known" phase (e.g. Unknown).
return
err
return
fmt
.
Errorf
(
"Pod %q in namespace %q : %v"
,
name
,
namespace
,
err
)
}
}
containerID
,
err
:=
kl
.
validateContainerStatus
(
&
podStatus
,
containerName
,
previous
)
containerID
,
err
:=
kl
.
validateContainerStatus
(
&
podStatus
,
containerName
,
previous
)
if
err
!=
nil
{
if
err
!=
nil
{
// No log is available if the container status is missing or is in the
// No log is available if the container status is missing or is in the
// waiting state.
// waiting state.
return
err
return
fmt
.
Errorf
(
"Pod %q in namespace %q: %v"
,
name
,
namespace
,
err
)
}
}
return
kl
.
containerRuntime
.
GetContainerLogs
(
pod
,
containerID
,
tail
,
follow
,
stdout
,
stderr
)
return
kl
.
containerRuntime
.
GetContainerLogs
(
pod
,
containerID
,
tail
,
follow
,
stdout
,
stderr
)
}
}
...
...
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