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
dc5a4a8c
Commit
dc5a4a8c
authored
Sep 16, 2014
by
Brendan Burns
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor to clean up names.
parent
506f51b1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
10 additions
and
10 deletions
+10
-10
apiserver.go
cmd/apiserver/apiserver.go
+1
-1
kubelet.go
cmd/kubelet/kubelet.go
+1
-1
validation.go
pkg/api/validation/validation.go
+1
-1
validation_test.go
pkg/api/validation/validation_test.go
+2
-2
capabilities.go
pkg/capabilities/capabilities.go
+4
-4
kubelet.go
pkg/kubelet/kubelet.go
+1
-1
No files found.
cmd/apiserver/apiserver.go
View file @
dc5a4a8c
...
@@ -114,7 +114,7 @@ func main() {
...
@@ -114,7 +114,7 @@ func main() {
glog
.
Fatalf
(
"-etcd_servers flag is required."
)
glog
.
Fatalf
(
"-etcd_servers flag is required."
)
}
}
capabilities
.
Initialize
Capabilities
(
capabilities
.
Capabilities
{
capabilities
.
Initialize
(
capabilities
.
Capabilities
{
AllowPrivileged
:
*
allowPrivileged
,
AllowPrivileged
:
*
allowPrivileged
,
})
})
...
...
cmd/kubelet/kubelet.go
View file @
dc5a4a8c
...
@@ -105,7 +105,7 @@ func main() {
...
@@ -105,7 +105,7 @@ func main() {
etcd
.
SetLogger
(
util
.
NewLogger
(
"etcd "
))
etcd
.
SetLogger
(
util
.
NewLogger
(
"etcd "
))
capabilities
.
Initialize
Capabilities
(
capabilities
.
Capabilities
{
capabilities
.
Initialize
(
capabilities
.
Capabilities
{
AllowPrivileged
:
*
allowPrivileged
,
AllowPrivileged
:
*
allowPrivileged
,
})
})
...
...
pkg/api/validation/validation.go
View file @
dc5a4a8c
...
@@ -227,7 +227,7 @@ func validateContainers(containers []api.Container, volumes util.StringSet) errs
...
@@ -227,7 +227,7 @@ func validateContainers(containers []api.Container, volumes util.StringSet) errs
for
i
:=
range
containers
{
for
i
:=
range
containers
{
cErrs
:=
errs
.
ErrorList
{}
cErrs
:=
errs
.
ErrorList
{}
ctr
:=
&
containers
[
i
]
// so we can set default values
ctr
:=
&
containers
[
i
]
// so we can set default values
capabilities
:=
capabilities
.
Get
Capabilities
()
capabilities
:=
capabilities
.
Get
()
if
len
(
ctr
.
Name
)
==
0
{
if
len
(
ctr
.
Name
)
==
0
{
cErrs
=
append
(
cErrs
,
errs
.
NewFieldRequired
(
"name"
,
ctr
.
Name
))
cErrs
=
append
(
cErrs
,
errs
.
NewFieldRequired
(
"name"
,
ctr
.
Name
))
}
else
if
!
util
.
IsDNSLabel
(
ctr
.
Name
)
{
}
else
if
!
util
.
IsDNSLabel
(
ctr
.
Name
)
{
...
...
pkg/api/validation/validation_test.go
View file @
dc5a4a8c
...
@@ -180,7 +180,7 @@ func TestValidateVolumeMounts(t *testing.T) {
...
@@ -180,7 +180,7 @@ func TestValidateVolumeMounts(t *testing.T) {
func
TestValidateContainers
(
t
*
testing
.
T
)
{
func
TestValidateContainers
(
t
*
testing
.
T
)
{
volumes
:=
util
.
StringSet
{}
volumes
:=
util
.
StringSet
{}
capabilities
.
Set
Capabilities
ForTests
(
capabilities
.
Capabilities
{
capabilities
.
SetForTests
(
capabilities
.
Capabilities
{
AllowPrivileged
:
true
,
AllowPrivileged
:
true
,
})
})
...
@@ -203,7 +203,7 @@ func TestValidateContainers(t *testing.T) {
...
@@ -203,7 +203,7 @@ func TestValidateContainers(t *testing.T) {
t
.
Errorf
(
"expected success: %v"
,
errs
)
t
.
Errorf
(
"expected success: %v"
,
errs
)
}
}
capabilities
.
Set
Capabilities
ForTests
(
capabilities
.
Capabilities
{
capabilities
.
SetForTests
(
capabilities
.
Capabilities
{
AllowPrivileged
:
false
,
AllowPrivileged
:
false
,
})
})
errorCases
:=
map
[
string
][]
api
.
Container
{
errorCases
:=
map
[
string
][]
api
.
Container
{
...
...
pkg/capabilities/capabilities.go
View file @
dc5a4a8c
...
@@ -30,7 +30,7 @@ var once sync.Once
...
@@ -30,7 +30,7 @@ var once sync.Once
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.
func
Initialize
Capabilities
(
c
Capabilities
)
{
func
Initialize
(
c
Capabilities
)
{
// Only do this once
// Only do this once
once
.
Do
(
func
()
{
once
.
Do
(
func
()
{
capabilities
=
&
c
capabilities
=
&
c
...
@@ -38,14 +38,14 @@ func InitializeCapabilities(c Capabilities) {
...
@@ -38,14 +38,14 @@ func InitializeCapabilities(c Capabilities) {
}
}
// 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
Set
Capabilities
ForTests
(
c
Capabilities
)
{
func
SetForTests
(
c
Capabilities
)
{
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
()
Capabilities
{
func
Get
()
Capabilities
{
if
capabilities
==
nil
{
if
capabilities
==
nil
{
Initialize
Capabilities
(
Capabilities
{
Initialize
(
Capabilities
{
AllowPrivileged
:
false
,
AllowPrivileged
:
false
,
})
})
}
}
...
...
pkg/kubelet/kubelet.go
View file @
dc5a4a8c
...
@@ -337,7 +337,7 @@ func (kl *Kubelet) runContainer(pod *Pod, container *api.Container, podVolumes v
...
@@ -337,7 +337,7 @@ func (kl *Kubelet) runContainer(pod *Pod, container *api.Container, podVolumes v
return
""
,
err
return
""
,
err
}
}
privileged
:=
false
privileged
:=
false
if
capabilities
.
Get
Capabilities
()
.
AllowPrivileged
{
if
capabilities
.
Get
()
.
AllowPrivileged
{
privileged
=
container
.
Privileged
privileged
=
container
.
Privileged
}
else
if
container
.
Privileged
{
}
else
if
container
.
Privileged
{
return
""
,
fmt
.
Errorf
(
"Container requested privileged mode, but it is disallowed globally."
)
return
""
,
fmt
.
Errorf
(
"Container requested privileged mode, but it is disallowed globally."
)
...
...
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