Skip to content

Commit

Permalink
k3s containerd (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
saurabh2253 authored Feb 1, 2022
1 parent 6a5223a commit b4c91d0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion autodetect.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func NewRuntime() (Runtime, error) {

if runtime == constants.DOCKER {
return docker.New(), nil
} else if runtime == constants.CONTAINERD {
} else if runtime == constants.CONTAINERD || runtime == constants.K3S_CONTAINERD {
return self_containerd.New(), nil
}

Expand Down
26 changes: 15 additions & 11 deletions constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,22 @@ package constants
import "time"

const (
UnixProtocol = "unix"
Timeout = 10 * time.Second
CONTAINERD_K8S_NS = "k8s.io"
CONTAINERD = "containerd"
DOCKER = "docker"
CONTAINERD_SOCKET_ADDRESS = "/run/containerd/containerd.sock"
DOCKER_SOCKET_ADDRESS = "/var/run/docker.sock"
CONTAINERD_SOCKET_IRI = "unix://" + CONTAINERD_SOCKET_ADDRESS
DOCKER_SOCKET_IRI = "unix://" + DOCKER_SOCKET_ADDRESS
UnixProtocol = "unix"
Timeout = 10 * time.Second
CONTAINERD_K8S_NS = "k8s.io"
CONTAINERD = "containerd"
K3S_CONTAINERD = "k3s_containerd"
DOCKER = "docker"
CONTAINERD_SOCKET_ADDRESS = "/run/containerd/containerd.sock"
K3S_CONTAINERD_SOCKET_ADDRESS = "/run/k3s/containerd/containerd.sock"
DOCKER_SOCKET_ADDRESS = "/var/run/docker.sock"
CONTAINERD_SOCKET_IRI = "unix://" + CONTAINERD_SOCKET_ADDRESS
DOCKER_SOCKET_IRI = "unix://" + DOCKER_SOCKET_ADDRESS
K3S_CONTAINERD_SOCKET_IRI = "unix://" + K3S_CONTAINERD_SOCKET_ADDRESS
)

var SupportedRuntimes = map[string]string{
DOCKER: DOCKER_SOCKET_IRI,
CONTAINERD: CONTAINERD_SOCKET_IRI,
DOCKER: DOCKER_SOCKET_IRI,
CONTAINERD: CONTAINERD_SOCKET_IRI,
K3S_CONTAINERD: K3S_CONTAINERD_SOCKET_IRI,
}

0 comments on commit b4c91d0

Please sign in to comment.