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
65833e42
Commit
65833e42
authored
May 18, 2015
by
Tim Hockin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename CapabilityType Capability
parent
fd22f48f
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
106 additions
and
106 deletions
+106
-106
v1beta1.json
api/swagger-spec/v1beta1.json
+4
-4
v1beta2.json
api/swagger-spec/v1beta2.json
+4
-4
v1beta3.json
api/swagger-spec/v1beta3.json
+4
-4
fuzzer.go
pkg/api/testing/fuzzer.go
+2
-2
types.go
pkg/api/types.go
+4
-4
conversion_generated.go
pkg/api/v1/conversion_generated.go
+8
-8
types.go
pkg/api/v1/types.go
+4
-4
conversion_test.go
pkg/api/v1beta1/conversion_test.go
+4
-4
defaults_test.go
pkg/api/v1beta1/defaults_test.go
+12
-12
types.go
pkg/api/v1beta1/types.go
+4
-4
conversion_test.go
pkg/api/v1beta2/conversion_test.go
+4
-4
defaults_test.go
pkg/api/v1beta2/defaults_test.go
+12
-12
types.go
pkg/api/v1beta2/types.go
+4
-4
conversion_generated.go
pkg/api/v1beta3/conversion_generated.go
+8
-8
conversion_test.go
pkg/api/v1beta3/conversion_test.go
+4
-4
defaults_test.go
pkg/api/v1beta3/defaults_test.go
+12
-12
types.go
pkg/api/v1beta3/types.go
+4
-4
validation_test.go
pkg/api/validation/validation_test.go
+2
-2
cap.go
pkg/kubelet/rkt/cap.go
+2
-2
provider.go
pkg/securitycontext/provider.go
+2
-2
provider_test.go
pkg/securitycontext/provider_test.go
+2
-2
No files found.
api/swagger-spec/v1beta1.json
View file @
65833e42
...
...
@@ -8236,21 +8236,21 @@
"add"
:
{
"type"
:
"array"
,
"items"
:
{
"$ref"
:
"v1beta1.Capability
Type
"
"$ref"
:
"v1beta1.Capability"
},
"description"
:
"added capabilities"
},
"drop"
:
{
"type"
:
"array"
,
"items"
:
{
"$ref"
:
"v1beta1.Capability
Type
"
"$ref"
:
"v1beta1.Capability"
},
"description"
:
"droped capabilities"
}
}
},
"v1beta1.Capability
Type
"
:
{
"id"
:
"v1beta1.Capability
Type
"
,
"v1beta1.Capability"
:
{
"id"
:
"v1beta1.Capability"
,
"properties"
:
{}
},
"v1beta1.ComponentCondition"
:
{
...
...
api/swagger-spec/v1beta2.json
View file @
65833e42
...
...
@@ -8236,21 +8236,21 @@
"add"
:
{
"type"
:
"array"
,
"items"
:
{
"$ref"
:
"v1beta2.Capability
Type
"
"$ref"
:
"v1beta2.Capability"
},
"description"
:
"added capabilities"
},
"drop"
:
{
"type"
:
"array"
,
"items"
:
{
"$ref"
:
"v1beta2.Capability
Type
"
"$ref"
:
"v1beta2.Capability"
},
"description"
:
"droped capabilities"
}
}
},
"v1beta2.Capability
Type
"
:
{
"id"
:
"v1beta2.Capability
Type
"
,
"v1beta2.Capability"
:
{
"id"
:
"v1beta2.Capability"
,
"properties"
:
{}
},
"v1beta2.ComponentCondition"
:
{
...
...
api/swagger-spec/v1beta3.json
View file @
65833e42
...
...
@@ -9609,21 +9609,21 @@
"add"
:
{
"type"
:
"array"
,
"items"
:
{
"$ref"
:
"v1beta3.Capability
Type
"
"$ref"
:
"v1beta3.Capability"
},
"description"
:
"added capabilities"
},
"drop"
:
{
"type"
:
"array"
,
"items"
:
{
"$ref"
:
"v1beta3.Capability
Type
"
"$ref"
:
"v1beta3.Capability"
},
"description"
:
"droped capabilities"
}
}
},
"v1beta3.Capability
Type
"
:
{
"id"
:
"v1beta3.Capability
Type
"
,
"v1beta3.Capability"
:
{
"id"
:
"v1beta3.Capability"
,
"properties"
:
{}
},
"v1beta3.ComponentCondition"
:
{
...
...
pkg/api/testing/fuzzer.go
View file @
65833e42
...
...
@@ -209,8 +209,8 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer {
priv
:=
c
.
RandBool
()
sc
.
Privileged
=
&
priv
sc
.
Capabilities
=
&
api
.
Capabilities
{
Add
:
make
([]
api
.
Capability
Type
,
0
),
Drop
:
make
([]
api
.
Capability
Type
,
0
),
Add
:
make
([]
api
.
Capability
,
0
),
Drop
:
make
([]
api
.
Capability
,
0
),
}
c
.
Fuzz
(
&
sc
.
Capabilities
.
Add
)
c
.
Fuzz
(
&
sc
.
Capabilities
.
Drop
)
...
...
pkg/api/types.go
View file @
65833e42
...
...
@@ -582,15 +582,15 @@ const (
PullIfNotPresent
PullPolicy
=
"IfNotPresent"
)
// Capability
Type
represent POSIX capabilities type
type
Capability
Type
string
// Capability represent POSIX capabilities type
type
Capability
string
// Capabilities represent POSIX capabilities that can be added or removed to a running container.
type
Capabilities
struct
{
// Added capabilities
Add
[]
Capability
Type
`json:"add,omitempty"`
Add
[]
Capability
`json:"add,omitempty"`
// Removed capabilities
Drop
[]
Capability
Type
`json:"drop,omitempty"`
Drop
[]
Capability
`json:"drop,omitempty"`
}
// ResourceRequirements describes the compute resource requirements.
...
...
pkg/api/v1/conversion_generated.go
View file @
65833e42
...
...
@@ -84,17 +84,17 @@ func convert_v1_Capabilities_To_api_Capabilities(in *Capabilities, out *newer.Ca
defaulting
.
(
func
(
*
Capabilities
))(
in
)
}
if
in
.
Add
!=
nil
{
out
.
Add
=
make
([]
newer
.
Capability
Type
,
len
(
in
.
Add
))
out
.
Add
=
make
([]
newer
.
Capability
,
len
(
in
.
Add
))
for
i
:=
range
in
.
Add
{
out
.
Add
[
i
]
=
newer
.
Capability
Type
(
in
.
Add
[
i
])
out
.
Add
[
i
]
=
newer
.
Capability
(
in
.
Add
[
i
])
}
}
else
{
out
.
Add
=
nil
}
if
in
.
Drop
!=
nil
{
out
.
Drop
=
make
([]
newer
.
Capability
Type
,
len
(
in
.
Drop
))
out
.
Drop
=
make
([]
newer
.
Capability
,
len
(
in
.
Drop
))
for
i
:=
range
in
.
Drop
{
out
.
Drop
[
i
]
=
newer
.
Capability
Type
(
in
.
Drop
[
i
])
out
.
Drop
[
i
]
=
newer
.
Capability
(
in
.
Drop
[
i
])
}
}
else
{
out
.
Drop
=
nil
...
...
@@ -107,17 +107,17 @@ func convert_api_Capabilities_To_v1_Capabilities(in *newer.Capabilities, out *Ca
defaulting
.
(
func
(
*
newer
.
Capabilities
))(
in
)
}
if
in
.
Add
!=
nil
{
out
.
Add
=
make
([]
Capability
Type
,
len
(
in
.
Add
))
out
.
Add
=
make
([]
Capability
,
len
(
in
.
Add
))
for
i
:=
range
in
.
Add
{
out
.
Add
[
i
]
=
Capability
Type
(
in
.
Add
[
i
])
out
.
Add
[
i
]
=
Capability
(
in
.
Add
[
i
])
}
}
else
{
out
.
Add
=
nil
}
if
in
.
Drop
!=
nil
{
out
.
Drop
=
make
([]
Capability
Type
,
len
(
in
.
Drop
))
out
.
Drop
=
make
([]
Capability
,
len
(
in
.
Drop
))
for
i
:=
range
in
.
Drop
{
out
.
Drop
[
i
]
=
Capability
Type
(
in
.
Drop
[
i
])
out
.
Drop
[
i
]
=
Capability
(
in
.
Drop
[
i
])
}
}
else
{
out
.
Drop
=
nil
...
...
pkg/api/v1/types.go
View file @
65833e42
...
...
@@ -590,15 +590,15 @@ const (
PullIfNotPresent
PullPolicy
=
"IfNotPresent"
)
// Capability
Type
represent POSIX capabilities type
type
Capability
Type
string
// Capability represent POSIX capabilities type
type
Capability
string
// Capabilities represent POSIX capabilities that can be added or removed to a running container.
type
Capabilities
struct
{
// Added capabilities
Add
[]
Capability
Type
`json:"add,omitempty" description:"added capabilities"`
Add
[]
Capability
`json:"add,omitempty" description:"added capabilities"`
// Removed capabilities
Drop
[]
Capability
Type
`json:"drop,omitempty" description:"droped capabilities"`
Drop
[]
Capability
`json:"drop,omitempty" description:"droped capabilities"`
}
// ResourceRequirements describes the compute resource requirements.
...
...
pkg/api/v1beta1/conversion_test.go
View file @
65833e42
...
...
@@ -771,11 +771,11 @@ func TestBadSecurityContextConversion(t *testing.T) {
"mismatched caps add"
:
{
c
:
&
current
.
Container
{
Capabilities
:
current
.
Capabilities
{
Add
:
[]
current
.
Capability
Type
{
"foo"
},
Add
:
[]
current
.
Capability
{
"foo"
},
},
SecurityContext
:
&
current
.
SecurityContext
{
Capabilities
:
&
current
.
Capabilities
{
Add
:
[]
current
.
Capability
Type
{
"bar"
},
Add
:
[]
current
.
Capability
{
"bar"
},
},
},
},
...
...
@@ -784,11 +784,11 @@ func TestBadSecurityContextConversion(t *testing.T) {
"mismatched caps drop"
:
{
c
:
&
current
.
Container
{
Capabilities
:
current
.
Capabilities
{
Drop
:
[]
current
.
Capability
Type
{
"foo"
},
Drop
:
[]
current
.
Capability
{
"foo"
},
},
SecurityContext
:
&
current
.
SecurityContext
{
Capabilities
:
&
current
.
Capabilities
{
Drop
:
[]
current
.
Capability
Type
{
"bar"
},
Drop
:
[]
current
.
Capability
{
"bar"
},
},
},
},
...
...
pkg/api/v1beta1/defaults_test.go
View file @
65833e42
...
...
@@ -351,8 +351,8 @@ func TestSetDefaultSecurityContext(t *testing.T) {
c
:
current
.
Container
{
Privileged
:
false
,
Capabilities
:
current
.
Capabilities
{
Add
:
[]
current
.
Capability
Type
{
"foo"
},
Drop
:
[]
current
.
Capability
Type
{
"bar"
},
Add
:
[]
current
.
Capability
{
"foo"
},
Drop
:
[]
current
.
Capability
{
"bar"
},
},
SecurityContext
:
&
current
.
SecurityContext
{
Privileged
:
&
priv
,
...
...
@@ -363,13 +363,13 @@ func TestSetDefaultSecurityContext(t *testing.T) {
c
:
current
.
Container
{
Privileged
:
false
,
Capabilities
:
current
.
Capabilities
{
Add
:
[]
current
.
Capability
Type
{
"foo"
},
Drop
:
[]
current
.
Capability
Type
{
"bar"
},
Add
:
[]
current
.
Capability
{
"foo"
},
Drop
:
[]
current
.
Capability
{
"bar"
},
},
SecurityContext
:
&
current
.
SecurityContext
{
Capabilities
:
&
current
.
Capabilities
{
Add
:
[]
current
.
Capability
Type
{
"foo"
},
Drop
:
[]
current
.
Capability
Type
{
"bar"
},
Add
:
[]
current
.
Capability
{
"foo"
},
Drop
:
[]
current
.
Capability
{
"bar"
},
},
},
},
...
...
@@ -380,8 +380,8 @@ func TestSetDefaultSecurityContext(t *testing.T) {
SecurityContext
:
&
current
.
SecurityContext
{
Privileged
:
&
priv
,
Capabilities
:
&
current
.
Capabilities
{
Add
:
[]
current
.
Capability
Type
{
"biz"
},
Drop
:
[]
current
.
Capability
Type
{
"baz"
},
Add
:
[]
current
.
Capability
{
"biz"
},
Drop
:
[]
current
.
Capability
{
"baz"
},
},
},
},
...
...
@@ -389,14 +389,14 @@ func TestSetDefaultSecurityContext(t *testing.T) {
"upward defaulting priv"
:
{
c
:
current
.
Container
{
Capabilities
:
current
.
Capabilities
{
Add
:
[]
current
.
Capability
Type
{
"foo"
},
Drop
:
[]
current
.
Capability
Type
{
"bar"
},
Add
:
[]
current
.
Capability
{
"foo"
},
Drop
:
[]
current
.
Capability
{
"bar"
},
},
SecurityContext
:
&
current
.
SecurityContext
{
Privileged
:
&
privTrue
,
Capabilities
:
&
current
.
Capabilities
{
Add
:
[]
current
.
Capability
Type
{
"foo"
},
Drop
:
[]
current
.
Capability
Type
{
"bar"
},
Add
:
[]
current
.
Capability
{
"foo"
},
Drop
:
[]
current
.
Capability
{
"bar"
},
},
},
},
...
...
pkg/api/v1beta1/types.go
View file @
65833e42
...
...
@@ -481,15 +481,15 @@ const (
PullIfNotPresent
PullPolicy
=
"PullIfNotPresent"
)
// Capability
Type
represent POSIX capabilities type
type
Capability
Type
string
// Capability represent POSIX capabilities type
type
Capability
string
// Capabilities represent POSIX capabilities that can be added or removed to a running container.
type
Capabilities
struct
{
// Added capabilities
Add
[]
Capability
Type
`json:"add,omitempty" description:"added capabilities"`
Add
[]
Capability
`json:"add,omitempty" description:"added capabilities"`
// Removed capabilities
Drop
[]
Capability
Type
`json:"drop,omitempty" description:"droped capabilities"`
Drop
[]
Capability
`json:"drop,omitempty" description:"droped capabilities"`
}
type
ResourceRequirements
struct
{
...
...
pkg/api/v1beta2/conversion_test.go
View file @
65833e42
...
...
@@ -586,11 +586,11 @@ func TestBadSecurityContextConversion(t *testing.T) {
"mismatched caps add"
:
{
c
:
&
current
.
Container
{
Capabilities
:
current
.
Capabilities
{
Add
:
[]
current
.
Capability
Type
{
"foo"
},
Add
:
[]
current
.
Capability
{
"foo"
},
},
SecurityContext
:
&
current
.
SecurityContext
{
Capabilities
:
&
current
.
Capabilities
{
Add
:
[]
current
.
Capability
Type
{
"bar"
},
Add
:
[]
current
.
Capability
{
"bar"
},
},
},
},
...
...
@@ -599,11 +599,11 @@ func TestBadSecurityContextConversion(t *testing.T) {
"mismatched caps drop"
:
{
c
:
&
current
.
Container
{
Capabilities
:
current
.
Capabilities
{
Drop
:
[]
current
.
Capability
Type
{
"foo"
},
Drop
:
[]
current
.
Capability
{
"foo"
},
},
SecurityContext
:
&
current
.
SecurityContext
{
Capabilities
:
&
current
.
Capabilities
{
Drop
:
[]
current
.
Capability
Type
{
"bar"
},
Drop
:
[]
current
.
Capability
{
"bar"
},
},
},
},
...
...
pkg/api/v1beta2/defaults_test.go
View file @
65833e42
...
...
@@ -350,8 +350,8 @@ func TestSetDefaultSecurityContext(t *testing.T) {
c
:
current
.
Container
{
Privileged
:
false
,
Capabilities
:
current
.
Capabilities
{
Add
:
[]
current
.
Capability
Type
{
"foo"
},
Drop
:
[]
current
.
Capability
Type
{
"bar"
},
Add
:
[]
current
.
Capability
{
"foo"
},
Drop
:
[]
current
.
Capability
{
"bar"
},
},
SecurityContext
:
&
current
.
SecurityContext
{
Privileged
:
&
priv
,
...
...
@@ -362,13 +362,13 @@ func TestSetDefaultSecurityContext(t *testing.T) {
c
:
current
.
Container
{
Privileged
:
false
,
Capabilities
:
current
.
Capabilities
{
Add
:
[]
current
.
Capability
Type
{
"foo"
},
Drop
:
[]
current
.
Capability
Type
{
"bar"
},
Add
:
[]
current
.
Capability
{
"foo"
},
Drop
:
[]
current
.
Capability
{
"bar"
},
},
SecurityContext
:
&
current
.
SecurityContext
{
Capabilities
:
&
current
.
Capabilities
{
Add
:
[]
current
.
Capability
Type
{
"foo"
},
Drop
:
[]
current
.
Capability
Type
{
"bar"
},
Add
:
[]
current
.
Capability
{
"foo"
},
Drop
:
[]
current
.
Capability
{
"bar"
},
},
},
},
...
...
@@ -379,8 +379,8 @@ func TestSetDefaultSecurityContext(t *testing.T) {
SecurityContext
:
&
current
.
SecurityContext
{
Privileged
:
&
priv
,
Capabilities
:
&
current
.
Capabilities
{
Add
:
[]
current
.
Capability
Type
{
"biz"
},
Drop
:
[]
current
.
Capability
Type
{
"baz"
},
Add
:
[]
current
.
Capability
{
"biz"
},
Drop
:
[]
current
.
Capability
{
"baz"
},
},
},
},
...
...
@@ -388,14 +388,14 @@ func TestSetDefaultSecurityContext(t *testing.T) {
"upward defaulting priv"
:
{
c
:
current
.
Container
{
Capabilities
:
current
.
Capabilities
{
Add
:
[]
current
.
Capability
Type
{
"foo"
},
Drop
:
[]
current
.
Capability
Type
{
"bar"
},
Add
:
[]
current
.
Capability
{
"foo"
},
Drop
:
[]
current
.
Capability
{
"bar"
},
},
SecurityContext
:
&
current
.
SecurityContext
{
Privileged
:
&
privTrue
,
Capabilities
:
&
current
.
Capabilities
{
Add
:
[]
current
.
Capability
Type
{
"foo"
},
Drop
:
[]
current
.
Capability
Type
{
"bar"
},
Add
:
[]
current
.
Capability
{
"foo"
},
Drop
:
[]
current
.
Capability
{
"bar"
},
},
},
},
...
...
pkg/api/v1beta2/types.go
View file @
65833e42
...
...
@@ -466,17 +466,17 @@ const (
PullIfNotPresent
PullPolicy
=
"PullIfNotPresent"
)
// Capability
Type
represent POSIX capabilities type
type
Capability
Type
string
// Capability represent POSIX capabilities type
type
Capability
string
// Capabilities represent POSIX capabilities that can be added or removed to a running container.
//
// http://docs.k8s.io/containers.md#capabilities
type
Capabilities
struct
{
// Added capabilities
Add
[]
Capability
Type
`json:"add,omitempty" description:"added capabilities"`
Add
[]
Capability
`json:"add,omitempty" description:"added capabilities"`
// Removed capabilities
Drop
[]
Capability
Type
`json:"drop,omitempty" description:"droped capabilities"`
Drop
[]
Capability
`json:"drop,omitempty" description:"droped capabilities"`
}
type
ResourceRequirements
struct
{
...
...
pkg/api/v1beta3/conversion_generated.go
View file @
65833e42
...
...
@@ -84,17 +84,17 @@ func convert_api_Capabilities_To_v1beta3_Capabilities(in *newer.Capabilities, ou
defaulting
.
(
func
(
*
newer
.
Capabilities
))(
in
)
}
if
in
.
Add
!=
nil
{
out
.
Add
=
make
([]
Capability
Type
,
len
(
in
.
Add
))
out
.
Add
=
make
([]
Capability
,
len
(
in
.
Add
))
for
i
:=
range
in
.
Add
{
out
.
Add
[
i
]
=
Capability
Type
(
in
.
Add
[
i
])
out
.
Add
[
i
]
=
Capability
(
in
.
Add
[
i
])
}
}
else
{
out
.
Add
=
nil
}
if
in
.
Drop
!=
nil
{
out
.
Drop
=
make
([]
Capability
Type
,
len
(
in
.
Drop
))
out
.
Drop
=
make
([]
Capability
,
len
(
in
.
Drop
))
for
i
:=
range
in
.
Drop
{
out
.
Drop
[
i
]
=
Capability
Type
(
in
.
Drop
[
i
])
out
.
Drop
[
i
]
=
Capability
(
in
.
Drop
[
i
])
}
}
else
{
out
.
Drop
=
nil
...
...
@@ -107,17 +107,17 @@ func convert_v1beta3_Capabilities_To_api_Capabilities(in *Capabilities, out *new
defaulting
.
(
func
(
*
Capabilities
))(
in
)
}
if
in
.
Add
!=
nil
{
out
.
Add
=
make
([]
newer
.
Capability
Type
,
len
(
in
.
Add
))
out
.
Add
=
make
([]
newer
.
Capability
,
len
(
in
.
Add
))
for
i
:=
range
in
.
Add
{
out
.
Add
[
i
]
=
newer
.
Capability
Type
(
in
.
Add
[
i
])
out
.
Add
[
i
]
=
newer
.
Capability
(
in
.
Add
[
i
])
}
}
else
{
out
.
Add
=
nil
}
if
in
.
Drop
!=
nil
{
out
.
Drop
=
make
([]
newer
.
Capability
Type
,
len
(
in
.
Drop
))
out
.
Drop
=
make
([]
newer
.
Capability
,
len
(
in
.
Drop
))
for
i
:=
range
in
.
Drop
{
out
.
Drop
[
i
]
=
newer
.
Capability
Type
(
in
.
Drop
[
i
])
out
.
Drop
[
i
]
=
newer
.
Capability
(
in
.
Drop
[
i
])
}
}
else
{
out
.
Drop
=
nil
...
...
pkg/api/v1beta3/conversion_test.go
View file @
65833e42
...
...
@@ -67,11 +67,11 @@ func TestBadSecurityContextConversion(t *testing.T) {
"mismatched caps add"
:
{
c
:
&
current
.
Container
{
Capabilities
:
current
.
Capabilities
{
Add
:
[]
current
.
Capability
Type
{
"foo"
},
Add
:
[]
current
.
Capability
{
"foo"
},
},
SecurityContext
:
&
current
.
SecurityContext
{
Capabilities
:
&
current
.
Capabilities
{
Add
:
[]
current
.
Capability
Type
{
"bar"
},
Add
:
[]
current
.
Capability
{
"bar"
},
},
},
},
...
...
@@ -80,11 +80,11 @@ func TestBadSecurityContextConversion(t *testing.T) {
"mismatched caps drop"
:
{
c
:
&
current
.
Container
{
Capabilities
:
current
.
Capabilities
{
Drop
:
[]
current
.
Capability
Type
{
"foo"
},
Drop
:
[]
current
.
Capability
{
"foo"
},
},
SecurityContext
:
&
current
.
SecurityContext
{
Capabilities
:
&
current
.
Capabilities
{
Drop
:
[]
current
.
Capability
Type
{
"bar"
},
Drop
:
[]
current
.
Capability
{
"bar"
},
},
},
},
...
...
pkg/api/v1beta3/defaults_test.go
View file @
65833e42
...
...
@@ -360,8 +360,8 @@ func TestSetDefaultSecurityContext(t *testing.T) {
c
:
current
.
Container
{
Privileged
:
false
,
Capabilities
:
current
.
Capabilities
{
Add
:
[]
current
.
Capability
Type
{
"foo"
},
Drop
:
[]
current
.
Capability
Type
{
"bar"
},
Add
:
[]
current
.
Capability
{
"foo"
},
Drop
:
[]
current
.
Capability
{
"bar"
},
},
SecurityContext
:
&
current
.
SecurityContext
{
Privileged
:
&
priv
,
...
...
@@ -372,13 +372,13 @@ func TestSetDefaultSecurityContext(t *testing.T) {
c
:
current
.
Container
{
Privileged
:
false
,
Capabilities
:
current
.
Capabilities
{
Add
:
[]
current
.
Capability
Type
{
"foo"
},
Drop
:
[]
current
.
Capability
Type
{
"bar"
},
Add
:
[]
current
.
Capability
{
"foo"
},
Drop
:
[]
current
.
Capability
{
"bar"
},
},
SecurityContext
:
&
current
.
SecurityContext
{
Capabilities
:
&
current
.
Capabilities
{
Add
:
[]
current
.
Capability
Type
{
"foo"
},
Drop
:
[]
current
.
Capability
Type
{
"bar"
},
Add
:
[]
current
.
Capability
{
"foo"
},
Drop
:
[]
current
.
Capability
{
"bar"
},
},
},
},
...
...
@@ -389,8 +389,8 @@ func TestSetDefaultSecurityContext(t *testing.T) {
SecurityContext
:
&
current
.
SecurityContext
{
Privileged
:
&
priv
,
Capabilities
:
&
current
.
Capabilities
{
Add
:
[]
current
.
Capability
Type
{
"biz"
},
Drop
:
[]
current
.
Capability
Type
{
"baz"
},
Add
:
[]
current
.
Capability
{
"biz"
},
Drop
:
[]
current
.
Capability
{
"baz"
},
},
},
},
...
...
@@ -398,14 +398,14 @@ func TestSetDefaultSecurityContext(t *testing.T) {
"upward defaulting priv"
:
{
c
:
current
.
Container
{
Capabilities
:
current
.
Capabilities
{
Add
:
[]
current
.
Capability
Type
{
"foo"
},
Drop
:
[]
current
.
Capability
Type
{
"bar"
},
Add
:
[]
current
.
Capability
{
"foo"
},
Drop
:
[]
current
.
Capability
{
"bar"
},
},
SecurityContext
:
&
current
.
SecurityContext
{
Privileged
:
&
privTrue
,
Capabilities
:
&
current
.
Capabilities
{
Add
:
[]
current
.
Capability
Type
{
"foo"
},
Drop
:
[]
current
.
Capability
Type
{
"bar"
},
Add
:
[]
current
.
Capability
{
"foo"
},
Drop
:
[]
current
.
Capability
{
"bar"
},
},
},
},
...
...
pkg/api/v1beta3/types.go
View file @
65833e42
...
...
@@ -590,15 +590,15 @@ const (
PullIfNotPresent
PullPolicy
=
"IfNotPresent"
)
// Capability
Type
represent POSIX capabilities type
type
Capability
Type
string
// Capability represent POSIX capabilities type
type
Capability
string
// Capabilities represent POSIX capabilities that can be added or removed to a running container.
type
Capabilities
struct
{
// Added capabilities
Add
[]
Capability
Type
`json:"add,omitempty" description:"added capabilities"`
Add
[]
Capability
`json:"add,omitempty" description:"added capabilities"`
// Removed capabilities
Drop
[]
Capability
Type
`json:"drop,omitempty" description:"droped capabilities"`
Drop
[]
Capability
`json:"drop,omitempty" description:"droped capabilities"`
}
// ResourceRequirements describes the compute resource requirements.
...
...
pkg/api/validation/validation_test.go
View file @
65833e42
...
...
@@ -3175,8 +3175,8 @@ func TestValidateSecurityContext(t *testing.T) {
return
&
api
.
SecurityContext
{
Privileged
:
&
priv
,
Capabilities
:
&
api
.
Capabilities
{
Add
:
[]
api
.
Capability
Type
{
"foo"
},
Drop
:
[]
api
.
Capability
Type
{
"bar"
},
Add
:
[]
api
.
Capability
{
"foo"
},
Drop
:
[]
api
.
Capability
{
"bar"
},
},
SELinuxOptions
:
&
api
.
SELinuxOptions
{
User
:
"user"
,
...
...
pkg/kubelet/rkt/cap.go
View file @
65833e42
...
...
@@ -116,10 +116,10 @@ func getAllCapabilities() string {
return
strings
.
Join
(
capabilities
,
","
)
}
// TODO(yifan): This assumes that api.Capability
Type
has the form of
// TODO(yifan): This assumes that api.Capability has the form of
// "CAP_SYS_ADMIN". We need to have a formal definition for
// capabilities.
func
getCapabilities
(
caps
[]
api
.
Capability
Type
)
string
{
func
getCapabilities
(
caps
[]
api
.
Capability
)
string
{
var
capList
[]
string
for
_
,
cap
:=
range
caps
{
capList
=
append
(
capList
,
fmt
.
Sprintf
(
"%q"
,
cap
))
...
...
pkg/securitycontext/provider.go
View file @
65833e42
...
...
@@ -81,8 +81,8 @@ func modifySecurityOption(config []string, name, value string) []string {
return
config
}
// makeCapabilites creates string slices from Capability
Type
slices
func
makeCapabilites
(
capAdd
[]
api
.
Capability
Type
,
capDrop
[]
api
.
CapabilityType
)
([]
string
,
[]
string
)
{
// makeCapabilites creates string slices from Capability slices
func
makeCapabilites
(
capAdd
[]
api
.
Capability
,
capDrop
[]
api
.
Capability
)
([]
string
,
[]
string
)
{
var
(
addCaps
[]
string
dropCaps
[]
string
...
...
pkg/securitycontext/provider_test.go
View file @
65833e42
...
...
@@ -154,8 +154,8 @@ func fullValidSecurityContext() *api.SecurityContext {
return
&
api
.
SecurityContext
{
Privileged
:
&
priv
,
Capabilities
:
&
api
.
Capabilities
{
Add
:
[]
api
.
Capability
Type
{
"addCapA"
,
"addCapB"
},
Drop
:
[]
api
.
Capability
Type
{
"dropCapA"
,
"dropCapB"
},
Add
:
[]
api
.
Capability
{
"addCapA"
,
"addCapB"
},
Drop
:
[]
api
.
Capability
{
"dropCapA"
,
"dropCapB"
},
},
SELinuxOptions
:
&
api
.
SELinuxOptions
{
User
:
"user"
,
...
...
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