Skip to content

Commit

Permalink
default scope cri
Browse files Browse the repository at this point in the history
Signed-off-by: binbin0325 <binbin@didiglobal.com>
  • Loading branch information
binbin committed Sep 1, 2023
1 parent a063e99 commit d2395da
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions exec/model/executor_nsexec.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
}
Expand Down Expand Up @@ -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 != "" {
Expand Down

0 comments on commit d2395da

Please sign in to comment.