Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Deprecate hyperstart, CC shim, and CC proxy #1428

Merged
merged 4 commits into from
Apr 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cli/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,8 @@ func newTestRuntimeConfig(dir, consolePath string, create bool) (oci.RuntimeConf
HypervisorType: vc.QemuHypervisor,
HypervisorConfig: hypervisorConfig,
AgentType: vc.KataContainersAgent,
ProxyType: vc.CCProxyType,
ShimType: vc.CCShimType,
ProxyType: vc.KataProxyType,
ShimType: vc.KataShimType,
Console: consolePath,
}, nil
}
Expand Down
21 changes: 8 additions & 13 deletions pkg/katautils/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,13 @@ const (
qemuHypervisorTableType = "qemu"

// supported proxy component types
ccProxyTableType = "cc"
kataProxyTableType = "kata"

// supported shim component types
ccShimTableType = "cc"
kataShimTableType = "kata"

// supported agent component types
hyperstartAgentTableType = "hyperstart"
kataAgentTableType = "kata"
kataAgentTableType = "kata"

// the maximum amount of PCI bridges that can be cold plugged in a VM
maxPCIBridges uint32 = 5
Expand Down Expand Up @@ -606,10 +603,10 @@ func updateRuntimeConfigProxy(configPath string, tomlConf tomlConfig, config *oc

for k, proxy := range tomlConf.Proxy {
switch k {
case ccProxyTableType:
config.ProxyType = vc.CCProxyType
case kataProxyTableType:
config.ProxyType = vc.KataProxyType
default:
return fmt.Errorf("%s proxy type not supported", k)
}

path, err := proxy.path()
Expand Down Expand Up @@ -639,15 +636,13 @@ func updateRuntimeConfigAgent(configPath string, tomlConf tomlConfig, config *oc

for k := range tomlConf.Agent {
switch k {
case hyperstartAgentTableType:
config.AgentType = vc.HyperstartAgent
config.AgentConfig = vc.HyperConfig{}

case kataAgentTableType:
config.AgentType = vc.KataContainersAgent
config.AgentConfig = vc.KataAgentConfig{
UseVSock: config.HypervisorConfig.UseVSock,
}
default:
return fmt.Errorf("%s agent type is not supported", k)
}
}

Expand All @@ -663,10 +658,10 @@ func updateRuntimeConfigShim(configPath string, tomlConf tomlConfig, config *oci

for k, shim := range tomlConf.Shim {
switch k {
case ccShimTableType:
config.ShimType = vc.CCShimType
case kataShimTableType:
config.ShimType = vc.KataShimType
default:
return fmt.Errorf("%s shim is not supported", k)
}

shConfig, err := newShimConfig(shim)
Expand Down Expand Up @@ -788,7 +783,7 @@ func initConfig() (config oci.RuntimeConfig, err error) {
return oci.RuntimeConfig{}, err
}

defaultAgentConfig = vc.HyperConfig{}
defaultAgentConfig = vc.KataAgentConfig{}

config = oci.RuntimeConfig{
HypervisorType: defaultHypervisor,
Expand Down
4 changes: 2 additions & 2 deletions pkg/katautils/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1364,7 +1364,7 @@ func TestDefaultMachineAccelerators(t *testing.T) {
func TestUpdateRuntimeConfiguration(t *testing.T) {
assert := assert.New(t)

assert.NotEqual(defaultAgent, vc.HyperstartAgent)
assert.Equal(defaultAgent, vc.KataContainersAgent)

config := oci.RuntimeConfig{}

Expand Down Expand Up @@ -1433,7 +1433,7 @@ func TestUpdateRuntimeConfigurationFactoryConfig(t *testing.T) {
func TestUpdateRuntimeConfigurationInvalidKernelParams(t *testing.T) {
assert := assert.New(t)

assert.NotEqual(defaultAgent, vc.HyperstartAgent)
assert.Equal(defaultAgent, vc.KataContainersAgent)

config := oci.RuntimeConfig{}

Expand Down
4 changes: 2 additions & 2 deletions pkg/katautils/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ func newTestRuntimeConfig(dir, consolePath string, create bool) (oci.RuntimeConf
HypervisorType: vc.QemuHypervisor,
HypervisorConfig: hypervisorConfig,
AgentType: vc.KataContainersAgent,
ProxyType: vc.CCProxyType,
ShimType: vc.CCShimType,
ProxyType: vc.KataProxyType,
ShimType: vc.KataShimType,
Console: consolePath,
}, nil
}
Expand Down
20 changes: 1 addition & 19 deletions virtcontainers/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@ PREFIX := /usr
BIN_DIR := $(PREFIX)/bin
VC_BIN_DIR := $(BIN_DIR)/virtcontainers/bin
TEST_BIN_DIR := $(VC_BIN_DIR)/test
VIRTC_DIR := hack/virtc
VIRTC_BIN := virtc
HOOK_DIR := hook/mock
HOOK_BIN := hook
CC_SHIM_DIR := shim/mock/cc-shim
CC_SHIM_BIN := cc-shim
KATA_SHIM_DIR := shim/mock/kata-shim
KATA_SHIM_BIN := kata-shim
MK_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
Expand All @@ -35,19 +31,13 @@ all: build binaries
build:
$(QUIET_GOBUILD)go build $(go list ./... | grep -v /vendor/)

virtc:
$(QUIET_GOBUILD)go build -o $(VIRTC_DIR)/$@ $(VIRTC_DIR)/*.go

hook:
$(QUIET_GOBUILD)go build -o $(HOOK_DIR)/$@ $(HOOK_DIR)/*.go

cc-shim:
$(QUIET_GOBUILD)go build -o $(CC_SHIM_DIR)/$@ $(CC_SHIM_DIR)/*.go

kata-shim:
$(QUIET_GOBUILD)go build -o $(KATA_SHIM_DIR)/$@ $(KATA_SHIM_DIR)/*.go

binaries: virtc hook cc-shim kata-shim
binaries: hook kata-shim

#
# Tests
Expand All @@ -60,7 +50,6 @@ check-go-static:

check-go-test:
bash $(MK_DIR)/../.ci/go-test.sh \
$(TEST_BIN_DIR)/$(CC_SHIM_BIN) \
$(TEST_BIN_DIR)/$(KATA_SHIM_BIN) \
$(TEST_BIN_DIR)/$(HOOK_BIN)

Expand All @@ -78,10 +67,8 @@ endef

install:
@mkdir -p $(VC_BIN_DIR)
$(call INSTALL_EXEC,$(VIRTC_DIR)/$(VIRTC_BIN))
@mkdir -p $(TEST_BIN_DIR)
$(call INSTALL_TEST_EXEC,$(HOOK_DIR)/$(HOOK_BIN))
$(call INSTALL_TEST_EXEC,$(CC_SHIM_DIR)/$(CC_SHIM_BIN))
$(call INSTALL_TEST_EXEC,$(KATA_SHIM_DIR)/$(KATA_SHIM_BIN))

#
Expand All @@ -97,9 +84,7 @@ define UNINSTALL_TEST_EXEC
endef

uninstall:
$(call UNINSTALL_EXEC,$(VIRTC_BIN))
$(call UNINSTALL_TEST_EXEC,$(HOOK_BIN))
$(call UNINSTALL_TEST_EXEC,$(CC_SHIM_BIN))
$(call UNINSTALL_TEST_EXEC,$(KATA_SHIM_BIN))

#
Expand All @@ -112,9 +97,7 @@ define FILE_SAFE_TO_REMOVE =
$(shell test -e "$(1)" && test "$(1)" != "/" && echo "$(1)")
endef

CLEAN_FILES += $(VIRTC_DIR)/$(VIRTC_BIN)
CLEAN_FILES += $(HOOK_DIR)/$(HOOK_BIN)
CLEAN_FILES += $(SHIM_DIR)/$(CC_SHIM_BIN)
CLEAN_FILES += $(SHIM_DIR)/$(KATA_SHIM_BIN)

clean:
Expand All @@ -123,7 +106,6 @@ clean:
.PHONY: \
all \
build \
virtc \
hook \
shim \
binaries \
Expand Down
17 changes: 0 additions & 17 deletions virtcontainers/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ const (
// NoopAgentType is the No-Op agent.
NoopAgentType AgentType = "noop"

// HyperstartAgent is the Hyper hyperstart agent.
HyperstartAgent AgentType = "hyperstart"

// KataContainersAgent is the Kata Containers agent.
KataContainersAgent AgentType = "kata"

Expand All @@ -61,9 +58,6 @@ func (agentType *AgentType) Set(value string) error {
case "noop":
*agentType = NoopAgentType
return nil
case "hyperstart":
*agentType = HyperstartAgent
return nil
case "kata":
*agentType = KataContainersAgent
return nil
Expand All @@ -77,8 +71,6 @@ func (agentType *AgentType) String() string {
switch *agentType {
case NoopAgentType:
return string(NoopAgentType)
case HyperstartAgent:
return string(HyperstartAgent)
case KataContainersAgent:
return string(KataContainersAgent)
default:
Expand All @@ -91,8 +83,6 @@ func newAgent(agentType AgentType) agent {
switch agentType {
case NoopAgentType:
return &noopAgent{}
case HyperstartAgent:
return &hyper{}
case KataContainersAgent:
return &kataAgent{}
default:
Expand All @@ -105,13 +95,6 @@ func newAgentConfig(agentType AgentType, agentConfig interface{}) interface{} {
switch agentType {
case NoopAgentType:
return nil
case HyperstartAgent:
var hyperConfig HyperConfig
err := mapstructure.Decode(agentConfig, &hyperConfig)
if err != nil {
return err
}
return hyperConfig
case KataContainersAgent:
var kataAgentConfig KataAgentConfig
err := mapstructure.Decode(agentConfig, &kataAgentConfig)
Expand Down
26 changes: 1 addition & 25 deletions virtcontainers/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ func TestSetNoopAgentType(t *testing.T) {
testSetAgentType(t, "noop", NoopAgentType)
}

func TestSetHyperstartAgentType(t *testing.T) {
testSetAgentType(t, "hyperstart", HyperstartAgent)
}

func TestSetKataAgentType(t *testing.T) {
testSetAgentType(t, "kata", KataContainersAgent)
}
Expand All @@ -43,8 +39,7 @@ func TestSetUnknownAgentType(t *testing.T) {
t.Fatal()
}

if agentType == NoopAgentType ||
agentType == HyperstartAgent {
if agentType == NoopAgentType {
t.Fatal()
}
}
Expand All @@ -60,10 +55,6 @@ func TestStringFromNoopAgentType(t *testing.T) {
testStringFromAgentType(t, NoopAgentType, "noop")
}

func TestStringFromHyperstartAgentType(t *testing.T) {
testStringFromAgentType(t, HyperstartAgent, "hyperstart")
}

func TestStringFromKataAgentType(t *testing.T) {
testStringFromAgentType(t, KataContainersAgent, "kata")
}
Expand All @@ -85,10 +76,6 @@ func TestNewAgentFromNoopAgentType(t *testing.T) {
testNewAgentFromAgentType(t, NoopAgentType, &noopAgent{})
}

func TestNewAgentFromHyperstartAgentType(t *testing.T) {
testNewAgentFromAgentType(t, HyperstartAgent, &hyper{})
}

func TestNewAgentFromKataAgentType(t *testing.T) {
testNewAgentFromAgentType(t, KataContainersAgent, &kataAgent{})
}
Expand Down Expand Up @@ -116,17 +103,6 @@ func TestNewAgentConfigFromNoopAgentType(t *testing.T) {
testNewAgentConfig(t, sandboxConfig, agentConfig)
}

func TestNewAgentConfigFromHyperstartAgentType(t *testing.T) {
agentConfig := HyperConfig{}

sandboxConfig := SandboxConfig{
AgentType: HyperstartAgent,
AgentConfig: agentConfig,
}

testNewAgentConfig(t, sandboxConfig, agentConfig)
}

func TestNewAgentConfigFromKataAgentType(t *testing.T) {
agentConfig := KataAgentConfig{UseVSock: true}

Expand Down
Loading