Skip to content

Commit

Permalink
test: use k3d to replace kind for provisioning k8s cluster (#614)
Browse files Browse the repository at this point in the history
  • Loading branch information
reaver-flomesh authored Jan 6, 2025
1 parent 6b91df4 commit 455807c
Show file tree
Hide file tree
Showing 21 changed files with 780 additions and 272 deletions.
206 changes: 109 additions & 97 deletions .github/workflows/main.yml

Large diffs are not rendered by default.

28 changes: 11 additions & 17 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ pull_request_rules:
- check-success=Go test
- check-success=Scan images for security vulnerabilities
- check-success=Integration Test with Tresor, SMI traffic policies, and egress disabled
- check-success=Go mesh test e2e (1)
- check-success=Go mesh test e2e (2)
- check-success=Go mesh test e2e (3)
- check-success=Go mesh test e2e (4)
- check-success=Go mesh test e2e (5)
- check-success=Go mesh test e2e (v1.19.16, Test traffic flowing from client to server with a Kubernetes Service ...
- check-success=Go mesh test e2e (v1.27.11, Test traffic flowing from client to server with a Kubernetes Service ...
- check-success=Go gateway test e2e (6)
- check-success=Go gateway test e2e (v1.19.16, Test traffic from client to backend service routing by FSM Gateway...
- check-success=Go gateway test e2e (v1.21.14, Test traffic from client to backend service routing by FSM Gateway...
- check-success=Go gateway test e2e (v1.23.17, Test traffic from client to backend service routing by FSM Gateway...
- check-success=Go mesh test e2e (1, ubuntu-22.04)
- check-success=Go mesh test e2e (2, ubuntu-22.04)
- check-success=Go mesh test e2e (3, ubuntu-22.04)
- check-success=Go mesh test e2e (4, ubuntu-22.04)
- check-success=Go mesh test e2e (5, ubuntu-22.04)
- check-success=Go mesh test e2e (v1.19.16-k3s1, Test traffic flowing from client to server with a Kubernetes Ser...
- check-success=Go mesh test e2e (v1.27.16-k3s1, Test traffic flowing from client to server with a Kubernetes Ser...
- check-success=Go gateway test e2e (6, latest, ubuntu-22.04)
- check-success=Go gateway test e2e (6, v1.19.16-k3s1, ubuntu-20.04)
- check-success=Go gateway test e2e (6, v1.21.16-k3s1, ubuntu-22.04)
- check-success=Go gateway test e2e (6, v1.23.17-k3s1, ubuntu-22.04)
- check-success=Go ingress test e2e (7)
- check-success=Go statefulset test e2e (8)
- check-success=Go retry test e2e (9)
Expand All @@ -39,12 +39,6 @@ pull_request_rules:
actions:
merge:
method: squash
- name: Rebase pull request when it's more than 3 commits behind main
conditions:
- base = main
- "#commits-behind >= 3"
actions:
rebase:
- name: Backport features/patches to the release/v1.4 branch
conditions:
- base=main
Expand Down
15 changes: 14 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ DOCKER_BUILDX_OUTPUT ?= type=registry
LDFLAGS ?= "-X $(BUILD_DATE_VAR)=$(BUILD_DATE) -X $(BUILD_VERSION_VAR)=$(VERSION) -X $(BUILD_GITCOMMIT_VAR)=$(GIT_SHA) -s -w"

# These two values are combined and passed to go test
E2E_FLAGS ?= -installType=KindCluster
E2E_FLAGS ?= -installType=K3dCluster
E2E_FLAGS_DEFAULT := -test.v -ginkgo.v -ginkgo.progress -ctrRegistry $(CTR_REGISTRY) -fsmImageTag $(CTR_TAG)

# Installed Go version
Expand Down Expand Up @@ -189,10 +189,18 @@ format-c:
kind-up:
./scripts/kind-with-registry.sh

.PHONY: k3d-up
k3d-up:
./scripts/k3d-with-registry.sh

.PHONY: kind-reset
kind-reset:
kind delete cluster --name fsm

.PHONY: k3d-reset
k3d-reset:
k3d cluster delete fsm

.PHONY: test-e2e
test-e2e: DOCKER_BUILDX_OUTPUT=type=docker
test-e2e: docker-build-fsm build-fsm docker-build-tcp-echo-server
Expand All @@ -206,6 +214,11 @@ kind-demo: export CTR_REGISTRY=localhost:5000
kind-demo: .env kind-up clean-fsm
./demo/run-fsm-demo.sh

.PHONY: k3d-demo
k3d-demo: export CTR_REGISTRY=localhost:5000
k3d-demo: .env k3d-up clean-fsm
./demo/run-fsm-demo.sh

.PHONE: build-bookwatcher
build-bookwatcher:
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o ./demo/bin/bookwatcher/bookwatcher ./demo/cmd/bookwatcher
Expand Down
3 changes: 2 additions & 1 deletion charts/fsm/templates/fsm-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ spec:
initContainers:
- name: init-fsm-controller
image: "{{ include "fsmCurl.image" . }}"
imagePullPolicy: {{ .Values.fsm.image.pullPolicy }}
command: ["curl", "http://fsm-bootstrap.{{ include "fsm.namespace" . }}:9091/healthz", "--connect-timeout", "2", "--retry", "50", "--retry-connrefused", "--retry-delay", "5"]
resources:
{{- toYaml .Values.fsm.fsmController.initResources | nindent 12 }}
- name: init-untar
image: "{{ include "fsmCurl.image" . }}"
imagePullPolicy: IfNotPresent
imagePullPolicy: {{ .Values.fsm.image.pullPolicy }}
command:
- sh
- -c
Expand Down
2 changes: 1 addition & 1 deletion charts/fsm/templates/fsm-ingress-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ spec:
initContainers:
- name: wait-controller
image: "{{ include "fsmCurl.image" . }}"
imagePullPolicy: IfNotPresent
imagePullPolicy: {{ .Values.fsm.image.pullPolicy }}
{{- with .Values.fsm.fsmIngress.securityContext }}
securityContext:
{{- toYaml . | nindent 10 }}
Expand Down
1 change: 1 addition & 0 deletions charts/fsm/templates/fsm-injector-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ spec:
initContainers:
- name: init-fsm-injector
image: "{{ include "fsmCurl.image" . }}"
imagePullPolicy: {{ .Values.fsm.image.pullPolicy }}
command: ["curl", "http://fsm-bootstrap.{{ include "fsm.namespace" . }}:9091/healthz", "--connect-timeout", "2", "--retry", "50", "--retry-connrefused", "--retry-delay", "5"]
resources:
{{- toYaml .Values.fsm.injector.initResources | nindent 12 }}
Expand Down
1 change: 1 addition & 0 deletions charts/fsm/templates/fsm-xnetwork.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ spec:
initContainers:
- name: fsm-init
image: "{{ include "fsmCurl.image" . }}"
imagePullPolicy: {{ .Values.fsm.image.pullPolicy }}
command: [ "curl", "http://fsm-bootstrap.{{ include "fsm.namespace" . }}:9091/healthz", "--connect-timeout", "2", "--retry", "50", "--retry-connrefused", "--retry-delay", "5"]
resources:
{{- toYaml .Values.fsm.fsmXnetwork.initResources | nindent 12 }}
Expand Down
44 changes: 34 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ require (
github.com/deckarep/golang-set v1.8.0
github.com/deckarep/golang-set/v2 v2.7.0
github.com/docker/distribution v2.8.3+incompatible
github.com/docker/docker v26.1.5+incompatible
github.com/docker/docker v27.2.1+incompatible
github.com/docker/go-connections v0.5.0
github.com/dubbogo/go-zookeeper v1.0.3
github.com/dustin/go-humanize v1.0.1
github.com/fatih/color v1.18.0
Expand All @@ -44,6 +45,7 @@ require (
github.com/jinzhu/copier v0.4.0
github.com/jonboulle/clockwork v0.5.0
github.com/jstemmer/go-junit-report v1.0.0
github.com/k3d-io/k3d/v5 v5.7.5
github.com/kelseyhightower/envconfig v1.4.0
github.com/matm/gocov-html v1.4.0
github.com/mholt/archiver/v3 v3.5.1
Expand All @@ -63,8 +65,10 @@ require (
github.com/rs/zerolog v1.33.0
github.com/servicemeshinterface/smi-sdk-go v0.5.0
github.com/sethvargo/go-retry v0.3.0
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.18.2
github.com/stretchr/testify v1.10.0
github.com/tidwall/gjson v1.18.0
github.com/tidwall/sjson v1.2.5
Expand Down Expand Up @@ -204,6 +208,7 @@ require (
github.com/containerd/errdefs v0.3.0 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/containerd/platforms v0.2.1 // indirect
github.com/containerd/stargz-snapshotter/estargz v0.14.3 // indirect
github.com/coreos/etcd v3.3.27+incompatible // indirect
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf // indirect
github.com/coreos/pkg v0.0.0-20220810130054-c7d1c02cb6cf // indirect
Expand All @@ -218,9 +223,9 @@ require (
github.com/dimchansky/utfbom v1.1.1 // indirect
github.com/disintegration/imaging v1.6.2 // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/cli v26.1.5+incompatible // indirect
github.com/docker/docker-credential-helpers v0.7.0 // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/cli v27.0.3+incompatible // indirect
github.com/docker/docker-credential-helpers v0.8.1 // indirect
github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c // indirect
github.com/docker/go-metrics v0.0.1 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 // indirect
Expand All @@ -237,6 +242,7 @@ require (
github.com/fogleman/gg v1.3.0 // indirect
github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/fvbommel/sortorder v1.1.0 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/fzipp/gocyclo v0.6.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
Expand Down Expand Up @@ -292,8 +298,10 @@ require (
github.com/golangci/plugin-module-register v0.1.1 // indirect
github.com/golangci/revgrep v0.5.3 // indirect
github.com/golangci/unconvert v0.0.0-20240309020433-c5143eacb3ed // indirect
github.com/goodhosts/hostsfile v0.1.6 // indirect
github.com/google/btree v1.0.1 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-containerregistry v0.19.1 // indirect
github.com/google/go-metrics-stackdriver v0.2.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
Expand All @@ -311,6 +319,7 @@ require (
github.com/gostaticanalysis/nilerr v0.1.1 // indirect
github.com/gosuri/uitable v0.0.4 // indirect
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
github.com/hashicorp-forge/bbolt v1.3.8-hc3 // indirect
github.com/hashicorp/cli v1.1.6 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
Expand Down Expand Up @@ -341,7 +350,7 @@ require (
github.com/hashicorp/go-secure-stdlib/mlock v0.1.3 // indirect
github.com/hashicorp/go-secure-stdlib/nonceutil v0.1.0 // indirect
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.8 // indirect
github.com/hashicorp/go-secure-stdlib/plugincontainer v0.4.0 // indirect
github.com/hashicorp/go-secure-stdlib/plugincontainer v0.4.1 // indirect
github.com/hashicorp/go-secure-stdlib/reloadutil v0.1.1 // indirect
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect
github.com/hashicorp/go-secure-stdlib/tlsutil v0.1.3 // indirect
Expand Down Expand Up @@ -412,7 +421,8 @@ require (
github.com/linode/linodego v0.10.0 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/macabu/inamedparam v0.1.3 // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/magefile/mage v1.15.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/maratori/testableexamples v1.0.0 // indirect
github.com/maratori/testpackage v1.1.1 // indirect
Expand All @@ -421,6 +431,7 @@ require (
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/mgechev/revive v1.5.1 // indirect
github.com/miekg/pkcs11 v1.1.1 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
Expand All @@ -433,6 +444,9 @@ require (
github.com/moby/locker v1.0.1 // indirect
github.com/moby/patternmatcher v0.6.0 // indirect
github.com/moby/spdystream v0.4.0 // indirect
github.com/moby/sys/sequential v0.5.0 // indirect
github.com/moby/sys/user v0.3.0 // indirect
github.com/moby/sys/userns v0.1.0 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
Expand Down Expand Up @@ -476,6 +490,7 @@ require (
github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 // indirect
github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect
github.com/raeperd/recvcheck v0.2.0 // indirect
github.com/rancher/wharfie v0.6.2 // indirect
github.com/rboyer/safeio v0.2.1 // indirect
github.com/renier/xmlrpc v0.0.0-20170708154548-ce4a1a486c03 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
Expand All @@ -487,6 +502,8 @@ require (
github.com/ryancurrah/gomodguard v1.3.5 // indirect
github.com/ryanrolds/sqlclosecheck v0.5.1 // indirect
github.com/ryanuber/go-glob v1.0.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sanposhiho/wastedassign/v2 v2.1.0 // indirect
github.com/santhosh-tekuri/jsonschema/v6 v6.0.1 // indirect
github.com/sasha-s/go-deadlock v0.2.0 // indirect
Expand All @@ -499,25 +516,24 @@ require (
github.com/shirou/gopsutil/v3 v3.24.5 // indirect
github.com/shoenig/go-m1cpu v0.1.6 // indirect
github.com/shopspring/decimal v1.4.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/sivchari/containedctx v1.0.3 // indirect
github.com/sivchari/tenv v1.12.1 // indirect
github.com/softlayer/softlayer-go v0.0.0-20180806151055-260589d94c7d // indirect
github.com/sonatard/noctx v0.1.0 // indirect
github.com/sony/gobreaker v0.5.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/sourcegraph/go-diff v0.7.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.7.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/viper v1.12.0 // indirect
github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect
github.com/stbenjam/no-sprintf-host-port v0.2.0 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/subosito/gotenv v1.4.1 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/tdakkota/asciicheck v0.3.0 // indirect
github.com/tencentcloud/tencentcloud-sdk-go v1.0.162 // indirect
github.com/tetafro/godot v1.4.20 // indirect
github.com/tetratelabs/wazero v1.8.1 // indirect
github.com/theupdateframework/notary v0.7.0 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.0 // indirect
github.com/timakin/bodyclose v0.0.0-20241017074812-ed6a65f985e3 // indirect
Expand All @@ -535,6 +551,7 @@ require (
github.com/ultraware/whitespace v0.2.0 // indirect
github.com/uudashr/gocognit v1.2.0 // indirect
github.com/uudashr/iface v1.3.0 // indirect
github.com/vbatts/tar-split v0.11.3 // indirect
github.com/vmware/govmomi v0.30.6 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
Expand All @@ -556,13 +573,20 @@ require (
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 // indirect
go.opentelemetry.io/otel v1.31.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.28.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0 // indirect
go.opentelemetry.io/otel/metric v1.31.0 // indirect
go.opentelemetry.io/otel/sdk v1.31.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.31.0 // indirect
go.opentelemetry.io/otel/trace v1.31.0 // indirect
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/automaxprocs v1.6.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect
golang.org/x/arch v0.8.0 // indirect
golang.org/x/crypto v0.31.0 // indirect
golang.org/x/exp/typeparams v0.0.0-20241108190413-2d47ceb2692f // indirect
Expand Down
Loading

0 comments on commit 455807c

Please sign in to comment.