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
f1bf9bef
Unverified
Commit
f1bf9bef
authored
Nov 07, 2018
by
k8s-ci-robot
Committed by
GitHub
Nov 07, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #70678 from dashpole/fix_cgroup_manager
Fix slice sharing bug in cgroup manager
parents
ebcc2c7d
d4f6ae36
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
1 deletion
+29
-1
cgroup_manager_linux.go
pkg/kubelet/cm/cgroup_manager_linux.go
+4
-1
cgroup_manager_linux_test.go
pkg/kubelet/cm/cgroup_manager_linux_test.go
+25
-0
No files found.
pkg/kubelet/cm/cgroup_manager_linux.go
View file @
f1bf9bef
...
...
@@ -67,7 +67,10 @@ func NewCgroupName(base CgroupName, components ...string) CgroupName {
panic
(
fmt
.
Errorf
(
"invalid character in component [%q] of CgroupName"
,
component
))
}
}
return
CgroupName
(
append
(
base
,
components
...
))
// copy data from the base cgroup to eliminate cases where CgroupNames share underlying slices. See #68416
baseCopy
:=
make
([]
string
,
len
(
base
))
copy
(
baseCopy
,
base
)
return
CgroupName
(
append
(
baseCopy
,
components
...
))
}
func
escapeSystemdCgroupName
(
part
string
)
string
{
...
...
pkg/kubelet/cm/cgroup_manager_linux_test.go
View file @
f1bf9bef
...
...
@@ -20,9 +20,34 @@ package cm
import
(
"path"
"reflect"
"testing"
)
// TestNewCgroupName tests confirms that #68416 is fixed
func
TestNewCgroupName
(
t
*
testing
.
T
)
{
a
:=
ParseCgroupfsToCgroupName
(
"/a/"
)
ab
:=
NewCgroupName
(
a
,
"b"
)
expectedAB
:=
CgroupName
([]
string
{
"a"
,
""
,
"b"
})
if
!
reflect
.
DeepEqual
(
ab
,
expectedAB
)
{
t
.
Errorf
(
"Expected %d%+v; got %d%+v"
,
len
(
expectedAB
),
expectedAB
,
len
(
ab
),
ab
)
}
abc
:=
NewCgroupName
(
ab
,
"c"
)
expectedABC
:=
CgroupName
([]
string
{
"a"
,
""
,
"b"
,
"c"
})
if
!
reflect
.
DeepEqual
(
abc
,
expectedABC
)
{
t
.
Errorf
(
"Expected %d%+v; got %d%+v"
,
len
(
expectedABC
),
expectedABC
,
len
(
abc
),
abc
)
}
_
=
NewCgroupName
(
ab
,
"d"
)
if
!
reflect
.
DeepEqual
(
abc
,
expectedABC
)
{
t
.
Errorf
(
"Expected %d%+v; got %d%+v"
,
len
(
expectedABC
),
expectedABC
,
len
(
abc
),
abc
)
}
}
func
TestCgroupNameToSystemdBasename
(
t
*
testing
.
T
)
{
testCases
:=
[]
struct
{
input
CgroupName
...
...
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