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
4afc0c80
Commit
4afc0c80
authored
Jan 31, 2018
by
Derek Carr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kubelet ignores hugepages if hugetlb is not enabled
parent
853076a9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
11 deletions
+22
-11
cgroup_manager_linux.go
pkg/kubelet/cm/cgroup_manager_linux.go
+22
-11
No files found.
pkg/kubelet/cm/cgroup_manager_linux.go
View file @
4afc0c80
...
...
@@ -319,17 +319,18 @@ type subsystem interface {
GetStats
(
path
string
,
stats
*
libcontainercgroups
.
Stats
)
error
}
// getSupportedSubsystems returns
list of subsystems supported
func
getSupportedSubsystems
()
[]
subsystem
{
supportedSubsystems
:=
[]
subsystem
{
&
cgroupfs
.
MemoryGroup
{},
&
cgroupfs
.
CpuGroup
{},
// getSupportedSubsystems returns
a map of subsystem and if it must be mounted for the kubelet to function.
func
getSupportedSubsystems
()
map
[
subsystem
]
bool
{
supportedSubsystems
:=
map
[
subsystem
]
bool
{
&
cgroupfs
.
MemoryGroup
{}
:
true
,
&
cgroupfs
.
CpuGroup
{}
:
true
,
}
// not all hosts support hugetlb cgroup, and in the absent of hugetlb, we will fail silently by reporting no capacity.
if
utilfeature
.
DefaultFeatureGate
.
Enabled
(
kubefeatures
.
HugePages
)
{
supportedSubsystems
=
append
(
supportedSubsystems
,
&
cgroupfs
.
HugetlbGroup
{})
supportedSubsystems
[
&
cgroupfs
.
HugetlbGroup
{}]
=
false
}
if
utilfeature
.
DefaultFeatureGate
.
Enabled
(
kubefeatures
.
SupportPodPidsLimit
)
{
supportedSubsystems
=
append
(
supportedSubsystems
,
&
cgroupfs
.
PidsGroup
{})
supportedSubsystems
[
&
cgroupfs
.
PidsGroup
{}]
=
true
}
return
supportedSubsystems
}
...
...
@@ -344,9 +345,14 @@ func getSupportedSubsystems() []subsystem {
// but this is not possible with libcontainers Set() method
// See https://github.com/opencontainers/runc/issues/932
func
setSupportedSubsystems
(
cgroupConfig
*
libcontainerconfigs
.
Cgroup
)
error
{
for
_
,
sys
:=
range
getSupportedSubsystems
()
{
for
sys
,
required
:=
range
getSupportedSubsystems
()
{
if
_
,
ok
:=
cgroupConfig
.
Paths
[
sys
.
Name
()];
!
ok
{
return
fmt
.
Errorf
(
"Failed to find subsystem mount for subsystem: %v"
,
sys
.
Name
())
if
required
{
return
fmt
.
Errorf
(
"Failed to find subsystem mount for required subsystem: %v"
,
sys
.
Name
())
}
// the cgroup is not mounted, but its not required so continue...
glog
.
V
(
6
)
.
Infof
(
"Unable to find subsystem mount for optional subsystem: %v"
,
sys
.
Name
())
continue
}
if
err
:=
sys
.
Set
(
cgroupConfig
.
Paths
[
sys
.
Name
()],
cgroupConfig
);
err
!=
nil
{
return
fmt
.
Errorf
(
"Failed to set config for supported subsystems : %v"
,
err
)
...
...
@@ -563,9 +569,14 @@ func (m *cgroupManagerImpl) ReduceCPULimits(cgroupName CgroupName) error {
func
getStatsSupportedSubsystems
(
cgroupPaths
map
[
string
]
string
)
(
*
libcontainercgroups
.
Stats
,
error
)
{
stats
:=
libcontainercgroups
.
NewStats
()
for
_
,
sys
:=
range
getSupportedSubsystems
()
{
for
sys
,
required
:=
range
getSupportedSubsystems
()
{
if
_
,
ok
:=
cgroupPaths
[
sys
.
Name
()];
!
ok
{
return
nil
,
fmt
.
Errorf
(
"Failed to find subsystem mount for subsystem: %v"
,
sys
.
Name
())
if
required
{
return
nil
,
fmt
.
Errorf
(
"Failed to find subsystem mount for required subsystem: %v"
,
sys
.
Name
())
}
// the cgroup is not mounted, but its not required so continue...
glog
.
V
(
6
)
.
Infof
(
"Unable to find subsystem mount for optional subsystem: %v"
,
sys
.
Name
())
continue
}
if
err
:=
sys
.
GetStats
(
cgroupPaths
[
sys
.
Name
()],
stats
);
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"Failed to get stats for supported subsystems : %v"
,
err
)
...
...
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