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
3f1960b7
Commit
3f1960b7
authored
Jun 03, 2016
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #26314 from vishh/all-logs
Automatic merge from submit-queue Link kernel log files to have them be copied over as part of node e2e. Fixes #25993 cc @pwittrock
parents
64204965
4e1596e6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
2 deletions
+70
-2
e2e_node_suite_test.go
test/e2e_node/e2e_node_suite_test.go
+5
-2
e2e_service.go
test/e2e_node/e2e_service.go
+65
-0
No files found.
test/e2e_node/e2e_node_suite_test.go
View file @
3f1960b7
...
@@ -101,10 +101,13 @@ var _ = BeforeSuite(func() {
...
@@ -101,10 +101,13 @@ var _ = BeforeSuite(func() {
// Tear down the kubelet on the node
// Tear down the kubelet on the node
var
_
=
AfterSuite
(
func
()
{
var
_
=
AfterSuite
(
func
()
{
if
e2es
!=
nil
&&
*
startServices
&&
*
stopServices
{
if
e2es
!=
nil
{
e2es
.
getLogFiles
()
if
*
startServices
&&
*
stopServices
{
glog
.
Infof
(
"Stopping node services..."
)
glog
.
Infof
(
"Stopping node services..."
)
e2es
.
stop
()
e2es
.
stop
()
}
}
}
glog
.
Infof
(
"Tests Finished"
)
glog
.
Infof
(
"Tests Finished"
)
})
})
...
@@ -118,6 +121,6 @@ func maskLocksmithdOnCoreos() {
...
@@ -118,6 +121,6 @@ func maskLocksmithdOnCoreos() {
if
output
,
err
:=
exec
.
Command
(
"sudo"
,
"systemctl"
,
"mask"
,
"--now"
,
"locksmithd"
)
.
CombinedOutput
();
err
!=
nil
{
if
output
,
err
:=
exec
.
Command
(
"sudo"
,
"systemctl"
,
"mask"
,
"--now"
,
"locksmithd"
)
.
CombinedOutput
();
err
!=
nil
{
glog
.
Fatalf
(
"Could not mask locksmithd: %v, output: %q"
,
err
,
string
(
output
))
glog
.
Fatalf
(
"Could not mask locksmithd: %v, output: %q"
,
err
,
string
(
output
))
}
}
}
glog
.
Infof
(
"Locksmithd is masked successfully"
)
glog
.
Infof
(
"Locksmithd is masked successfully"
)
}
}
}
test/e2e_node/e2e_service.go
View file @
3f1960b7
...
@@ -75,6 +75,71 @@ func (es *e2eService) start() error {
...
@@ -75,6 +75,71 @@ func (es *e2eService) start() error {
return
nil
return
nil
}
}
// Get logs of interest either via journalctl or by creating sym links.
// Since we scp files from the remote directory, symlinks will be treated as normal files and file contents will be copied over.
func
(
es
*
e2eService
)
getLogFiles
()
{
// Special log files that need to be collected for additional debugging.
type
logFileData
struct
{
files
[]
string
journalctlCommand
[]
string
}
var
logFiles
=
map
[
string
]
logFileData
{
"kern.log"
:
{[]
string
{
"/var/log/kern.log"
},
[]
string
{
"-k"
}},
"docker.log"
:
{[]
string
{
"/var/log/docker.log"
,
"/var/log/upstart/docker.log"
},
[]
string
{
"-u"
,
"docker"
}},
}
// Nothing to do if report dir is not specified.
if
*
reportDir
==
""
{
return
}
journaldFound
:=
isJournaldAvailable
()
for
targetFileName
,
logFileData
:=
range
logFiles
{
targetLink
:=
path
.
Join
(
*
reportDir
,
targetFileName
)
if
journaldFound
{
// Skip log files that do not have an equivalent in journald based machines.
if
len
(
logFileData
.
journalctlCommand
)
==
0
{
continue
}
out
,
err
:=
exec
.
Command
(
"sudo"
,
append
([]
string
{
"journalctl"
},
logFileData
.
journalctlCommand
...
)
...
)
.
CombinedOutput
()
if
err
!=
nil
{
glog
.
Errorf
(
"failed to get %q from journald: %v, %v"
,
targetFileName
,
string
(
out
),
err
)
}
else
{
if
err
=
ioutil
.
WriteFile
(
targetLink
,
out
,
0755
);
err
!=
nil
{
glog
.
Errorf
(
"failed to write logs to %q: %v"
,
targetLink
,
err
)
}
}
continue
}
for
_
,
file
:=
range
logFileData
.
files
{
if
_
,
err
:=
os
.
Stat
(
file
);
err
!=
nil
{
// Expected file not found on this distro.
continue
}
if
err
:=
copyLogFile
(
file
,
targetLink
);
err
!=
nil
{
glog
.
Error
(
err
)
}
else
{
break
}
}
}
}
func
copyLogFile
(
src
,
target
string
)
error
{
// If not a journald based distro, then just symlink files.
if
out
,
err
:=
exec
.
Command
(
"sudo"
,
"cp"
,
src
,
target
)
.
CombinedOutput
();
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to copy %q to %q: %v, %v"
,
src
,
target
,
out
,
err
)
}
if
out
,
err
:=
exec
.
Command
(
"sudo"
,
"chmod"
,
"a+r"
,
target
)
.
CombinedOutput
();
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to make log file %q world readable: %v, %v"
,
target
,
out
,
err
)
}
return
nil
}
func
isJournaldAvailable
()
bool
{
_
,
err
:=
exec
.
LookPath
(
"journalctl"
)
return
err
==
nil
}
func
(
es
*
e2eService
)
stop
()
{
func
(
es
*
e2eService
)
stop
()
{
if
es
.
kubeletCmd
!=
nil
{
if
es
.
kubeletCmd
!=
nil
{
err
:=
es
.
kubeletCmd
.
Process
.
Kill
()
err
:=
es
.
kubeletCmd
.
Process
.
Kill
()
...
...
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