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
ca7be7dc
Commit
ca7be7dc
authored
Jun 06, 2016
by
Dr. Stefan Schimanski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add e2e tests for seccomp
parent
12346d51
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
2 deletions
+34
-2
security_context.go
test/e2e/security_context.go
+34
-2
No files found.
test/e2e/security_context.go
View file @
ca7be7dc
...
@@ -37,8 +37,9 @@ func scTestPod(hostIPC bool, hostPID bool) *api.Pod {
...
@@ -37,8 +37,9 @@ func scTestPod(hostIPC bool, hostPID bool) *api.Pod {
podName
:=
"security-context-"
+
string
(
util
.
NewUUID
())
podName
:=
"security-context-"
+
string
(
util
.
NewUUID
())
pod
:=
&
api
.
Pod
{
pod
:=
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
podName
,
Name
:
podName
,
Labels
:
map
[
string
]
string
{
"name"
:
podName
},
Labels
:
map
[
string
]
string
{
"name"
:
podName
},
Annotations
:
map
[
string
]
string
{},
},
},
Spec
:
api
.
PodSpec
{
Spec
:
api
.
PodSpec
{
SecurityContext
:
&
api
.
PodSecurityContext
{
SecurityContext
:
&
api
.
PodSecurityContext
{
...
@@ -106,6 +107,37 @@ var _ = framework.KubeDescribe("Security Context [Feature:SecurityContext]", fun
...
@@ -106,6 +107,37 @@ var _ = framework.KubeDescribe("Security Context [Feature:SecurityContext]", fun
testPodSELinuxLabeling
(
f
,
false
,
true
)
testPodSELinuxLabeling
(
f
,
false
,
true
)
})
})
It
(
"should support seccomp alpha unconfined annotation on the container [Feature:Seccomp]"
,
func
()
{
// TODO: port to SecurityContext as soon as seccomp is out of alpha
pod
:=
scTestPod
(
false
,
false
)
pod
.
Annotations
[
"container.seccomp.security.alpha.kubernetes.io/test-container"
]
=
"unconfined"
pod
.
Annotations
[
"seccomp.security.alpha.kubernetes.io/pod"
]
=
"docker/default"
pod
.
Spec
.
Containers
[
0
]
.
Command
=
[]
string
{
"grep"
,
"ecc"
,
"/proc/self/status"
}
f
.
TestContainerOutput
(
"pod.Spec.SecurityContext.Seccomp"
,
pod
,
0
,
[]
string
{
"0"
})
// seccomp disabled
})
It
(
"should support seccomp alpha unconfined annotation on the pod [Feature:Seccomp]"
,
func
()
{
// TODO: port to SecurityContext as soon as seccomp is out of alpha
pod
:=
scTestPod
(
false
,
false
)
pod
.
Annotations
[
"seccomp.security.alpha.kubernetes.io/pod"
]
=
"unconfined"
pod
.
Spec
.
Containers
[
0
]
.
Command
=
[]
string
{
"grep"
,
"ecc"
,
"/proc/self/status"
}
f
.
TestContainerOutput
(
"pod.Spec.SecurityContext.Seccomp"
,
pod
,
0
,
[]
string
{
"0"
})
// seccomp disabled
})
It
(
"should support seccomp alpha docker/default annotation [Feature:Seccomp]"
,
func
()
{
// TODO: port to SecurityContext as soon as seccomp is out of alpha
pod
:=
scTestPod
(
false
,
false
)
pod
.
Annotations
[
"container.seccomp.security.alpha.kubernetes.io/test-container"
]
=
"docker/default"
pod
.
Spec
.
Containers
[
0
]
.
Command
=
[]
string
{
"grep"
,
"ecc"
,
"/proc/self/status"
}
f
.
TestContainerOutput
(
"pod.Spec.SecurityContext.Seccomp"
,
pod
,
0
,
[]
string
{
"2"
})
// seccomp filtered
})
It
(
"should support seccomp default which is unconfined [Feature:Seccomp]"
,
func
()
{
// TODO: port to SecurityContext as soon as seccomp is out of alpha
pod
:=
scTestPod
(
false
,
false
)
pod
.
Spec
.
Containers
[
0
]
.
Command
=
[]
string
{
"grep"
,
"ecc"
,
"/proc/self/status"
}
f
.
TestContainerOutput
(
"pod.Spec.SecurityContext.Seccomp"
,
pod
,
0
,
[]
string
{
"0"
})
// seccomp disabled
})
})
})
func
testPodSELinuxLabeling
(
f
*
framework
.
Framework
,
hostIPC
bool
,
hostPID
bool
)
{
func
testPodSELinuxLabeling
(
f
*
framework
.
Framework
,
hostIPC
bool
,
hostPID
bool
)
{
...
...
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