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
c759ef2b
Commit
c759ef2b
authored
Jun 17, 2015
by
Saad Ali
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9926 from bprashanth/kubelet_race
Fix benign data race in pod workers
parents
9ca9e436
de1f246e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
capabilities.go
pkg/capabilities/capabilities.go
+7
-0
No files found.
pkg/capabilities/capabilities.go
View file @
c759ef2b
...
@@ -29,7 +29,9 @@ type Capabilities struct {
...
@@ -29,7 +29,9 @@ type Capabilities struct {
HostNetworkSources
[]
string
HostNetworkSources
[]
string
}
}
// TODO: Clean these up into a singleton
var
once
sync
.
Once
var
once
sync
.
Once
var
lock
sync
.
Mutex
var
capabilities
*
Capabilities
var
capabilities
*
Capabilities
// Initialize the capability set. This can only be done once per binary, subsequent calls are ignored.
// Initialize the capability set. This can only be done once per binary, subsequent calls are ignored.
...
@@ -50,11 +52,16 @@ func Setup(allowPrivileged bool, hostNetworkSources []string) {
...
@@ -50,11 +52,16 @@ func Setup(allowPrivileged bool, hostNetworkSources []string) {
// SetCapabilitiesForTests. Convenience method for testing. This should only be called from tests.
// SetCapabilitiesForTests. Convenience method for testing. This should only be called from tests.
func
SetForTests
(
c
Capabilities
)
{
func
SetForTests
(
c
Capabilities
)
{
lock
.
Lock
()
defer
lock
.
Unlock
()
capabilities
=
&
c
capabilities
=
&
c
}
}
// Returns a read-only copy of the system capabilities.
// Returns a read-only copy of the system capabilities.
func
Get
()
Capabilities
{
func
Get
()
Capabilities
{
lock
.
Lock
()
defer
lock
.
Unlock
()
// This check prevents clobbering of capabilities that might've been set via SetForTests
if
capabilities
==
nil
{
if
capabilities
==
nil
{
Initialize
(
Capabilities
{
Initialize
(
Capabilities
{
AllowPrivileged
:
false
,
AllowPrivileged
:
false
,
...
...
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