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
6de7e3f3
Commit
6de7e3f3
authored
Jun 20, 2017
by
NickrenREN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make different container runtimes constant
parent
46fe7f06
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
7 deletions
+12
-7
server.go
cmd/kubelet/app/server.go
+1
-1
kubelet.go
pkg/kubelet/kubelet.go
+5
-5
constants.go
pkg/kubelet/types/constants.go
+5
-0
hollow_kubelet.go
pkg/kubemark/hollow_kubelet.go
+1
-1
No files found.
cmd/kubelet/app/server.go
View file @
6de7e3f3
...
@@ -147,7 +147,7 @@ func UnsecuredKubeletDeps(s *options.KubeletServer) (*kubelet.KubeletDeps, error
...
@@ -147,7 +147,7 @@ func UnsecuredKubeletDeps(s *options.KubeletServer) (*kubelet.KubeletDeps, error
}
}
var
dockerClient
libdocker
.
Interface
var
dockerClient
libdocker
.
Interface
if
s
.
ContainerRuntime
==
"docker"
{
if
s
.
ContainerRuntime
==
kubetypes
.
DockerContainerRuntime
{
dockerClient
=
libdocker
.
ConnectToDockerOrDie
(
s
.
DockerEndpoint
,
s
.
RuntimeRequestTimeout
.
Duration
,
dockerClient
=
libdocker
.
ConnectToDockerOrDie
(
s
.
DockerEndpoint
,
s
.
RuntimeRequestTimeout
.
Duration
,
s
.
ImagePullProgressDeadline
.
Duration
)
s
.
ImagePullProgressDeadline
.
Duration
)
}
else
{
}
else
{
...
...
pkg/kubelet/kubelet.go
View file @
6de7e3f3
...
@@ -564,7 +564,7 @@ func NewMainKubelet(kubeCfg *componentconfig.KubeletConfiguration, kubeDeps *Kub
...
@@ -564,7 +564,7 @@ func NewMainKubelet(kubeCfg *componentconfig.KubeletConfiguration, kubeDeps *Kub
pluginSettings
.
LegacyRuntimeHost
=
nl
pluginSettings
.
LegacyRuntimeHost
=
nl
// rktnetes cannot be run with CRI.
// rktnetes cannot be run with CRI.
if
kubeCfg
.
ContainerRuntime
!=
"rkt"
{
if
kubeCfg
.
ContainerRuntime
!=
kubetypes
.
RktContainerRuntime
{
// kubelet defers to the runtime shim to setup networking. Setting
// kubelet defers to the runtime shim to setup networking. Setting
// this to nil will prevent it from trying to invoke the plugin.
// this to nil will prevent it from trying to invoke the plugin.
// It's easier to always probe and initialize plugins till cri
// It's easier to always probe and initialize plugins till cri
...
@@ -572,7 +572,7 @@ func NewMainKubelet(kubeCfg *componentconfig.KubeletConfiguration, kubeDeps *Kub
...
@@ -572,7 +572,7 @@ func NewMainKubelet(kubeCfg *componentconfig.KubeletConfiguration, kubeDeps *Kub
klet
.
networkPlugin
=
nil
klet
.
networkPlugin
=
nil
switch
kubeCfg
.
ContainerRuntime
{
switch
kubeCfg
.
ContainerRuntime
{
case
"docker"
:
case
kubetypes
.
DockerContainerRuntime
:
// Create and start the CRI shim running as a grpc server.
// Create and start the CRI shim running as a grpc server.
streamingConfig
:=
getStreamingConfig
(
kubeCfg
,
kubeDeps
)
streamingConfig
:=
getStreamingConfig
(
kubeCfg
,
kubeDeps
)
ds
,
err
:=
dockershim
.
NewDockerService
(
kubeDeps
.
DockerClient
,
kubeCfg
.
SeccompProfileRoot
,
crOptions
.
PodSandboxImage
,
ds
,
err
:=
dockershim
.
NewDockerService
(
kubeDeps
.
DockerClient
,
kubeCfg
.
SeccompProfileRoot
,
crOptions
.
PodSandboxImage
,
...
@@ -606,7 +606,7 @@ func NewMainKubelet(kubeCfg *componentconfig.KubeletConfiguration, kubeDeps *Kub
...
@@ -606,7 +606,7 @@ func NewMainKubelet(kubeCfg *componentconfig.KubeletConfiguration, kubeDeps *Kub
if
!
supported
{
if
!
supported
{
klet
.
dockerLegacyService
=
dockershim
.
NewDockerLegacyService
(
kubeDeps
.
DockerClient
)
klet
.
dockerLegacyService
=
dockershim
.
NewDockerLegacyService
(
kubeDeps
.
DockerClient
)
}
}
case
"remote"
:
case
kubetypes
.
RemoteContainerRuntime
:
// No-op.
// No-op.
break
break
default
:
default
:
...
@@ -814,7 +814,7 @@ func NewMainKubelet(kubeCfg *componentconfig.KubeletConfiguration, kubeDeps *Kub
...
@@ -814,7 +814,7 @@ func NewMainKubelet(kubeCfg *componentconfig.KubeletConfiguration, kubeDeps *Kub
klet
.
appArmorValidator
=
apparmor
.
NewValidator
(
kubeCfg
.
ContainerRuntime
)
klet
.
appArmorValidator
=
apparmor
.
NewValidator
(
kubeCfg
.
ContainerRuntime
)
klet
.
softAdmitHandlers
.
AddPodAdmitHandler
(
lifecycle
.
NewAppArmorAdmitHandler
(
klet
.
appArmorValidator
))
klet
.
softAdmitHandlers
.
AddPodAdmitHandler
(
lifecycle
.
NewAppArmorAdmitHandler
(
klet
.
appArmorValidator
))
if
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
Accelerators
)
{
if
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
Accelerators
)
{
if
kubeCfg
.
ContainerRuntime
==
"docker"
{
if
kubeCfg
.
ContainerRuntime
==
kubetypes
.
DockerContainerRuntime
{
if
klet
.
gpuManager
,
err
=
nvidia
.
NewNvidiaGPUManager
(
klet
,
kubeDeps
.
DockerClient
);
err
!=
nil
{
if
klet
.
gpuManager
,
err
=
nvidia
.
NewNvidiaGPUManager
(
klet
,
kubeDeps
.
DockerClient
);
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -2122,7 +2122,7 @@ func (kl *Kubelet) updateRuntimeUp() {
...
@@ -2122,7 +2122,7 @@ func (kl *Kubelet) updateRuntimeUp() {
}
}
// rkt uses the legacy, non-CRI integration. Don't check the runtime
// rkt uses the legacy, non-CRI integration. Don't check the runtime
// conditions for it.
// conditions for it.
if
kl
.
kubeletConfiguration
.
ContainerRuntime
!=
"rkt"
{
if
kl
.
kubeletConfiguration
.
ContainerRuntime
!=
kubetypes
.
RktContainerRuntime
{
if
s
==
nil
{
if
s
==
nil
{
glog
.
Errorf
(
"Container runtime status is nil"
)
glog
.
Errorf
(
"Container runtime status is nil"
)
return
return
...
...
pkg/kubelet/types/constants.go
View file @
6de7e3f3
...
@@ -19,4 +19,9 @@ package types
...
@@ -19,4 +19,9 @@ package types
const
(
const
(
// system default DNS resolver configuration
// system default DNS resolver configuration
ResolvConfDefault
=
"/etc/resolv.conf"
ResolvConfDefault
=
"/etc/resolv.conf"
// different container runtimes
DockerContainerRuntime
=
"docker"
RktContainerRuntime
=
"rkt"
RemoteContainerRuntime
=
"remote"
)
)
pkg/kubemark/hollow_kubelet.go
View file @
6de7e3f3
...
@@ -144,7 +144,7 @@ func GetHollowKubeletConfig(
...
@@ -144,7 +144,7 @@ func GetHollowKubeletConfig(
c
.
LowDiskSpaceThresholdMB
=
256
c
.
LowDiskSpaceThresholdMB
=
256
c
.
VolumeStatsAggPeriod
.
Duration
=
time
.
Minute
c
.
VolumeStatsAggPeriod
.
Duration
=
time
.
Minute
c
.
CgroupRoot
=
""
c
.
CgroupRoot
=
""
c
.
ContainerRuntime
=
"docker"
c
.
ContainerRuntime
=
kubetypes
.
DockerContainerRuntime
c
.
CPUCFSQuota
=
true
c
.
CPUCFSQuota
=
true
c
.
RuntimeCgroups
=
""
c
.
RuntimeCgroups
=
""
c
.
EnableControllerAttachDetach
=
false
c
.
EnableControllerAttachDetach
=
false
...
...
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