mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
Remove --docker/dockershim support
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
This commit is contained in:
parent
360f18d1cf
commit
4a3d283bc1
@ -321,6 +321,10 @@ func get(ctx context.Context, envInfo *cmds.Agent, proxy proxy.Proxy) (*config.N
|
||||
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)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -433,7 +437,6 @@ func get(ctx context.Context, envInfo *cmds.Agent, proxy proxy.Proxy) (*config.N
|
||||
}
|
||||
|
||||
nodeConfig := &config.Node{
|
||||
Docker: envInfo.Docker,
|
||||
SELinux: envInfo.EnableSELinux,
|
||||
ContainerRuntimeEndpoint: envInfo.ContainerRuntimeEndpoint,
|
||||
FlannelBackend: controlConfig.FlannelBackend,
|
||||
@ -462,7 +465,7 @@ func get(ctx context.Context, envInfo *cmds.Agent, proxy proxy.Proxy) (*config.N
|
||||
nodeConfig.AgentConfig.StrongSwanDir = filepath.Join(envInfo.DataDir, "agent", "strongswan")
|
||||
nodeConfig.Containerd.Config = filepath.Join(envInfo.DataDir, "agent", "etc", "containerd", "config.toml")
|
||||
nodeConfig.Containerd.Root = filepath.Join(envInfo.DataDir, "agent", "containerd")
|
||||
if !nodeConfig.Docker && nodeConfig.ContainerRuntimeEndpoint == "" {
|
||||
if nodeConfig.ContainerRuntimeEndpoint == "" {
|
||||
switch nodeConfig.AgentConfig.Snapshotter {
|
||||
case "overlayfs":
|
||||
if err := containerd.OverlaySupported(nodeConfig.Containerd.Root); err != nil {
|
||||
@ -531,7 +534,7 @@ func get(ctx context.Context, envInfo *cmds.Agent, proxy proxy.Proxy) (*config.N
|
||||
nodeConfig.AgentConfig.CNIConfDir = filepath.Join(envInfo.DataDir, "agent", "etc", "cni", "net.d")
|
||||
}
|
||||
|
||||
if !nodeConfig.Docker && nodeConfig.ContainerRuntimeEndpoint == "" {
|
||||
if nodeConfig.ContainerRuntimeEndpoint == "" {
|
||||
nodeConfig.AgentConfig.RuntimeSocket = nodeConfig.Containerd.Address
|
||||
} else {
|
||||
nodeConfig.AgentConfig.RuntimeSocket = nodeConfig.ContainerRuntimeEndpoint
|
||||
|
@ -62,7 +62,7 @@ func Test_createFlannelConf(t *testing.T) {
|
||||
var agent = config.Agent{}
|
||||
agent.ClusterCIDR = stringToCIDR(tt.args)[0]
|
||||
agent.ClusterCIDRs = stringToCIDR(tt.args)
|
||||
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}
|
||||
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}
|
||||
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if err := createFlannelConf(nodeConfig); (err != nil) != tt.wantErr {
|
||||
|
@ -100,7 +100,7 @@ func run(ctx context.Context, cfg cmds.Agent, proxy proxy.Proxy) error {
|
||||
}
|
||||
}
|
||||
|
||||
if !nodeConfig.Docker && nodeConfig.ContainerRuntimeEndpoint == "" {
|
||||
if nodeConfig.ContainerRuntimeEndpoint == "" {
|
||||
if err := containerd.Run(ctx, nodeConfig); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -13,7 +13,6 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
dockershimSock = "unix:///var/run/dockershim.sock"
|
||||
containerdSock = "unix:///run/k3s/containerd/containerd.sock"
|
||||
)
|
||||
|
||||
@ -22,12 +21,7 @@ const (
|
||||
func setupCriCtlConfig(cfg cmds.Agent, nodeConfig *config.Node) error {
|
||||
cre := nodeConfig.ContainerRuntimeEndpoint
|
||||
if cre == "" {
|
||||
switch {
|
||||
case cfg.Docker:
|
||||
cre = dockershimSock
|
||||
default:
|
||||
cre = containerdSock
|
||||
}
|
||||
cre = containerdSock
|
||||
}
|
||||
|
||||
agentConfDir := filepath.Join(cfg.DataDir, "agent", "etc")
|
||||
|
@ -7,14 +7,12 @@ import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/k3s-io/k3s/pkg/cli/cmds"
|
||||
"github.com/k3s-io/k3s/pkg/daemons/config"
|
||||
)
|
||||
|
||||
const (
|
||||
dockershimSock = "npipe:////./pipe/docker_engine"
|
||||
containerdSock = "npipe:////./pipe/containerd-containerd"
|
||||
)
|
||||
|
||||
@ -22,16 +20,10 @@ const (
|
||||
// with the given data from config.
|
||||
func setupCriCtlConfig(cfg cmds.Agent, nodeConfig *config.Node) error {
|
||||
cre := nodeConfig.ContainerRuntimeEndpoint
|
||||
if cre == "" || strings.HasPrefix(cre, "npipe:") {
|
||||
switch {
|
||||
case cfg.Docker:
|
||||
cre = dockershimSock
|
||||
default:
|
||||
cre = containerdSock
|
||||
}
|
||||
} else {
|
||||
if cre == "" {
|
||||
cre = containerdSock
|
||||
}
|
||||
|
||||
agentConfDir := filepath.Join(cfg.DataDir, "agent", "etc")
|
||||
if _, err := os.Stat(agentConfDir); os.IsNotExist(err) {
|
||||
if err := os.MkdirAll(agentConfDir, 0700); err != nil {
|
||||
|
@ -109,9 +109,6 @@ func CheckCgroups() (kubeletRoot, runtimeRoot string, controllers map[string]boo
|
||||
// and thus need to set our kubelet root to something out of the context
|
||||
// of `/user.slice` to ensure that `CPUAccounting` and `MemoryAccounting`
|
||||
// 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]
|
||||
i := strings.LastIndex(last, ".scope")
|
||||
if i > 0 {
|
||||
|
@ -86,8 +86,9 @@ var (
|
||||
Destination: &AgentConfig.WithNodeID,
|
||||
}
|
||||
DockerFlag = cli.BoolFlag{
|
||||
Hidden: true,
|
||||
Name: "docker",
|
||||
Usage: "(agent/runtime) Use docker instead of containerd",
|
||||
Usage: "(deprecated) (agent/runtime) Use docker instead of containerd",
|
||||
Destination: &AgentConfig.Docker,
|
||||
}
|
||||
CRIEndpointFlag = cli.StringFlag{
|
||||
@ -109,7 +110,7 @@ var (
|
||||
}
|
||||
PauseImageFlag = cli.StringFlag{
|
||||
Name: "pause-image",
|
||||
Usage: "(agent/runtime) Customized pause image for containerd or docker sandbox",
|
||||
Usage: "(agent/runtime) Customized pause image for containerd sandbox",
|
||||
Destination: &AgentConfig.PauseImage,
|
||||
Value: DefaultPauseImage,
|
||||
}
|
||||
@ -185,14 +186,12 @@ var (
|
||||
SELinuxFlag = cli.BoolFlag{
|
||||
Name: "selinux",
|
||||
Usage: "(agent/node) Enable SELinux in containerd",
|
||||
Hidden: false,
|
||||
Destination: &AgentConfig.EnableSELinux,
|
||||
EnvVar: version.ProgramUpper + "_SELINUX",
|
||||
}
|
||||
LBServerPortFlag = cli.IntFlag{
|
||||
Name: "lb-server-port",
|
||||
Usage: "(agent/node) Local port for supervisor client load-balancer. If the supervisor and apiserver are not colocated an additional port 1 less than this port will also be used for the apiserver client load-balancer.",
|
||||
Hidden: false,
|
||||
Destination: &AgentConfig.LBServerPort,
|
||||
EnvVar: version.ProgramUpper + "_LB_SERVER_PORT",
|
||||
Value: 6444,
|
||||
|
@ -29,7 +29,6 @@ const (
|
||||
)
|
||||
|
||||
type Node struct {
|
||||
Docker bool
|
||||
ContainerRuntimeEndpoint string
|
||||
NoFlannel bool
|
||||
SELinux bool
|
||||
|
Loading…
Reference in New Issue
Block a user