Skip to content

Commit e21da0c

Browse files
committed
Fix e2e tests with podman
1 parent 2874b60 commit e21da0c

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ CG_BIN_FILE=confgenerator
2121
NETFLOW_GENERATOR=nflow-generator
2222
CMD_DIR=./cmd/
2323
FLP_CONF_FILE ?= contrib/kubernetes/flowlogs-pipeline.conf.yaml
24+
KIND_CLUSTER_NAME ?= kind
2425

2526
BUILD_DATE := $(shell date +%Y-%m-%d\ %H:%M)
2627
TAG_COMMIT := $(shell git rev-list --abbrev-commit --tags --max-count=1)
@@ -221,24 +222,24 @@ undeploy-netflow-simulator: ## Undeploy netflow simulator
221222

222223
.PHONY: create-kind-cluster
223224
create-kind-cluster: $(KIND) ## Create cluster
224-
$(KIND) create cluster --config contrib/kubernetes/kind/kind.config.yaml
225+
$(KIND) create cluster --name $(KIND_CLUSTER_NAME) --config contrib/kubernetes/kind/kind.config.yaml
225226
kubectl cluster-info --context kind-kind
226227

227228
.PHONY: delete-kind-cluster
228229
delete-kind-cluster: $(KIND) ## Delete cluster
229-
$(KIND) delete cluster
230+
$(KIND) delete cluster --name $(KIND_CLUSTER_NAME)
230231

231232
.PHONY: kind-load-image
232233
kind-load-image: ## Load image to kind
233234
ifeq ($(OCI_RUNTIME),$(shell which docker))
234235
# This is an optimization for docker provider. "kind load docker-image" can load an image directly from docker's
235236
# local registry. For other providers (i.e. podman), we must use "kind load image-archive" instead.
236-
$(KIND) load docker-image $(DOCKER_IMG):$(DOCKER_TAG)
237+
$(KIND) load --name $(KIND_CLUSTER_NAME) docker-image $(DOCKER_IMG):$(DOCKER_TAG)
237238
else
238239
$(eval tmpfile="/tmp/flp.tar")
239240
-rm $(tmpfile)
240241
$(OCI_RUNTIME) save $(DOCKER_IMG):$(DOCKER_TAG) -o $(tmpfile)
241-
$(KIND) load image-archive $(tmpfile)
242+
$(KIND) load --name $(KIND_CLUSTER_NAME) image-archive $(tmpfile)
242243
-rm $(tmpfile)
243244
endif
244245

pkg/test/e2e/utils.go

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,27 +91,18 @@ func e2eDeleteKindCluster(clusterName string) env.Func {
9191
}
9292
}
9393

94-
// NOTE: the e2e framework uses `kind load` command that forces usage of docker (and not podman)
95-
// ref: https://github.com/kubernetes-sigs/kind/issues/2027
9694
func e2eBuildAndLoadImageIntoKind(dockerImg, dockerTag, clusterName string) env.Func {
9795
return func(ctx context.Context, cfg *envconf.Config) (context.Context, error) {
9896
e := gexe.New()
9997
fmt.Printf("====> building docker image - %s:%s\n", dockerImg, dockerTag)
100-
p := e.RunProc(fmt.Sprintf(`/bin/sh -c "cd $(git rev-parse --show-toplevel); OCI_RUNTIME=docker DOCKER_IMG=%s DOCKER_TAG=%s make build-image"`,
101-
dockerImg, dockerTag))
98+
p := e.RunProc(fmt.Sprintf(`/bin/sh -c "cd $(git rev-parse --show-toplevel); DOCKER_IMG=%s DOCKER_TAG=%s KIND_CLUSTER_NAME=%s make build-image kind-load-image"`,
99+
dockerImg, dockerTag, clusterName))
102100
if p.Err() != nil || !p.IsSuccess() || p.ExitCode() != 0 {
103-
return nil, fmt.Errorf("failed to building docker image err=%v result=%v", p.Err(), p.Result())
104-
}
105-
fmt.Printf("====> Done.\n")
106-
fmt.Printf("====> Load image into kind \n")
107-
p = e.RunProc(fmt.Sprintf("kind load --name %s docker-image %s:%s", clusterName, dockerImg, dockerTag))
108-
if p.Err() != nil || !p.IsSuccess() || p.ExitCode() != 0 {
109-
return nil, fmt.Errorf("failed to load image into kind err=%v result=%v", p.Err(), p.Result())
101+
return nil, fmt.Errorf("failed to build or load docker image err=%v result=%v", p.Err(), p.Result())
110102
}
111103
fmt.Printf("====> Done.\n")
112104
return ctx, nil
113105
}
114-
115106
}
116107

117108
func e2eRecreateNamespace(name string) env.Func {

0 commit comments

Comments
 (0)