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
b1fa63df
Commit
b1fa63df
authored
Jul 28, 2022
by
Brad Davidson
Committed by
Brad Davidson
Aug 05, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Remove --docker/dockershim support"
This reverts commit
4a3d283b
. Signed-off-by:
Brad Davidson
<
brad.davidson@rancher.com
>
parent
cf665599
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
27 additions
and
12 deletions
+27
-12
config.go
pkg/agent/config/config.go
+3
-6
setup_test.go
pkg/agent/flannel/setup_test.go
+1
-1
run.go
pkg/agent/run.go
+1
-1
run_linux.go
pkg/agent/run_linux.go
+7
-1
run_windows.go
pkg/agent/run_windows.go
+10
-2
cgroups_linux.go
pkg/cgroups/cgroups_linux.go
+3
-0
agent.go
pkg/cli/cmds/agent.go
+1
-1
types.go
pkg/daemons/config/types.go
+1
-0
No files found.
pkg/agent/config/config.go
View file @
b1fa63df
...
@@ -321,10 +321,6 @@ func get(ctx context.Context, envInfo *cmds.Agent, proxy proxy.Proxy) (*config.N
...
@@ -321,10 +321,6 @@ func get(ctx context.Context, envInfo *cmds.Agent, proxy proxy.Proxy) (*config.N
logrus
.
SetLevel
(
logrus
.
DebugLevel
)
logrus
.
SetLevel
(
logrus
.
DebugLevel
)
}
}
if
envInfo
.
Docker
{
return
nil
,
errors
.
New
(
"--docker is no longer supported; to continue using docker, install cri-dockerd and set --container-runtime-endpoint"
)
}
info
,
err
:=
clientaccess
.
ParseAndValidateToken
(
proxy
.
SupervisorURL
(),
envInfo
.
Token
)
info
,
err
:=
clientaccess
.
ParseAndValidateToken
(
proxy
.
SupervisorURL
(),
envInfo
.
Token
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
@@ -437,6 +433,7 @@ func get(ctx context.Context, envInfo *cmds.Agent, proxy proxy.Proxy) (*config.N
...
@@ -437,6 +433,7 @@ func get(ctx context.Context, envInfo *cmds.Agent, proxy proxy.Proxy) (*config.N
}
}
nodeConfig
:=
&
config
.
Node
{
nodeConfig
:=
&
config
.
Node
{
Docker
:
envInfo
.
Docker
,
SELinux
:
envInfo
.
EnableSELinux
,
SELinux
:
envInfo
.
EnableSELinux
,
ContainerRuntimeEndpoint
:
envInfo
.
ContainerRuntimeEndpoint
,
ContainerRuntimeEndpoint
:
envInfo
.
ContainerRuntimeEndpoint
,
FlannelBackend
:
controlConfig
.
FlannelBackend
,
FlannelBackend
:
controlConfig
.
FlannelBackend
,
...
@@ -466,7 +463,7 @@ func get(ctx context.Context, envInfo *cmds.Agent, proxy proxy.Proxy) (*config.N
...
@@ -466,7 +463,7 @@ func get(ctx context.Context, envInfo *cmds.Agent, proxy proxy.Proxy) (*config.N
nodeConfig
.
AgentConfig
.
StrongSwanDir
=
filepath
.
Join
(
envInfo
.
DataDir
,
"agent"
,
"strongswan"
)
nodeConfig
.
AgentConfig
.
StrongSwanDir
=
filepath
.
Join
(
envInfo
.
DataDir
,
"agent"
,
"strongswan"
)
nodeConfig
.
Containerd
.
Config
=
filepath
.
Join
(
envInfo
.
DataDir
,
"agent"
,
"etc"
,
"containerd"
,
"config.toml"
)
nodeConfig
.
Containerd
.
Config
=
filepath
.
Join
(
envInfo
.
DataDir
,
"agent"
,
"etc"
,
"containerd"
,
"config.toml"
)
nodeConfig
.
Containerd
.
Root
=
filepath
.
Join
(
envInfo
.
DataDir
,
"agent"
,
"containerd"
)
nodeConfig
.
Containerd
.
Root
=
filepath
.
Join
(
envInfo
.
DataDir
,
"agent"
,
"containerd"
)
if
nodeConfig
.
ContainerRuntimeEndpoint
==
""
{
if
!
nodeConfig
.
Docker
&&
nodeConfig
.
ContainerRuntimeEndpoint
==
""
{
switch
nodeConfig
.
AgentConfig
.
Snapshotter
{
switch
nodeConfig
.
AgentConfig
.
Snapshotter
{
case
"overlayfs"
:
case
"overlayfs"
:
if
err
:=
containerd
.
OverlaySupported
(
nodeConfig
.
Containerd
.
Root
);
err
!=
nil
{
if
err
:=
containerd
.
OverlaySupported
(
nodeConfig
.
Containerd
.
Root
);
err
!=
nil
{
...
@@ -539,7 +536,7 @@ func get(ctx context.Context, envInfo *cmds.Agent, proxy proxy.Proxy) (*config.N
...
@@ -539,7 +536,7 @@ func get(ctx context.Context, envInfo *cmds.Agent, proxy proxy.Proxy) (*config.N
nodeConfig
.
AgentConfig
.
FlannelCniConfFile
=
envInfo
.
FlannelCniConfFile
nodeConfig
.
AgentConfig
.
FlannelCniConfFile
=
envInfo
.
FlannelCniConfFile
}
}
if
nodeConfig
.
ContainerRuntimeEndpoint
==
""
{
if
!
nodeConfig
.
Docker
&&
nodeConfig
.
ContainerRuntimeEndpoint
==
""
{
nodeConfig
.
AgentConfig
.
RuntimeSocket
=
nodeConfig
.
Containerd
.
Address
nodeConfig
.
AgentConfig
.
RuntimeSocket
=
nodeConfig
.
Containerd
.
Address
}
else
{
}
else
{
nodeConfig
.
AgentConfig
.
RuntimeSocket
=
nodeConfig
.
ContainerRuntimeEndpoint
nodeConfig
.
AgentConfig
.
RuntimeSocket
=
nodeConfig
.
ContainerRuntimeEndpoint
...
...
pkg/agent/flannel/setup_test.go
View file @
b1fa63df
...
@@ -62,7 +62,7 @@ func Test_createFlannelConf(t *testing.T) {
...
@@ -62,7 +62,7 @@ func Test_createFlannelConf(t *testing.T) {
var
agent
=
config
.
Agent
{}
var
agent
=
config
.
Agent
{}
agent
.
ClusterCIDR
=
stringToCIDR
(
tt
.
args
)[
0
]
agent
.
ClusterCIDR
=
stringToCIDR
(
tt
.
args
)[
0
]
agent
.
ClusterCIDRs
=
stringToCIDR
(
tt
.
args
)
agent
.
ClusterCIDRs
=
stringToCIDR
(
tt
.
args
)
var
nodeConfig
=
&
config
.
Node
{
ContainerRuntimeEndpoint
:
""
,
NoFlannel
:
false
,
SELinux
:
false
,
FlannelBackend
:
"vxlan"
,
FlannelConfFile
:
"test_file"
,
FlannelConfOverride
:
false
,
FlannelIface
:
nil
,
Containerd
:
containerd
,
Images
:
""
,
AgentConfig
:
agent
,
Token
:
""
,
Certificate
:
nil
,
ServerHTTPSPort
:
0
}
var
nodeConfig
=
&
config
.
Node
{
Docker
:
false
,
ContainerRuntimeEndpoint
:
""
,
NoFlannel
:
false
,
SELinux
:
false
,
FlannelBackend
:
"vxlan"
,
FlannelConfFile
:
"test_file"
,
FlannelConfOverride
:
false
,
FlannelIface
:
nil
,
Containerd
:
containerd
,
Images
:
""
,
AgentConfig
:
agent
,
Token
:
""
,
Certificate
:
nil
,
ServerHTTPSPort
:
0
}
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
if
err
:=
createFlannelConf
(
nodeConfig
);
(
err
!=
nil
)
!=
tt
.
wantErr
{
if
err
:=
createFlannelConf
(
nodeConfig
);
(
err
!=
nil
)
!=
tt
.
wantErr
{
...
...
pkg/agent/run.go
View file @
b1fa63df
...
@@ -101,7 +101,7 @@ func run(ctx context.Context, cfg cmds.Agent, proxy proxy.Proxy) error {
...
@@ -101,7 +101,7 @@ func run(ctx context.Context, cfg cmds.Agent, proxy proxy.Proxy) error {
}
}
}
}
if
nodeConfig
.
ContainerRuntimeEndpoint
==
""
{
if
!
nodeConfig
.
Docker
&&
nodeConfig
.
ContainerRuntimeEndpoint
==
""
{
if
err
:=
containerd
.
Run
(
ctx
,
nodeConfig
);
err
!=
nil
{
if
err
:=
containerd
.
Run
(
ctx
,
nodeConfig
);
err
!=
nil
{
return
err
return
err
}
}
...
...
pkg/agent/run_linux.go
View file @
b1fa63df
...
@@ -13,6 +13,7 @@ import (
...
@@ -13,6 +13,7 @@ import (
)
)
const
(
const
(
dockershimSock
=
"unix:///var/run/dockershim.sock"
containerdSock
=
"unix:///run/k3s/containerd/containerd.sock"
containerdSock
=
"unix:///run/k3s/containerd/containerd.sock"
)
)
...
@@ -21,7 +22,12 @@ const (
...
@@ -21,7 +22,12 @@ const (
func
setupCriCtlConfig
(
cfg
cmds
.
Agent
,
nodeConfig
*
config
.
Node
)
error
{
func
setupCriCtlConfig
(
cfg
cmds
.
Agent
,
nodeConfig
*
config
.
Node
)
error
{
cre
:=
nodeConfig
.
ContainerRuntimeEndpoint
cre
:=
nodeConfig
.
ContainerRuntimeEndpoint
if
cre
==
""
{
if
cre
==
""
{
cre
=
containerdSock
switch
{
case
cfg
.
Docker
:
cre
=
dockershimSock
default
:
cre
=
containerdSock
}
}
}
agentConfDir
:=
filepath
.
Join
(
cfg
.
DataDir
,
"agent"
,
"etc"
)
agentConfDir
:=
filepath
.
Join
(
cfg
.
DataDir
,
"agent"
,
"etc"
)
...
...
pkg/agent/run_windows.go
View file @
b1fa63df
...
@@ -7,12 +7,14 @@ import (
...
@@ -7,12 +7,14 @@ import (
"io/ioutil"
"io/ioutil"
"os"
"os"
"path/filepath"
"path/filepath"
"strings"
"github.com/k3s-io/k3s/pkg/cli/cmds"
"github.com/k3s-io/k3s/pkg/cli/cmds"
"github.com/k3s-io/k3s/pkg/daemons/config"
"github.com/k3s-io/k3s/pkg/daemons/config"
)
)
const
(
const
(
dockershimSock
=
"npipe:////./pipe/docker_engine"
containerdSock
=
"npipe:////./pipe/containerd-containerd"
containerdSock
=
"npipe:////./pipe/containerd-containerd"
)
)
...
@@ -20,10 +22,16 @@ const (
...
@@ -20,10 +22,16 @@ const (
// with the given data from config.
// with the given data from config.
func
setupCriCtlConfig
(
cfg
cmds
.
Agent
,
nodeConfig
*
config
.
Node
)
error
{
func
setupCriCtlConfig
(
cfg
cmds
.
Agent
,
nodeConfig
*
config
.
Node
)
error
{
cre
:=
nodeConfig
.
ContainerRuntimeEndpoint
cre
:=
nodeConfig
.
ContainerRuntimeEndpoint
if
cre
==
""
{
if
cre
==
""
||
strings
.
HasPrefix
(
cre
,
"npipe:"
)
{
switch
{
case
cfg
.
Docker
:
cre
=
dockershimSock
default
:
cre
=
containerdSock
}
}
else
{
cre
=
containerdSock
cre
=
containerdSock
}
}
agentConfDir
:=
filepath
.
Join
(
cfg
.
DataDir
,
"agent"
,
"etc"
)
agentConfDir
:=
filepath
.
Join
(
cfg
.
DataDir
,
"agent"
,
"etc"
)
if
_
,
err
:=
os
.
Stat
(
agentConfDir
);
os
.
IsNotExist
(
err
)
{
if
_
,
err
:=
os
.
Stat
(
agentConfDir
);
os
.
IsNotExist
(
err
)
{
if
err
:=
os
.
MkdirAll
(
agentConfDir
,
0700
);
err
!=
nil
{
if
err
:=
os
.
MkdirAll
(
agentConfDir
,
0700
);
err
!=
nil
{
...
...
pkg/cgroups/cgroups_linux.go
View file @
b1fa63df
...
@@ -109,6 +109,9 @@ func CheckCgroups() (kubeletRoot, runtimeRoot string, controllers map[string]boo
...
@@ -109,6 +109,9 @@ func CheckCgroups() (kubeletRoot, runtimeRoot string, controllers map[string]boo
// and thus need to set our kubelet root to something out of the context
// and thus need to set our kubelet root to something out of the context
// of `/user.slice` to ensure that `CPUAccounting` and `MemoryAccounting`
// of `/user.slice` to ensure that `CPUAccounting` and `MemoryAccounting`
// are enabled, as they are generally disabled by default for `user.slice`
// are enabled, as they are generally disabled by default for `user.slice`
// Note that we are not setting the `runtimeRoot` as if we are running with
// `--docker`, we will inadvertently move the cgroup `dockerd` lives in
// which is not ideal and causes dockerd to become unmanageable by systemd.
last
:=
parts
[
len
(
parts
)
-
1
]
last
:=
parts
[
len
(
parts
)
-
1
]
i
:=
strings
.
LastIndex
(
last
,
".scope"
)
i
:=
strings
.
LastIndex
(
last
,
".scope"
)
if
i
>
0
{
if
i
>
0
{
...
...
pkg/cli/cmds/agent.go
View file @
b1fa63df
...
@@ -123,7 +123,7 @@ var (
...
@@ -123,7 +123,7 @@ var (
}
}
PauseImageFlag
=
cli
.
StringFlag
{
PauseImageFlag
=
cli
.
StringFlag
{
Name
:
"pause-image"
,
Name
:
"pause-image"
,
Usage
:
"(agent/runtime) Customized pause image for containerd sandbox"
,
Usage
:
"(agent/runtime) Customized pause image for containerd
or docker
sandbox"
,
Destination
:
&
AgentConfig
.
PauseImage
,
Destination
:
&
AgentConfig
.
PauseImage
,
Value
:
DefaultPauseImage
,
Value
:
DefaultPauseImage
,
}
}
...
...
pkg/daemons/config/types.go
View file @
b1fa63df
...
@@ -43,6 +43,7 @@ var KubeletReservedPorts = map[string]bool{
...
@@ -43,6 +43,7 @@ var KubeletReservedPorts = map[string]bool{
}
}
type
Node
struct
{
type
Node
struct
{
Docker
bool
ContainerRuntimeEndpoint
string
ContainerRuntimeEndpoint
string
NoFlannel
bool
NoFlannel
bool
SELinux
bool
SELinux
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