mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-29 12:14:48 +00:00
runtime: refactor commandline code directory
Move all command line code to `cmd` and move containerd-shim-v2 to pkg. Fixes: #2627 Signed-off-by: Peng Tao <bergwolf@hyper.sh>
This commit is contained in:
parent
7bf96d2457
commit
4f7cc18622
@ -14,7 +14,7 @@ through the [CRI-O\*](https://github.com/kubernetes-incubator/cri-o) and
|
|||||||
|
|
||||||
Kata Containers creates a QEMU\*/KVM virtual machine for pod that `kubelet` (Kubernetes) creates respectively.
|
Kata Containers creates a QEMU\*/KVM virtual machine for pod that `kubelet` (Kubernetes) creates respectively.
|
||||||
|
|
||||||
The [`containerd-shim-kata-v2` (shown as `shimv2` from this point onwards)](../../src/runtime/containerd-shim-v2)
|
The [`containerd-shim-kata-v2` (shown as `shimv2` from this point onwards)](../../src/runtime/cmd/containerd-shim-kata-v2/)
|
||||||
is the Kata Containers entrypoint, which
|
is the Kata Containers entrypoint, which
|
||||||
implements the [Containerd Runtime V2 (Shim API)](https://github.com/containerd/containerd/tree/master/runtime/v2) for Kata.
|
implements the [Containerd Runtime V2 (Shim API)](https://github.com/containerd/containerd/tree/master/runtime/v2) for Kata.
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ use `RuntimeClass` instead of the deprecated annotations.
|
|||||||
|
|
||||||
### Containerd Runtime V2 API: Shim V2 API
|
### Containerd Runtime V2 API: Shim V2 API
|
||||||
|
|
||||||
The [`containerd-shim-kata-v2` (short as `shimv2` in this documentation)](../../src/runtime/containerd-shim-v2)
|
The [`containerd-shim-kata-v2` (short as `shimv2` in this documentation)](../../src/runtime/cmd/containerd-shim-kata-v2/)
|
||||||
implements the [Containerd Runtime V2 (Shim API)](https://github.com/containerd/containerd/tree/master/runtime/v2) for Kata.
|
implements the [Containerd Runtime V2 (Shim API)](https://github.com/containerd/containerd/tree/master/runtime/v2) for Kata.
|
||||||
With `shimv2`, Kubernetes can launch Pod and OCI-compatible containers with one shim per Pod. Prior to `shimv2`, `2N+1`
|
With `shimv2`, Kubernetes can launch Pod and OCI-compatible containers with one shim per Pod. Prior to `shimv2`, `2N+1`
|
||||||
shims (i.e. a `containerd-shim` and a `kata-shim` for each container and the Pod sandbox itself) and no standalone `kata-proxy`
|
shims (i.e. a `containerd-shim` and a `kata-shim` for each container and the Pod sandbox itself) and no standalone `kata-proxy`
|
||||||
|
12
src/runtime/.gitignore
vendored
12
src/runtime/.gitignore
vendored
@ -5,16 +5,10 @@ coverage.txt
|
|||||||
coverage.html
|
coverage.html
|
||||||
.git-commit
|
.git-commit
|
||||||
.git-commit.tmp
|
.git-commit.tmp
|
||||||
/cli/config/configuration-acrn.toml
|
/config/*.toml
|
||||||
/cli/config/configuration-clh.toml
|
config-generated.go
|
||||||
/cli/config/configuration-fc.toml
|
|
||||||
/cli/config/configuration-qemu.toml
|
|
||||||
/cli/config/configuration-clh.toml
|
|
||||||
/cli/config-generated.go
|
|
||||||
/cli/containerd-shim-kata-v2/config-generated.go
|
|
||||||
/cli/coverage.html
|
|
||||||
/containerd-shim-kata-v2
|
/containerd-shim-kata-v2
|
||||||
/containerd-shim-v2/monitor_address
|
/cmd/containerd-shim-v2/monitor_address
|
||||||
/data/kata-collect-data.sh
|
/data/kata-collect-data.sh
|
||||||
/kata-monitor
|
/kata-monitor
|
||||||
/kata-netmon
|
/kata-netmon
|
||||||
|
@ -51,12 +51,13 @@ PROJECT_DIR = $(PROJECT_TAG)
|
|||||||
IMAGENAME = $(PROJECT_TAG).img
|
IMAGENAME = $(PROJECT_TAG).img
|
||||||
|
|
||||||
TARGET = $(BIN_PREFIX)-runtime
|
TARGET = $(BIN_PREFIX)-runtime
|
||||||
TARGET_OUTPUT = $(CURDIR)/$(TARGET)
|
RUNTIME_OUTPUT = $(CURDIR)/$(TARGET)
|
||||||
|
RUNTIME_DIR = $(CLI_DIR)/$(TARGET)
|
||||||
BINLIST += $(TARGET)
|
BINLIST += $(TARGET)
|
||||||
|
|
||||||
NETMON_DIR = netmon
|
NETMON_DIR = $(CLI_DIR)/netmon
|
||||||
NETMON_TARGET = $(PROJECT_TYPE)-netmon
|
NETMON_TARGET = $(PROJECT_TYPE)-netmon
|
||||||
NETMON_TARGET_OUTPUT = $(CURDIR)/$(NETMON_TARGET)
|
NETMON_RUNTIME_OUTPUT = $(CURDIR)/$(NETMON_TARGET)
|
||||||
BINLIBEXECLIST += $(NETMON_TARGET)
|
BINLIBEXECLIST += $(NETMON_TARGET)
|
||||||
|
|
||||||
DESTDIR ?= /
|
DESTDIR ?= /
|
||||||
@ -200,7 +201,7 @@ FEATURE_SELINUX ?= check
|
|||||||
|
|
||||||
SED = sed
|
SED = sed
|
||||||
|
|
||||||
CLI_DIR = cli
|
CLI_DIR = cmd
|
||||||
SHIMV2 = containerd-shim-kata-v2
|
SHIMV2 = containerd-shim-kata-v2
|
||||||
SHIMV2_OUTPUT = $(CURDIR)/$(SHIMV2)
|
SHIMV2_OUTPUT = $(CURDIR)/$(SHIMV2)
|
||||||
SHIMV2_DIR = $(CLI_DIR)/$(SHIMV2)
|
SHIMV2_DIR = $(CLI_DIR)/$(SHIMV2)
|
||||||
@ -225,7 +226,7 @@ ifneq (,$(QEMUCMD))
|
|||||||
KNOWN_HYPERVISORS += $(HYPERVISOR_QEMU)
|
KNOWN_HYPERVISORS += $(HYPERVISOR_QEMU)
|
||||||
|
|
||||||
CONFIG_FILE_QEMU = configuration-qemu.toml
|
CONFIG_FILE_QEMU = configuration-qemu.toml
|
||||||
CONFIG_QEMU = $(CLI_DIR)/config/$(CONFIG_FILE_QEMU)
|
CONFIG_QEMU = config/$(CONFIG_FILE_QEMU)
|
||||||
CONFIG_QEMU_IN = $(CONFIG_QEMU).in
|
CONFIG_QEMU_IN = $(CONFIG_QEMU).in
|
||||||
|
|
||||||
CONFIG_PATH_QEMU = $(abspath $(CONFDIR)/$(CONFIG_FILE_QEMU))
|
CONFIG_PATH_QEMU = $(abspath $(CONFDIR)/$(CONFIG_FILE_QEMU))
|
||||||
@ -248,7 +249,7 @@ ifneq (,$(CLHCMD))
|
|||||||
KNOWN_HYPERVISORS += $(HYPERVISOR_CLH)
|
KNOWN_HYPERVISORS += $(HYPERVISOR_CLH)
|
||||||
|
|
||||||
CONFIG_FILE_CLH = configuration-clh.toml
|
CONFIG_FILE_CLH = configuration-clh.toml
|
||||||
CONFIG_CLH = $(CLI_DIR)/config/$(CONFIG_FILE_CLH)
|
CONFIG_CLH = config/$(CONFIG_FILE_CLH)
|
||||||
CONFIG_CLH_IN = $(CONFIG_CLH).in
|
CONFIG_CLH_IN = $(CONFIG_CLH).in
|
||||||
|
|
||||||
CONFIG_PATH_CLH = $(abspath $(CONFDIR)/$(CONFIG_FILE_CLH))
|
CONFIG_PATH_CLH = $(abspath $(CONFDIR)/$(CONFIG_FILE_CLH))
|
||||||
@ -271,7 +272,7 @@ ifneq (,$(FCCMD))
|
|||||||
KNOWN_HYPERVISORS += $(HYPERVISOR_FC)
|
KNOWN_HYPERVISORS += $(HYPERVISOR_FC)
|
||||||
|
|
||||||
CONFIG_FILE_FC = configuration-fc.toml
|
CONFIG_FILE_FC = configuration-fc.toml
|
||||||
CONFIG_FC = $(CLI_DIR)/config/$(CONFIG_FILE_FC)
|
CONFIG_FC = config/$(CONFIG_FILE_FC)
|
||||||
CONFIG_FC_IN = $(CONFIG_FC).in
|
CONFIG_FC_IN = $(CONFIG_FC).in
|
||||||
|
|
||||||
CONFIG_PATH_FC = $(abspath $(CONFDIR)/$(CONFIG_FILE_FC))
|
CONFIG_PATH_FC = $(abspath $(CONFDIR)/$(CONFIG_FILE_FC))
|
||||||
@ -294,7 +295,7 @@ ifneq (,$(ACRNCMD))
|
|||||||
KNOWN_HYPERVISORS += $(HYPERVISOR_ACRN)
|
KNOWN_HYPERVISORS += $(HYPERVISOR_ACRN)
|
||||||
|
|
||||||
CONFIG_FILE_ACRN = configuration-acrn.toml
|
CONFIG_FILE_ACRN = configuration-acrn.toml
|
||||||
CONFIG_ACRN = $(CLI_DIR)/config/$(CONFIG_FILE_ACRN)
|
CONFIG_ACRN = config/$(CONFIG_FILE_ACRN)
|
||||||
CONFIG_ACRN_IN = $(CONFIG_ACRN).in
|
CONFIG_ACRN_IN = $(CONFIG_ACRN).in
|
||||||
|
|
||||||
CONFIG_PATH_ACRN = $(abspath $(CONFDIR)/$(CONFIG_FILE_ACRN))
|
CONFIG_PATH_ACRN = $(abspath $(CONFDIR)/$(CONFIG_FILE_ACRN))
|
||||||
@ -522,12 +523,12 @@ containerd-shim-v2: $(SHIMV2_OUTPUT)
|
|||||||
|
|
||||||
monitor: $(MONITOR_OUTPUT)
|
monitor: $(MONITOR_OUTPUT)
|
||||||
|
|
||||||
netmon: $(NETMON_TARGET_OUTPUT)
|
netmon: $(NETMON_RUNTIME_OUTPUT)
|
||||||
|
|
||||||
$(NETMON_TARGET_OUTPUT): $(SOURCES) VERSION
|
$(NETMON_RUNTIME_OUTPUT): $(SOURCES) VERSION
|
||||||
$(QUIET_BUILD)(cd $(NETMON_DIR) && go build $(BUILDFLAGS) -o $@ -ldflags "-X main.version=$(VERSION)" $(KATA_LDFLAGS))
|
$(QUIET_BUILD)(cd $(NETMON_DIR) && go build $(BUILDFLAGS) -o $@ -ldflags "-X main.version=$(VERSION)" $(KATA_LDFLAGS))
|
||||||
|
|
||||||
runtime: $(TARGET_OUTPUT) $(CONFIGS)
|
runtime: $(RUNTIME_OUTPUT) $(CONFIGS)
|
||||||
.DEFAULT: default
|
.DEFAULT: default
|
||||||
|
|
||||||
build: default
|
build: default
|
||||||
@ -563,8 +564,9 @@ GENERATED_CONFIG = $(abspath $(CLI_DIR)/config-generated.go)
|
|||||||
GENERATED_FILES += $(GENERATED_CONFIG)
|
GENERATED_FILES += $(GENERATED_CONFIG)
|
||||||
GENERATED_FILES += pkg/katautils/config-settings.go
|
GENERATED_FILES += pkg/katautils/config-settings.go
|
||||||
|
|
||||||
$(TARGET_OUTPUT): $(SOURCES) $(GENERATED_FILES) $(MAKEFILE_LIST) | show-summary
|
$(RUNTIME_OUTPUT): $(SOURCES) $(GENERATED_FILES) $(MAKEFILE_LIST) | show-summary
|
||||||
$(QUIET_BUILD)(cd $(CLI_DIR) && go build $(KATA_LDFLAGS) $(BUILDFLAGS) -o $@ .)
|
$(QUIET_BUILD)(cd $(RUNTIME_DIR)/ && ln -fs $(GENERATED_CONFIG))
|
||||||
|
$(QUIET_BUILD)(cd $(RUNTIME_DIR) && go build $(KATA_LDFLAGS) $(BUILDFLAGS) -o $@ .)
|
||||||
|
|
||||||
$(SHIMV2_OUTPUT): $(SOURCES) $(GENERATED_FILES) $(MAKEFILE_LIST)
|
$(SHIMV2_OUTPUT): $(SOURCES) $(GENERATED_FILES) $(MAKEFILE_LIST)
|
||||||
$(QUIET_BUILD)(cd $(SHIMV2_DIR)/ && ln -fs $(GENERATED_CONFIG))
|
$(QUIET_BUILD)(cd $(SHIMV2_DIR)/ && ln -fs $(GENERATED_CONFIG))
|
||||||
|
@ -9,12 +9,13 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/containerd/containerd/runtime/v2/shim"
|
shimapi "github.com/containerd/containerd/runtime/v2/shim"
|
||||||
containerdshim "github.com/kata-containers/kata-containers/src/runtime/containerd-shim-v2"
|
|
||||||
|
shim "github.com/kata-containers/kata-containers/src/runtime/pkg/containerd-shim-v2"
|
||||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/types"
|
"github.com/kata-containers/kata-containers/src/runtime/pkg/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func shimConfig(config *shim.Config) {
|
func shimConfig(config *shimapi.Config) {
|
||||||
config.NoReaper = true
|
config.NoReaper = true
|
||||||
config.NoSubreaper = true
|
config.NoSubreaper = true
|
||||||
}
|
}
|
||||||
@ -26,5 +27,5 @@ func main() {
|
|||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
shim.Run(types.DefaultKataRuntimeName, containerdshim.New, shimConfig)
|
shimapi.Run(types.DefaultKataRuntimeName, shim.New, shimConfig)
|
||||||
}
|
}
|
@ -10,7 +10,7 @@ vendor_id : IBM/S390
|
|||||||
# processors : 4
|
# processors : 4
|
||||||
bogomips per cpu: 20325.00
|
bogomips per cpu: 20325.00
|
||||||
max thread id : 0
|
max thread id : 0
|
||||||
features : esan3 zarch stfle msa ldisp eimm dfp edat etf3eh highgprs te vx sie
|
features : esan3 zarch stfle msa ldisp eimm dfp edat etf3eh highgprs te vx sie
|
||||||
cache0 : level=1 type=Data scope=Private size=128K line_size=256 associativity=8
|
cache0 : level=1 type=Data scope=Private size=128K line_size=256 associativity=8
|
||||||
cache1 : level=1 type=Instruction scope=Private size=96K line_size=256 associativity=6
|
cache1 : level=1 type=Instruction scope=Private size=96K line_size=256 associativity=6
|
||||||
cache2 : level=2 type=Data scope=Private size=2048K line_size=256 associativity=8
|
cache2 : level=2 type=Data scope=Private size=2048K line_size=256 associativity=8
|
@ -360,7 +360,7 @@ valid_entropy_sources = @DEFVALIDENTROPYSOURCES@
|
|||||||
# When enable_guest_swap is enabled, insert a raw file to the guest as the swap device
|
# When enable_guest_swap is enabled, insert a raw file to the guest as the swap device
|
||||||
# if the swappiness of a container (set by annotation "io.katacontainers.container.resource.swappiness")
|
# if the swappiness of a container (set by annotation "io.katacontainers.container.resource.swappiness")
|
||||||
# is bigger than 0.
|
# is bigger than 0.
|
||||||
# The size of the swap device should be
|
# The size of the swap device should be
|
||||||
# swap_in_bytes (set by annotation "io.katacontainers.container.resource.swap_in_bytes") - memory_limit_in_bytes.
|
# swap_in_bytes (set by annotation "io.katacontainers.container.resource.swap_in_bytes") - memory_limit_in_bytes.
|
||||||
# If swap_in_bytes is not set, the size should be memory_limit_in_bytes.
|
# If swap_in_bytes is not set, the size should be memory_limit_in_bytes.
|
||||||
# If swap_in_bytes and memory_limit_in_bytes is not set, the size should
|
# If swap_in_bytes and memory_limit_in_bytes is not set, the size should
|
@ -7,12 +7,13 @@ package katamonitor
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
cdshim "github.com/containerd/containerd/runtime/v2/shim"
|
|
||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
shim "github.com/kata-containers/kata-containers/src/runtime/containerd-shim-v2"
|
cdshim "github.com/containerd/containerd/runtime/v2/shim"
|
||||||
|
|
||||||
|
shim "github.com/kata-containers/kata-containers/src/runtime/pkg/containerd-shim-v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func serveError(w http.ResponseWriter, status int, txt string) {
|
func serveError(w http.ResponseWriter, status int, txt string) {
|
||||||
|
@ -13,7 +13,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
cdshim "github.com/containerd/containerd/runtime/v2/shim"
|
cdshim "github.com/containerd/containerd/runtime/v2/shim"
|
||||||
shim "github.com/kata-containers/kata-containers/src/runtime/containerd-shim-v2"
|
|
||||||
|
shim "github.com/kata-containers/kata-containers/src/runtime/pkg/containerd-shim-v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
Loading…
Reference in New Issue
Block a user