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
9c297334
Commit
9c297334
authored
Aug 20, 2015
by
Saad Ali
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #12938 from yifan-gu/rkt_patch_container_log
kubelet/rkt: Add support for fetching per container log.
parents
1db153ce
710c34a3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
rkt.go
pkg/kubelet/rkt/rkt.go
+10
-6
No files found.
pkg/kubelet/rkt/rkt.go
View file @
9c297334
...
...
@@ -980,12 +980,16 @@ func (r *runtime) SyncPod(pod *api.Pod, runningPod kubecontainer.Pod, podStatus
// By default, it returns a snapshot of the container log. Set |follow| to true to
// stream the log. Set |follow| to false and specify the number of lines (e.g.
// "100" or "all") to tail the log.
//
TODO(yifan): Currently, it fetches all the containers' log within a pod. We will
//
be able to fetch individual container's log once https://github.com/coreos/rkt/pull/841
//
landed
.
//
//
In rkt runtime's implementation, per container log is get via 'journalctl -M [rkt-$UUID] -u [APP_NAME]'.
//
See https://github.com/coreos/rkt/blob/master/Documentation/commands.md#logging for more details
.
func
(
r
*
runtime
)
GetContainerLogs
(
pod
*
api
.
Pod
,
containerID
string
,
tail
string
,
follow
bool
,
stdout
,
stderr
io
.
Writer
)
error
{
unitName
:=
makePodServiceFileName
(
pod
.
UID
)
cmd
:=
exec
.
Command
(
"journalctl"
,
"-u"
,
unitName
)
id
,
err
:=
parseContainerID
(
containerID
)
if
err
!=
nil
{
return
err
}
cmd
:=
exec
.
Command
(
"journalctl"
,
"-M"
,
fmt
.
Sprintf
(
"rkt-%s"
,
id
.
uuid
),
"-u"
,
id
.
appName
)
if
follow
{
cmd
.
Args
=
append
(
cmd
.
Args
,
"-f"
)
}
...
...
@@ -998,7 +1002,7 @@ func (r *runtime) GetContainerLogs(pod *api.Pod, containerID string, tail string
}
}
cmd
.
Stdout
,
cmd
.
Stderr
=
stdout
,
stderr
return
cmd
.
Start
()
return
cmd
.
Run
()
}
// GarbageCollect collects the pods/containers. TODO(yifan): Enforce the gc policy.
...
...
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