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
fb576f30
Commit
fb576f30
authored
Nov 13, 2015
by
Brendan Burns
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor an interface for style
parent
22e527fe
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
22 additions
and
15 deletions
+22
-15
container_manager_linux.go
pkg/kubelet/cm/container_manager_linux.go
+2
-0
fake_manager.go
pkg/kubelet/dockertools/fake_manager.go
+1
-1
manager.go
pkg/kubelet/dockertools/manager.go
+2
-2
kubelet.go
pkg/kubelet/kubelet.go
+1
-1
procfs.go
pkg/util/procfs/procfs.go
+4
-4
procfs_fake.go
pkg/util/procfs/procfs_fake.go
+5
-5
procfs_interface.go
pkg/util/procfs/procfs_interface.go
+2
-2
sysctl.go
pkg/util/sysctl/sysctl.go
+5
-0
No files found.
pkg/kubelet/cm/container_manager_linux.go
View file @
fb576f30
...
@@ -147,6 +147,8 @@ func setupKernelTunables(option KernelTunableBehavior) error {
...
@@ -147,6 +147,8 @@ func setupKernelTunables(option KernelTunableBehavior) error {
desiredState
:=
map
[
string
]
int
{
desiredState
:=
map
[
string
]
int
{
utilsysctl
.
VmOvercommitMemory
:
utilsysctl
.
VmOvercommitMemoryAlways
,
utilsysctl
.
VmOvercommitMemory
:
utilsysctl
.
VmOvercommitMemoryAlways
,
utilsysctl
.
VmPanicOnOOM
:
utilsysctl
.
VmPanicOnOOMInvokeOOMKiller
,
utilsysctl
.
VmPanicOnOOM
:
utilsysctl
.
VmPanicOnOOMInvokeOOMKiller
,
utilsysctl
.
KernelPanic
:
utilsysctl
.
KernelPanicRebootTimeout
,
utilsysctl
.
KernelPanicOnOops
:
utilsysctl
.
KernelPanicOnOopsAlways
,
}
}
errList
:=
[]
error
{}
errList
:=
[]
error
{}
...
...
pkg/kubelet/dockertools/fake_manager.go
View file @
fb576f30
...
@@ -44,7 +44,7 @@ func NewFakeDockerManager(
...
@@ -44,7 +44,7 @@ func NewFakeDockerManager(
httpClient
kubetypes
.
HttpGetter
,
imageBackOff
*
util
.
Backoff
)
*
DockerManager
{
httpClient
kubetypes
.
HttpGetter
,
imageBackOff
*
util
.
Backoff
)
*
DockerManager
{
fakeOOMAdjuster
:=
oom
.
NewFakeOOMAdjuster
()
fakeOOMAdjuster
:=
oom
.
NewFakeOOMAdjuster
()
fakeProcFs
:=
procfs
.
NewFakeProcF
s
()
fakeProcFs
:=
procfs
.
NewFakeProcF
S
()
dm
:=
NewDockerManager
(
client
,
recorder
,
livenessManager
,
containerRefManager
,
machineInfo
,
podInfraContainerImage
,
qps
,
dm
:=
NewDockerManager
(
client
,
recorder
,
livenessManager
,
containerRefManager
,
machineInfo
,
podInfraContainerImage
,
qps
,
burst
,
containerLogsDir
,
osInterface
,
networkPlugin
,
generator
,
httpClient
,
&
NativeExecHandler
{},
burst
,
containerLogsDir
,
osInterface
,
networkPlugin
,
generator
,
httpClient
,
&
NativeExecHandler
{},
fakeOOMAdjuster
,
fakeProcFs
,
false
,
imageBackOff
,
true
)
fakeOOMAdjuster
,
fakeProcFs
,
false
,
imageBackOff
,
true
)
...
...
pkg/kubelet/dockertools/manager.go
View file @
fb576f30
...
@@ -133,7 +133,7 @@ type DockerManager struct {
...
@@ -133,7 +133,7 @@ type DockerManager struct {
oomAdjuster
*
oom
.
OOMAdjuster
oomAdjuster
*
oom
.
OOMAdjuster
// Get information from /proc mount.
// Get information from /proc mount.
procFs
procfs
.
ProcF
s
Interface
procFs
procfs
.
ProcF
S
Interface
// If true, enforce container cpu limits with CFS quota support
// If true, enforce container cpu limits with CFS quota support
cpuCFSQuota
bool
cpuCFSQuota
bool
...
@@ -158,7 +158,7 @@ func NewDockerManager(
...
@@ -158,7 +158,7 @@ func NewDockerManager(
httpClient
kubetypes
.
HttpGetter
,
httpClient
kubetypes
.
HttpGetter
,
execHandler
ExecHandler
,
execHandler
ExecHandler
,
oomAdjuster
*
oom
.
OOMAdjuster
,
oomAdjuster
*
oom
.
OOMAdjuster
,
procFs
procfs
.
ProcF
s
Interface
,
procFs
procfs
.
ProcF
S
Interface
,
cpuCFSQuota
bool
,
cpuCFSQuota
bool
,
imageBackOff
*
util
.
Backoff
,
imageBackOff
*
util
.
Backoff
,
serializeImagePulls
bool
)
*
DockerManager
{
serializeImagePulls
bool
)
*
DockerManager
{
...
...
pkg/kubelet/kubelet.go
View file @
fb576f30
...
@@ -320,7 +320,7 @@ func NewMainKubelet(
...
@@ -320,7 +320,7 @@ func NewMainKubelet(
return
nil
,
err
return
nil
,
err
}
}
procFs
:=
procfs
.
NewProcF
s
()
procFs
:=
procfs
.
NewProcF
S
()
imageBackOff
:=
util
.
NewBackOff
(
resyncInterval
,
MaxContainerBackOff
)
imageBackOff
:=
util
.
NewBackOff
(
resyncInterval
,
MaxContainerBackOff
)
klet
.
livenessManager
=
proberesults
.
NewManager
()
klet
.
livenessManager
=
proberesults
.
NewManager
()
...
...
pkg/util/procfs/procfs.go
View file @
fb576f30
...
@@ -24,10 +24,10 @@ import (
...
@@ -24,10 +24,10 @@ import (
"strings"
"strings"
)
)
type
ProcF
s
struct
{}
type
ProcF
S
struct
{}
func
NewProcF
s
()
ProcFs
Interface
{
func
NewProcF
S
()
ProcFS
Interface
{
return
&
ProcF
s
{}
return
&
ProcF
S
{}
}
}
func
containerNameFromProcCgroup
(
content
string
)
(
string
,
error
)
{
func
containerNameFromProcCgroup
(
content
string
)
(
string
,
error
)
{
...
@@ -44,7 +44,7 @@ func containerNameFromProcCgroup(content string) (string, error) {
...
@@ -44,7 +44,7 @@ func containerNameFromProcCgroup(content string) (string, error) {
// getFullContainerName gets the container name given the root process id of the container.
// getFullContainerName gets the container name given the root process id of the container.
// Eg. If the devices cgroup for the container is stored in /sys/fs/cgroup/devices/docker/nginx,
// Eg. If the devices cgroup for the container is stored in /sys/fs/cgroup/devices/docker/nginx,
// return docker/nginx. Assumes that the process is part of exactly one cgroup hierarchy.
// return docker/nginx. Assumes that the process is part of exactly one cgroup hierarchy.
func
(
pfs
*
ProcF
s
)
GetFullContainerName
(
pid
int
)
(
string
,
error
)
{
func
(
pfs
*
ProcF
S
)
GetFullContainerName
(
pid
int
)
(
string
,
error
)
{
filePath
:=
path
.
Join
(
"/proc"
,
strconv
.
Itoa
(
pid
),
"cgroup"
)
filePath
:=
path
.
Join
(
"/proc"
,
strconv
.
Itoa
(
pid
),
"cgroup"
)
content
,
err
:=
ioutil
.
ReadFile
(
filePath
)
content
,
err
:=
ioutil
.
ReadFile
(
filePath
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
pkg/util/procfs/procfs_fake.go
View file @
fb576f30
...
@@ -16,15 +16,15 @@ limitations under the License.
...
@@ -16,15 +16,15 @@ limitations under the License.
package
procfs
package
procfs
type
FakeProcF
s
struct
{}
type
FakeProcF
S
struct
{}
func
NewFakeProcF
s
()
ProcFs
Interface
{
func
NewFakeProcF
S
()
ProcFS
Interface
{
return
&
FakeProcF
s
{}
return
&
FakeProcF
S
{}
}
}
//
g
etFullContainerName gets the container name given the root process id of the container.
//
G
etFullContainerName gets the container name given the root process id of the container.
// Eg. If the devices cgroup for the container is stored in /sys/fs/cgroup/devices/docker/nginx,
// Eg. If the devices cgroup for the container is stored in /sys/fs/cgroup/devices/docker/nginx,
// return docker/nginx. Assumes that the process is part of exactly one cgroup hierarchy.
// return docker/nginx. Assumes that the process is part of exactly one cgroup hierarchy.
func
(
fakePfs
*
FakeProcF
s
)
GetFullContainerName
(
pid
int
)
(
string
,
error
)
{
func
(
fakePfs
*
FakeProcF
S
)
GetFullContainerName
(
pid
int
)
(
string
,
error
)
{
return
""
,
nil
return
""
,
nil
}
}
pkg/util/procfs/procfs_interface.go
View file @
fb576f30
...
@@ -16,7 +16,7 @@ limitations under the License.
...
@@ -16,7 +16,7 @@ limitations under the License.
package
procfs
package
procfs
type
ProcF
s
Interface
interface
{
type
ProcF
S
Interface
interface
{
//
g
etFullContainerName gets the container name given the root process id of the container.
//
G
etFullContainerName gets the container name given the root process id of the container.
GetFullContainerName
(
pid
int
)
(
string
,
error
)
GetFullContainerName
(
pid
int
)
(
string
,
error
)
}
}
pkg/util/sysctl/sysctl.go
View file @
fb576f30
...
@@ -27,9 +27,14 @@ const (
...
@@ -27,9 +27,14 @@ const (
sysctlBase
=
"/proc/sys"
sysctlBase
=
"/proc/sys"
VmOvercommitMemory
=
"vm/overcommit_memory"
VmOvercommitMemory
=
"vm/overcommit_memory"
VmPanicOnOOM
=
"vm/panic_on_oom"
VmPanicOnOOM
=
"vm/panic_on_oom"
KernelPanic
=
"kernel/panic"
KernelPanicOnOops
=
"kernel/panic_on_oops"
VmOvercommitMemoryAlways
=
1
// kernel performs no memory over-commit handling
VmOvercommitMemoryAlways
=
1
// kernel performs no memory over-commit handling
VmPanicOnOOMInvokeOOMKiller
=
0
// kernel calls the oom_killer function when OOM occurs
VmPanicOnOOMInvokeOOMKiller
=
0
// kernel calls the oom_killer function when OOM occurs
KernelPanicOnOopsAlways
=
1
// kernel panics on kernel oops
KernelPanicRebootTimeout
=
10
// seconds after a panic for the kernel to reboot
)
)
// GetSysctl returns the value for the specified sysctl setting
// GetSysctl returns the value for the specified sysctl setting
...
...
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