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
6c7245d4
Commit
6c7245d4
authored
Jul 05, 2017
by
Di Xu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
validate cadvisor rootpath
parent
6fbc554c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
2 deletions
+28
-2
cadvisor_linux.go
pkg/kubelet/cadvisor/cadvisor_linux.go
+9
-0
kubelet.go
test/e2e_node/services/kubelet.go
+19
-2
No files found.
pkg/kubelet/cadvisor/cadvisor_linux.go
View file @
6c7245d4
...
@@ -23,6 +23,7 @@ import (
...
@@ -23,6 +23,7 @@ import (
"fmt"
"fmt"
"net"
"net"
"net/http"
"net/http"
"os"
"strconv"
"strconv"
"time"
"time"
...
@@ -105,6 +106,14 @@ func New(address string, port uint, runtime string, rootPath string) (Interface,
...
@@ -105,6 +106,14 @@ func New(address string, port uint, runtime string, rootPath string) (Interface,
return
nil
,
err
return
nil
,
err
}
}
if
_
,
err
:=
os
.
Stat
(
rootPath
);
err
!=
nil
{
if
os
.
IsNotExist
(
err
)
{
return
nil
,
fmt
.
Errorf
(
"rootDirectory %q does not exist"
,
rootPath
)
}
else
{
return
nil
,
fmt
.
Errorf
(
"failed to Stat %q: %v"
,
rootPath
,
err
)
}
}
cadvisorClient
:=
&
cadvisorClient
{
cadvisorClient
:=
&
cadvisorClient
{
runtime
:
runtime
,
runtime
:
runtime
,
rootPath
:
rootPath
,
rootPath
:
rootPath
,
...
...
test/e2e_node/services/kubelet.go
View file @
6c7245d4
...
@@ -81,8 +81,9 @@ func RunKubelet() {
...
@@ -81,8 +81,9 @@ func RunKubelet() {
const
(
const
(
// Ports of different e2e services.
// Ports of different e2e services.
kubeletPort
=
"10250"
kubeletPort
=
"10250"
kubeletReadOnlyPort
=
"10255"
kubeletReadOnlyPort
=
"10255"
kubeletRootDirectory
=
"/var/lib/kubelet"
// Health check url of kubelet
// Health check url of kubelet
kubeletHealthCheckURL
=
"http://127.0.0.1:"
+
kubeletReadOnlyPort
+
"/healthz"
kubeletHealthCheckURL
=
"http://127.0.0.1:"
+
kubeletReadOnlyPort
+
"/healthz"
)
)
...
@@ -104,6 +105,10 @@ func (e *E2EServices) startKubelet() (*server, error) {
...
@@ -104,6 +105,10 @@ func (e *E2EServices) startKubelet() (*server, error) {
return
nil
,
err
return
nil
,
err
}
}
e
.
rmDirs
=
append
(
e
.
rmDirs
,
manifestPath
)
e
.
rmDirs
=
append
(
e
.
rmDirs
,
manifestPath
)
err
=
createRootDirectory
(
kubeletRootDirectory
)
if
err
!=
nil
{
return
nil
,
err
}
var
killCommand
,
restartCommand
*
exec
.
Cmd
var
killCommand
,
restartCommand
*
exec
.
Cmd
var
isSystemd
bool
var
isSystemd
bool
// Apply default kubelet flags.
// Apply default kubelet flags.
...
@@ -139,6 +144,7 @@ func (e *E2EServices) startKubelet() (*server, error) {
...
@@ -139,6 +144,7 @@ func (e *E2EServices) startKubelet() (*server, error) {
"--address"
,
"0.0.0.0"
,
"--address"
,
"0.0.0.0"
,
"--port"
,
kubeletPort
,
"--port"
,
kubeletPort
,
"--read-only-port"
,
kubeletReadOnlyPort
,
"--read-only-port"
,
kubeletReadOnlyPort
,
"--root-dir"
,
kubeletRootDirectory
,
"--volume-stats-agg-period"
,
"10s"
,
// Aggregate volumes frequently so tests don't need to wait as long
"--volume-stats-agg-period"
,
"10s"
,
// Aggregate volumes frequently so tests don't need to wait as long
"--allow-privileged"
,
"true"
,
"--allow-privileged"
,
"true"
,
"--serialize-image-pulls"
,
"false"
,
"--serialize-image-pulls"
,
"false"
,
...
@@ -237,6 +243,17 @@ current-context: local-context`)
...
@@ -237,6 +243,17 @@ current-context: local-context`)
return
nil
return
nil
}
}
func
createRootDirectory
(
path
string
)
error
{
if
_
,
err
:=
os
.
Stat
(
path
);
err
!=
nil
{
if
os
.
IsNotExist
(
err
)
{
return
os
.
MkdirAll
(
path
,
os
.
FileMode
(
0755
))
}
else
{
return
err
}
}
return
nil
}
func
kubeconfigCWDPath
()
(
string
,
error
)
{
func
kubeconfigCWDPath
()
(
string
,
error
)
{
cwd
,
err
:=
os
.
Getwd
()
cwd
,
err
:=
os
.
Getwd
()
if
err
!=
nil
{
if
err
!=
nil
{
...
...
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