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
06d8f5fe
Commit
06d8f5fe
authored
Aug 09, 2017
by
Lantao Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Admit sysctls for other runtime.
parent
190ee708
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
10 deletions
+18
-10
runtime.go
pkg/kubelet/sysctl/runtime.go
+18
-10
No files found.
pkg/kubelet/sysctl/runtime.go
View file @
06d8f5fe
...
@@ -31,6 +31,7 @@ const (
...
@@ -31,6 +31,7 @@ const (
dockerMinimumAPIVersion
=
"1.24.0"
dockerMinimumAPIVersion
=
"1.24.0"
dockerTypeName
=
"docker"
dockerTypeName
=
"docker"
rktTypeName
=
"rkt"
)
)
// TODO: The admission logic in this file is runtime-dependent. It should be
// TODO: The admission logic in this file is runtime-dependent. It should be
...
@@ -45,7 +46,8 @@ var _ lifecycle.PodAdmitHandler = &runtimeAdmitHandler{}
...
@@ -45,7 +46,8 @@ var _ lifecycle.PodAdmitHandler = &runtimeAdmitHandler{}
// NewRuntimeAdmitHandler returns a sysctlRuntimeAdmitHandler which checks whether
// NewRuntimeAdmitHandler returns a sysctlRuntimeAdmitHandler which checks whether
// the given runtime support sysctls.
// the given runtime support sysctls.
func
NewRuntimeAdmitHandler
(
runtime
container
.
Runtime
)
(
*
runtimeAdmitHandler
,
error
)
{
func
NewRuntimeAdmitHandler
(
runtime
container
.
Runtime
)
(
*
runtimeAdmitHandler
,
error
)
{
if
runtime
.
Type
()
==
dockerTypeName
{
switch
runtime
.
Type
()
{
case
dockerTypeName
:
v
,
err
:=
runtime
.
APIVersion
()
v
,
err
:=
runtime
.
APIVersion
()
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"failed to get runtime version: %v"
,
err
)
return
nil
,
fmt
.
Errorf
(
"failed to get runtime version: %v"
,
err
)
...
@@ -70,16 +72,22 @@ func NewRuntimeAdmitHandler(runtime container.Runtime) (*runtimeAdmitHandler, er
...
@@ -70,16 +72,22 @@ func NewRuntimeAdmitHandler(runtime container.Runtime) (*runtimeAdmitHandler, er
Message
:
"Docker before 1.12 does not support sysctls"
,
Message
:
"Docker before 1.12 does not support sysctls"
,
},
},
},
nil
},
nil
case
rktTypeName
:
return
&
runtimeAdmitHandler
{
result
:
lifecycle
.
PodAdmitResult
{
Admit
:
false
,
Reason
:
UnsupportedReason
,
Message
:
"Rkt does not support sysctls"
,
},
},
nil
default
:
// Return admit for other runtimes.
return
&
runtimeAdmitHandler
{
result
:
lifecycle
.
PodAdmitResult
{
Admit
:
true
,
},
},
nil
}
}
// for other runtimes like rkt sysctls are not supported
return
&
runtimeAdmitHandler
{
result
:
lifecycle
.
PodAdmitResult
{
Admit
:
false
,
Reason
:
UnsupportedReason
,
Message
:
fmt
.
Sprintf
(
"runtime %v does not support sysctls"
,
runtime
.
Type
()),
},
},
nil
}
}
// Admit checks whether the runtime supports sysctls.
// Admit checks whether the runtime supports sysctls.
...
...
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