From d2395da1ece487f19f1ca11db7a29d9b571e0d2e Mon Sep 17 00:00:00 2001 From: binbin Date: Fri, 1 Sep 2023 17:01:28 +0800 Subject: [PATCH] default scope cri Signed-off-by: binbin0325 --- exec/model/executor_nsexec.go | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/exec/model/executor_nsexec.go b/exec/model/executor_nsexec.go index 82f5130..1b3ad02 100644 --- a/exec/model/executor_nsexec.go +++ b/exec/model/executor_nsexec.go @@ -23,7 +23,6 @@ import ( "github.com/chaosblade-io/chaosblade-operator/channel" "github.com/chaosblade-io/chaosblade-operator/pkg/apis/chaosblade/v1alpha1" "github.com/chaosblade-io/chaosblade-operator/pkg/runtime/chaosblade" - "github.com/chaosblade-io/chaosblade-operator/version" "github.com/chaosblade-io/chaosblade-spec-go/spec" "github.com/sirupsen/logrus" v1 "k8s.io/api/core/v1" @@ -146,16 +145,11 @@ func getExperimentIdentifiersWithNsexec(ctx context.Context, expModel *spec.ExpM return getNodeExperimentIdentifiers(experimentId, expModel, containerObjectMetaList, matchers, destroy, client) } - var scope string - if version.CheckVerisonHaveCriCommand() || containerObjectMetaList[0].ContainerRuntime == container.ContainerdRuntime { - // blade create cri --container-id containerObjectMetaList[0].ContainerId --container-runtime obj.ContainerRuntime - scope = "cri" - } else { - // blade create docker --container-id containerObjectMetaList[0].ContainerId - scope = "docker" - } + var ( + scope = "cri" + handle = "create" + ) - handle := "create" if destroy { handle = "destroy" } @@ -191,7 +185,7 @@ func getExperimentIdentifiersWithNsexec(ctx context.Context, expModel *spec.ExpM if expModel.ActionProcessHang { generatedCommand = fmt.Sprintf("%s --cgroup-root /host-sys/fs/cgroup", generatedCommand) } - if scope == "cri" { + if len(obj.ContainerRuntime) > 0 { generatedCommand = fmt.Sprintf("%s --container-runtime %s", generatedCommand, obj.ContainerRuntime) } if obj.Id != "" {