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
fc8736fd
Commit
fc8736fd
authored
Aug 26, 2017
by
Pengfei Ni
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Admit NoNewPrivs for remote and rkt runtimes
parent
6368c1fc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
30 deletions
+19
-30
handlers.go
pkg/kubelet/lifecycle/handlers.go
+19
-30
No files found.
pkg/kubelet/lifecycle/handlers.go
View file @
fc8736fd
...
...
@@ -187,45 +187,34 @@ func (a *noNewPrivsAdmitHandler) Admit(attrs *PodAdmitAttributes) PodAdmitResult
return
PodAdmitResult
{
Admit
:
true
}
}
// Always admit
for remote runtime
.
if
a
.
Runtime
.
Type
()
==
kubetypes
.
Remote
ContainerRuntime
{
// Always admit
runtimes except docker
.
if
a
.
Runtime
.
Type
()
!=
kubetypes
.
Docker
ContainerRuntime
{
return
PodAdmitResult
{
Admit
:
true
}
}
// Make sure it is either docker or rkt runtimes.
if
a
.
Runtime
.
Type
()
!=
kubetypes
.
DockerContainerRuntime
&&
a
.
Runtime
.
Type
()
!=
kubetypes
.
RktContainerRuntime
{
// Make sure docker api version is valid.
rversion
,
err
:=
a
.
Runtime
.
APIVersion
()
if
err
!=
nil
{
return
PodAdmitResult
{
Admit
:
false
,
Reason
:
"NoNewPrivs"
,
Message
:
fmt
.
Sprintf
(
"Cannot enforce NoNewPrivs: %
s runtime not supported"
,
a
.
Runtime
.
Type
()
),
Message
:
fmt
.
Sprintf
(
"Cannot enforce NoNewPrivs: %
v"
,
err
),
}
}
if
a
.
Runtime
.
Type
()
==
kubetypes
.
DockerContainerRuntime
{
// Make sure docker api version is valid.
rversion
,
err
:=
a
.
Runtime
.
APIVersion
()
if
err
!=
nil
{
return
PodAdmitResult
{
Admit
:
false
,
Reason
:
"NoNewPrivs"
,
Message
:
fmt
.
Sprintf
(
"Cannot enforce NoNewPrivs: %v"
,
err
),
}
}
v
,
err
:=
rversion
.
Compare
(
"1.23.0"
)
if
err
!=
nil
{
return
PodAdmitResult
{
Admit
:
false
,
Reason
:
"NoNewPrivs"
,
Message
:
fmt
.
Sprintf
(
"Cannot enforce NoNewPrivs: %v"
,
err
),
}
v
,
err
:=
rversion
.
Compare
(
"1.23.0"
)
if
err
!=
nil
{
return
PodAdmitResult
{
Admit
:
false
,
Reason
:
"NoNewPrivs"
,
Message
:
fmt
.
Sprintf
(
"Cannot enforce NoNewPrivs: %v"
,
err
),
}
// If the version is less than 1.23 it will return -1 above.
if
v
==
-
1
{
return
PodAdmitResult
{
Admit
:
false
,
Reason
:
"NoNewPrivs"
,
Message
:
fmt
.
Sprintf
(
"Cannot enforce NoNewPrivs: docker runtime API version %q must be greater than or equal to 1.23"
,
rversion
.
String
())
,
}
}
// If the version is less than 1.23 it will return -1 above.
if
v
==
-
1
{
return
PodAdmitResult
{
Admit
:
false
,
Reason
:
"NoNewPrivs"
,
Message
:
fmt
.
Sprintf
(
"Cannot enforce NoNewPrivs: docker runtime API version %q must be greater than or equal to 1.23"
,
rversion
.
String
()),
}
}
...
...
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