diff --git a/cmd/tetragon-vmtests-run/image.go b/cmd/tetragon-vmtests-run/image.go index 5b25f375367..54f47294f80 100644 --- a/cmd/tetragon-vmtests-run/image.go +++ b/cmd/tetragon-vmtests-run/image.go @@ -11,6 +11,7 @@ import ( "path/filepath" "github.com/cilium/little-vm-helper/pkg/images" + "github.com/cilium/little-vm-helper/pkg/step" "github.com/cilium/tetragon/pkg/vmtests" "github.com/sirupsen/logrus" ) @@ -198,6 +199,19 @@ func buildNetActions(tmpDir string) ([]images.Action, error) { return ret, nil } +type NoNetworkCommand struct{} + +func (rc *NoNetworkCommand) ActionOpName() string { + return "no-network" +} + +func (rc *NoNetworkCommand) ToSteps(s *images.StepConf) ([]step.Step, error) { + return []step.Step{&images.VirtCustomizeStep{ + StepConf: s, + Args: []string{"--no-network"}, + }}, nil +} + func buildTestImage(log *logrus.Logger, rcnf *RunConf) error { imagesDir, baseImage := filepath.Split(rcnf.baseImageFilename) @@ -224,6 +238,7 @@ func buildTestImage(log *logrus.Logger, rcnf *RunConf) error { } actions := []images.Action{ + {Op: &NoNetworkCommand{}}, {Op: &images.SetHostnameCommand{Hostname: rcnf.vmName}}, {Op: &images.AppendLineCommand{ File: "/etc/sysctl.d/local.conf",