Skip to content

Commit 7c8c730

Browse files
authored
ci: add installation test for Talos Linux (#5109)
Signed-off-by: zhangzujian <zhangzujian.7@gmail.com>
1 parent 490ecc0 commit 7c8c730

File tree

12 files changed

+1465
-932
lines changed

12 files changed

+1465
-932
lines changed

.github/workflows/build-x86-image.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2039,6 +2039,61 @@ jobs:
20392039
- name: Cleanup
20402040
run: timeout -k 10 180 sh -x dist/images/cleanup.sh
20412041

2042+
talos-installation-test:
2043+
name: Talos Installation Test
2044+
needs: build-kube-ovn
2045+
runs-on: ubuntu-24.04
2046+
timeout-minutes: 15
2047+
strategy:
2048+
fail-fast: false
2049+
matrix:
2050+
ip-family:
2051+
- ipv4
2052+
- ipv6
2053+
- dual
2054+
steps:
2055+
- uses: jlumbroso/free-disk-space@v1.3.1
2056+
with:
2057+
android: true
2058+
dotnet: true
2059+
haskell: true
2060+
docker-images: false
2061+
large-packages: false
2062+
tool-cache: false
2063+
swap-storage: false
2064+
2065+
- uses: actions/checkout@v4
2066+
2067+
- name: Install talosctl
2068+
run: curl -sL https://talos.dev/install | sh
2069+
2070+
- name: Install KVM and libvirt
2071+
run: sudo apt install qemu-kvm libvirt-daemon-system
2072+
2073+
- name: Download image
2074+
uses: actions/download-artifact@v4
2075+
with:
2076+
name: kube-ovn
2077+
2078+
- name: Load image
2079+
run: docker load --input kube-ovn.tar
2080+
2081+
- name: Create Talos cluster
2082+
run: |
2083+
pipx install jinjanator
2084+
make talos-init-${{ matrix.ip-family }}
2085+
2086+
- name: Install Kube-OVN
2087+
id: install
2088+
run: |
2089+
make talos-install-${{ matrix.ip-family }}
2090+
kubectl -n kube-system rollout status ds/kube-ovn-pinger
2091+
kubectl get po -o wide -A
2092+
2093+
- name: Check kube ovn pod restarts
2094+
if: ${{ success() || (failure() && steps.install.conclusion == 'failure') }}
2095+
run: make check-kube-ovn-pod-restarts
2096+
20422097
cilium-chaining-e2e:
20432098
name: Cilium Chaining E2E
20442099
needs:
@@ -3308,6 +3363,7 @@ jobs:
33083363
- underlay-logical-gateway-installation-test
33093364
- chart-test
33103365
- installation-compatibility-test
3366+
- talos-installation-test
33113367
- no-ovn-lb-test
33123368
- no-np-test
33133369
- cilium-chaining-e2e

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,10 @@ ovn-req.pem
5757
ovn-cert.pem
5858
ovn-privkey.pem
5959
anp-test-report.yaml
60+
# Generated files used for Talos testing
61+
libvirt-domain.xml
62+
talosconfig
63+
controlplane.yaml
64+
worker.yaml
65+
cluster-patch.yaml
66+
machine-patch.yaml

Makefile

Lines changed: 38 additions & 932 deletions
Large diffs are not rendered by default.

build.mk

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
# Makefile for building and pushing Docker images
2+
3+
COMMIT = git-$(shell git rev-parse --short HEAD)
4+
DATE = $(shell date +"%Y-%m-%d_%H:%M:%S")
5+
6+
GOLDFLAGS = -extldflags '-z now' -X github.com/kubeovn/kube-ovn/versions.COMMIT=$(COMMIT) -X github.com/kubeovn/kube-ovn/versions.VERSION=$(RELEASE_TAG) -X github.com/kubeovn/kube-ovn/versions.BUILDDATE=$(DATE)
7+
ifdef DEBUG
8+
GO_BUILD_FLAGS = -ldflags "$(GOLDFLAGS)"
9+
else
10+
GO_BUILD_FLAGS = -trimpath -ldflags "-w -s $(GOLDFLAGS)"
11+
endif
12+
13+
.PHONY: build-go
14+
build-go:
15+
go mod tidy
16+
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build $(GO_BUILD_FLAGS) -o $(CURDIR)/dist/images/kube-ovn -v ./cmd/cni
17+
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build $(GO_BUILD_FLAGS) -buildmode=pie -o $(CURDIR)/dist/images/kube-ovn-cmd -v ./cmd
18+
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build $(GO_BUILD_FLAGS) -buildmode=pie -o $(CURDIR)/dist/images/kube-ovn-daemon -v ./cmd/daemon
19+
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build $(GO_BUILD_FLAGS) -buildmode=pie -o $(CURDIR)/dist/images/kube-ovn-controller -v ./cmd/controller
20+
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build $(GO_BUILD_FLAGS) -o $(CURDIR)/dist/images/test-server -v ./test/server
21+
22+
.PHONY: build-go-windows
23+
build-go-windows:
24+
go mod tidy
25+
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build $(GO_BUILD_FLAGS) -o $(CURDIR)/dist/windows/kube-ovn.exe -v ./cmd/cni
26+
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build $(GO_BUILD_FLAGS) -buildmode=pie -o $(CURDIR)/dist/windows/kube-ovn-daemon.exe -v ./cmd/daemon
27+
28+
.PHONY: build-go-arm
29+
build-go-arm:
30+
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build $(GO_BUILD_FLAGS) -o $(CURDIR)/dist/images/kube-ovn -v ./cmd/cni
31+
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build $(GO_BUILD_FLAGS) -buildmode=pie -o $(CURDIR)/dist/images/kube-ovn-cmd -v ./cmd
32+
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build $(GO_BUILD_FLAGS) -buildmode=pie -o $(CURDIR)/dist/images/kube-ovn-daemon -v ./cmd/daemon
33+
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build $(GO_BUILD_FLAGS) -buildmode=pie -o $(CURDIR)/dist/images/kube-ovn-controller -v ./cmd/controller
34+
35+
.PHONY: build-kube-ovn
36+
build-kube-ovn: build-debug build-go
37+
docker build -t $(REGISTRY)/kube-ovn:$(RELEASE_TAG) --build-arg VERSION=$(RELEASE_TAG) -f dist/images/Dockerfile dist/images/
38+
docker build -t $(REGISTRY)/kube-ovn:$(LEGACY_TAG) --build-arg VERSION=$(LEGACY_TAG) -f dist/images/Dockerfile dist/images/
39+
40+
.PHONY: build-kube-ovn-dpdk
41+
build-kube-ovn-dpdk: build-go
42+
docker build -t $(REGISTRY)/kube-ovn:$(RELEASE_TAG)-dpdk --build-arg BASE_TAG=$(RELEASE_TAG)-dpdk -f dist/images/Dockerfile dist/images/
43+
44+
.PHONY: build-dev
45+
build-dev: build-go
46+
docker build -t $(REGISTRY)/kube-ovn:$(DEV_TAG) --build-arg VERSION=$(RELEASE_TAG) -f dist/images/Dockerfile dist/images/
47+
48+
.PHONY: build-debug
49+
build-debug:
50+
@DEBUG=1 $(MAKE) build-go
51+
docker build -t $(REGISTRY)/kube-ovn:$(DEBUG_TAG) --build-arg BASE_TAG=$(DEBUG_TAG) -f dist/images/Dockerfile dist/images/
52+
53+
.PHONY: base-amd64
54+
base-amd64:
55+
docker buildx build --platform linux/amd64 --build-arg ARCH=amd64 --build-arg GO_VERSION --build-arg TRIVY_DB_REPOSITORY -t $(REGISTRY)/kube-ovn-base:$(RELEASE_TAG)-amd64 -o type=docker -f dist/images/Dockerfile.base dist/images/
56+
docker buildx build --platform linux/amd64 --build-arg ARCH=amd64 --build-arg GO_VERSION --build-arg TRIVY_DB_REPOSITORY --build-arg LEGACY=true -t $(REGISTRY)/kube-ovn-base:$(LEGACY_TAG) -o type=docker -f dist/images/Dockerfile.base dist/images/
57+
docker buildx build --platform linux/amd64 --build-arg ARCH=amd64 --build-arg GO_VERSION --build-arg TRIVY_DB_REPOSITORY --build-arg DEBUG=true -t $(REGISTRY)/kube-ovn-base:$(DEBUG_TAG)-amd64 -o type=docker -f dist/images/Dockerfile.base dist/images/
58+
59+
.PHONY: base-amd64-dpdk
60+
base-amd64-dpdk:
61+
docker buildx build --platform linux/amd64 --build-arg ARCH=amd64 -t $(REGISTRY)/kube-ovn-base:$(RELEASE_TAG)-amd64-dpdk -o type=docker -f dist/images/Dockerfile.base-dpdk dist/images/
62+
63+
.PHONY: base-arm64
64+
base-arm64:
65+
docker buildx build --platform linux/arm64 --build-arg ARCH=arm64 --build-arg GO_VERSION --build-arg TRIVY_DB_REPOSITORY -t $(REGISTRY)/kube-ovn-base:$(RELEASE_TAG)-arm64 -o type=docker -f dist/images/Dockerfile.base dist/images/
66+
docker buildx build --platform linux/arm64 --build-arg ARCH=arm64 --build-arg GO_VERSION --build-arg TRIVY_DB_REPOSITORY --build-arg DEBUG=true -t $(REGISTRY)/kube-ovn-base:$(DEBUG_TAG)-arm64 -o type=docker -f dist/images/Dockerfile.base dist/images/
67+
68+
.PHONY: build-kit
69+
build-kit: build-go
70+
DOCKER_BUILDKIT=1 docker build -t $(REGISTRY)/kube-ovn:$(RELEASE_TAG) --build-arg VERSION=$(RELEASE_TAG) -o type=docker -f dist/images/Dockerfile dist/images/
71+
72+
.PHONY: image-kube-ovn
73+
image-kube-ovn: image-kube-ovn-debug build-go
74+
docker buildx build --platform linux/amd64 -t $(REGISTRY)/kube-ovn:$(RELEASE_TAG) --build-arg VERSION=$(RELEASE_TAG) -o type=docker -f dist/images/Dockerfile dist/images/
75+
docker buildx build --platform linux/amd64 -t $(REGISTRY)/kube-ovn:$(LEGACY_TAG) --build-arg VERSION=$(LEGACY_TAG) -o type=docker -f dist/images/Dockerfile dist/images/
76+
77+
.PHONY: image-kube-ovn-arm64
78+
image-kube-ovn-arm64: build-go-arm
79+
docker buildx build --platform linux/arm64 -t $(REGISTRY)/kube-ovn:$(RELEASE_TAG) --build-arg VERSION=$(RELEASE_TAG) -o type=docker -f dist/images/Dockerfile dist/images/
80+
81+
.PHONY: image-kube-ovn-debug
82+
image-kube-ovn-debug:
83+
@DEBUG=1 $(MAKE) build-go
84+
docker buildx build --platform linux/amd64 -t $(REGISTRY)/kube-ovn:$(DEBUG_TAG) --build-arg BASE_TAG=$(DEBUG_TAG) -o type=docker -f dist/images/Dockerfile dist/images/
85+
86+
.PHONY: image-kube-ovn-dpdk
87+
image-kube-ovn-dpdk: build-go
88+
docker buildx build --platform linux/amd64 -t $(REGISTRY)/kube-ovn:$(RELEASE_TAG)-dpdk --build-arg VERSION=$(RELEASE_TAG) --build-arg BASE_TAG=$(RELEASE_TAG)-dpdk -o type=docker -f dist/images/Dockerfile dist/images/
89+
90+
.PHONY: image-vpc-nat-gateway
91+
image-vpc-nat-gateway:
92+
docker buildx build --platform linux/amd64 -t $(REGISTRY)/vpc-nat-gateway:$(RELEASE_TAG) -o type=docker -f dist/images/vpcnatgateway/Dockerfile dist/images/vpcnatgateway
93+
94+
.PHOONY: image-test
95+
image-test: build-go
96+
docker buildx build --platform linux/amd64 -t $(REGISTRY)/test:$(RELEASE_TAG) -o type=docker -f dist/images/Dockerfile.test dist/images/
97+
98+
.PHONY: release
99+
release: lint image-kube-ovn image-vpc-nat-gateway
100+
101+
.PHONY: release-arm
102+
release-arm: release-arm-debug image-kube-ovn-arm64
103+
docker buildx build --platform linux/arm64 -t $(REGISTRY)/vpc-nat-gateway:$(RELEASE_TAG) -o type=docker -f dist/images/vpcnatgateway/Dockerfile dist/images/vpcnatgateway
104+
105+
.PHONY: release-arm-debug
106+
release-arm-debug:
107+
@DEBUG=1 $(MAKE) build-go-arm
108+
docker buildx build --platform linux/arm64 -t $(REGISTRY)/kube-ovn:$(DEBUG_TAG) --build-arg BASE_TAG=$(DEBUG_TAG) -o type=docker -f dist/images/Dockerfile dist/images/
109+
110+
.PHONY: push-dev
111+
push-dev:
112+
docker push $(REGISTRY)/kube-ovn:$(DEV_TAG)
113+
114+
.PHONY: push-release
115+
push-release: release
116+
docker push $(REGISTRY)/kube-ovn:$(RELEASE_TAG)
117+
118+
.PHONY: tar-kube-ovn
119+
tar-kube-ovn:
120+
docker save $(REGISTRY)/kube-ovn:$(RELEASE_TAG) $(REGISTRY)/kube-ovn:$(LEGACY_TAG) $(REGISTRY)/kube-ovn:$(DEBUG_TAG) -o kube-ovn.tar
121+
122+
.PHONY: tar-kube-ovn-dpdk
123+
tar-kube-ovn-dpdk:
124+
docker save $(REGISTRY)/kube-ovn:$(RELEASE_TAG)-dpdk -o kube-ovn-dpdk.tar
125+
126+
.PHONY: tar-vpc-nat-gateway
127+
tar-vpc-nat-gateway:
128+
docker save $(REGISTRY)/vpc-nat-gateway:$(RELEASE_TAG) -o vpc-nat-gateway.tar
129+
130+
.PHONY: tar
131+
tar: tar-kube-ovn tar-vpc-nat-gateway
132+
133+
.PHONY: base-tar-amd64
134+
base-tar-amd64:
135+
docker save $(REGISTRY)/kube-ovn-base:$(RELEASE_TAG)-amd64 $(REGISTRY)/kube-ovn-base:$(LEGACY_TAG) $(REGISTRY)/kube-ovn-base:$(DEBUG_TAG)-amd64 -o image-amd64.tar
136+
137+
.PHONY: base-tar-amd64-dpdk
138+
base-tar-amd64-dpdk:
139+
docker save $(REGISTRY)/kube-ovn-base:$(RELEASE_TAG)-amd64-dpdk -o image-amd64-dpdk.tar
140+
141+
.PHONY: base-tar-arm64
142+
base-tar-arm64:
143+
docker save $(REGISTRY)/kube-ovn-base:$(RELEASE_TAG)-arm64 $(REGISTRY)/kube-ovn-base:$(DEBUG_TAG)-arm64 -o image-arm64.tar
144+
145+
.PHONY: lint
146+
lint:
147+
ifeq ($(CI),true)
148+
@echo "Running in GitHub Actions"
149+
golangci-lint run -v
150+
else
151+
@echo "Running in local environment"
152+
golangci-lint run -v --fix
153+
endif
154+
155+
.PHONY: lint-windows
156+
lint-windows:
157+
@GOOS=windows go vet ./cmd/windows/...
158+
@GOOS=windows gosec ./pkg/util
159+
@GOOS=windows gosec ./pkg/request
160+
@GOOS=windows gosec ./cmd/cni
161+
162+
.PHONY: scan
163+
scan:
164+
trivy image --exit-code=1 --ignore-unfixed --scanners vuln $(REGISTRY)/kube-ovn:$(RELEASE_TAG)
165+
trivy image --exit-code=1 --ignore-unfixed --scanners vuln $(REGISTRY)/vpc-nat-gateway:$(RELEASE_TAG)

e2e.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Makefile for running end-to-end tests
2+
13
E2E_BUILD_FLAGS = -ldflags "-w -s"
24

35
KUBECONFIG = $(shell echo $${KUBECONFIG:-$(HOME)/.kube/config})

0 commit comments

Comments
 (0)