Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Commit 5bd643b

Browse files
authored
Merge branch 'main' into feat/enhance-troubleshooting
Signed-off-by: Shane Utt <shaneutt@linux.com>
2 parents 7c0e057 + 56379f5 commit 5bd643b

File tree

12 files changed

+522
-238
lines changed

12 files changed

+522
-238
lines changed

.github/workflows/build.yaml

Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
rust-build:
1616
runs-on: ubuntu-24.04
1717
steps:
18-
- uses: actions/checkout@v4
18+
- uses: actions/checkout@v5
1919
- uses: actions-rs/toolchain@v1
2020
with:
2121
toolchain: stable
@@ -45,7 +45,7 @@ jobs:
4545
runs-on: ubuntu-24.04
4646
steps:
4747
- name: Checkout
48-
uses: actions/checkout@85e6279cec87321a52edac9c87bce653a07cf6c2 # v4.1.7
48+
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v4.1.7
4949
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
5050
id: filter
5151
with:
@@ -58,28 +58,42 @@ jobs:
5858
- 'build/Containerfile.*'
5959
- name: Build controlplane Container Image
6060
if: steps.filter.outputs.sources
61-
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
62-
with:
63-
push: false
64-
context: .
65-
file: build/Containerfile.controlplane
66-
tags: localhost/blixt-controlplane:pr-${{ github.event.pull_request.number }}-${{ github.sha }}
61+
run: |
62+
mkdir -p target/ &&
63+
podman build \
64+
--userns=host \
65+
--file build/Containerfile.controlplane \
66+
--volume "$(pwd):/workspace" \
67+
--volume "$(pwd)/target:$(pwd)/target/" \
68+
--build-arg BUILD_TIMESTAMP="$(date +%s%3N)" \
69+
--build-arg UID="0" \
70+
--build-arg GID="0" \
71+
--build-arg WORK_DIR="$(pwd)" \
72+
--tag localhost/blixt-controlplane:pr-${{ github.event.pull_request.number }}-${{ github.sha }}
6773
- name: Build dataplane Container Image
68-
if: steps.filter.outputs.sources
69-
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
70-
with:
71-
push: false
72-
context: .
73-
file: build/Containerfile.dataplane
74-
tags: localhost/blixt-dataplane:pr-${{ github.event.pull_request.number }}-${{ github.sha }}
74+
run: |
75+
podman build \
76+
--userns=host \
77+
--file build/Containerfile.dataplane \
78+
--volume "$(pwd):/workspace" \
79+
--volume "$(pwd)/target:$(pwd)/target/" \
80+
--build-arg BUILD_TIMESTAMP="$(date +%s%3N)" \
81+
--build-arg UID="0" \
82+
--build-arg GID="0" \
83+
--build-arg WORK_DIR="$(pwd)" \
84+
--tag localhost/blixt-dataplane:pr-${{ github.event.pull_request.number }}-${{ github.sha }}
7585
- name: Build udp-test-server Container Image
76-
if: steps.filter.outputs.sources
77-
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
78-
with:
79-
push: false
80-
context: .
81-
file: build/Containerfile.udp-test-server
82-
tags: localhost/blixt-udp-test-server:pr-${{ github.event.pull_request.number }}-${{ github.sha }}
86+
run: |
87+
podman build \
88+
--userns=host \
89+
--file build/Containerfile.udp-test-server \
90+
--volume "$(pwd):/workspace" \
91+
--volume "$(pwd)/target:$(pwd)/target/" \
92+
--build-arg BUILD_TIMESTAMP="$(date +%s%3N)" \
93+
--build-arg UID="0" \
94+
--build-arg GID="0" \
95+
--build-arg WORK_DIR="$(pwd)" \
96+
--tag localhost/blixt-udp-test-server:pr-${{ github.event.pull_request.number }}-${{ github.sha }}
8397
- name: Install kind and kubectl
8498
uses: helm/kind-action@b72c923563e6e80ea66e8e8c810798cc73e97e5e # current main, includes cloud-provider-kind support
8599
if: steps.filter.outputs.sources
@@ -89,12 +103,14 @@ jobs:
89103
kubectl_version: 'v1.33.3'
90104
- name: Install Rust
91105
if: steps.filter.outputs.sources
92-
uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b # v1
106+
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
93107
with:
94108
toolchain: stable
95109
- name: Run Integration Tests
96110
if: steps.filter.outputs.sources
97111
run: |
112+
# kind load broken for podman https://github.com/kubernetes-sigs/kind/issues/3945
98113
export REGISTRY="localhost"
99114
export TAG="pr-${{ github.event.pull_request.number }}-${{ github.sha }}"
100-
make test.integration
115+
sudo chown -R "$(id -u):$(id -g)" target/
116+
make test.integration.reuse

Cargo.lock

Lines changed: 15 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,6 +1346,7 @@ dependencies = [
13461346
"aya-log",
13471347
"clap",
13481348
"common",
1349+
"thiserror 2.0.14",
13491350
"tokio",
13501351
"tracing",
13511352
"tracing-log",
@@ -1370,11 +1371,11 @@ checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
13701371

13711372
[[package]]
13721373
name = "matchers"
1373-
version = "0.1.0"
1374+
version = "0.2.0"
13741375
source = "registry+https://github.com/rust-lang/crates.io-index"
1375-
checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558"
1376+
checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9"
13761377
dependencies = [
1377-
"regex-automata 0.1.10",
1378+
"regex-automata",
13781379
]
13791380

13801381
[[package]]
@@ -1798,17 +1799,8 @@ checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
17981799
dependencies = [
17991800
"aho-corasick",
18001801
"memchr",
1801-
"regex-automata 0.4.9",
1802-
"regex-syntax 0.8.5",
1803-
]
1804-
1805-
[[package]]
1806-
name = "regex-automata"
1807-
version = "0.1.10"
1808-
source = "registry+https://github.com/rust-lang/crates.io-index"
1809-
checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
1810-
dependencies = [
1811-
"regex-syntax 0.6.29",
1802+
"regex-automata",
1803+
"regex-syntax",
18121804
]
18131805

18141806
[[package]]
@@ -1819,7 +1811,7 @@ checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
18191811
dependencies = [
18201812
"aho-corasick",
18211813
"memchr",
1822-
"regex-syntax 0.8.5",
1814+
"regex-syntax",
18231815
]
18241816

18251817
[[package]]
@@ -1828,12 +1820,6 @@ version = "0.1.6"
18281820
source = "registry+https://github.com/rust-lang/crates.io-index"
18291821
checksum = "53a49587ad06b26609c52e423de037e7f57f20d53535d66e08c695f347df952a"
18301822

1831-
[[package]]
1832-
name = "regex-syntax"
1833-
version = "0.6.29"
1834-
source = "registry+https://github.com/rust-lang/crates.io-index"
1835-
checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"
1836-
18371823
[[package]]
18381824
name = "regex-syntax"
18391825
version = "0.8.5"
@@ -2081,9 +2067,9 @@ dependencies = [
20812067

20822068
[[package]]
20832069
name = "serde_json"
2084-
version = "1.0.142"
2070+
version = "1.0.143"
20852071
source = "registry+https://github.com/rust-lang/crates.io-index"
2086-
checksum = "030fedb782600dcbd6f02d479bf0d817ac3bb40d644745b769d6a96bc3afc5a7"
2072+
checksum = "d401abef1d108fbd9cbaebc3e46611f4b1021f714a0597a71f41ee463f5f4a5a"
20872073
dependencies = [
20882074
"itoa",
20892075
"memchr",
@@ -2213,15 +2199,15 @@ checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263"
22132199

22142200
[[package]]
22152201
name = "tempfile"
2216-
version = "3.20.0"
2202+
version = "3.21.0"
22172203
source = "registry+https://github.com/rust-lang/crates.io-index"
2218-
checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1"
2204+
checksum = "15b61f8f20e3a6f7e0649d825294eaf317edce30f82cf6026e7e4cb9222a7d1e"
22192205
dependencies = [
22202206
"fastrand",
22212207
"getrandom 0.3.3",
22222208
"once_cell",
22232209
"rustix",
2224-
"windows-sys 0.59.0",
2210+
"windows-sys 0.60.2",
22252211
]
22262212

22272213
[[package]]
@@ -2522,13 +2508,13 @@ dependencies = [
25222508

25232509
[[package]]
25242510
name = "tracing-subscriber"
2525-
version = "0.3.19"
2511+
version = "0.3.20"
25262512
source = "registry+https://github.com/rust-lang/crates.io-index"
2527-
checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008"
2513+
checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5"
25282514
dependencies = [
25292515
"matchers",
25302516
"once_cell",
2531-
"regex",
2517+
"regex-automata",
25322518
"sharded-slab",
25332519
"thread_local",
25342520
"tracing",

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ network-types = { version = "0.0.8", default-features = false }
3434
prost = { version = "0.13.5", default-features = false }
3535
regex = { version = "1", default-features = true }
3636
serde = { version = "1.0.219", default-features = false }
37-
serde_json = { version = "1.0.142", default-features = false }
37+
serde_json = { version = "1.0.143", default-features = false }
3838
serde_yaml = { version = "0.9.34", default-features = false }
3939
thiserror = { version = "2.0.12", default-features = true }
4040
tokio = { version = "1.47.1", default-features = false }

Makefile

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,14 @@ clean: ## clean repo
6060
rm $(TEST_CERTS_PATH)/{*.pem,*.csr}
6161

6262
.PHONY: build
63-
build: ## Build dataplane
63+
build:
6464
cargo xtask build-ebpf
6565
cargo build
6666

67+
build.reuse:
68+
CARGO_HOME="$(WORK_DIR)/target" RUSTUP_HOME="$(WORK_DIR)/target" cargo xtask build-ebpf
69+
CARGO_HOME="$(WORK_DIR)/target" RUSTUP_HOME="$(WORK_DIR)/target" cargo build
70+
6771
.PHONY: build.release
6872
build.release: ## Build dataplane release
6973
cargo xtask build-ebpf --release
@@ -88,17 +92,26 @@ CONTROLPLANE_CONTAINERFILE ?= build/Containerfile.controlplane
8892
DATAPLANE_CONTAINERFILE ?= build/Containerfile.dataplane
8993
UDP_SERVER_CONTAINERFILE ?= build/Containerfile.udp-test-server
9094

95+
UID = $(shell id -u)
96+
GID = $(shell id -g)
97+
WORK_DIR= $(shell pwd)
98+
BUILD_TIMESTAMP = $(shell date +%s%3N)
99+
CONTAINER_BUILD_ARGS = --userns=host --volume "$(WORK_DIR):/workspace" --volume "$(WORK_DIR)/target:$(WORK_DIR)/target/" \
100+
--build-arg BUILD_TIMESTAMP="$(BUILD_TIMESTAMP)" --build-arg UID="$(UID)" --build-arg GID="$(GID)" --build-arg WORK_DIR="$(WORK_DIR)" $(BUILD_ARGS)
101+
91102
.PHONY: build.image.controlplane
92103
build.image.controlplane:
93-
$(CONTAINER_RUNTIME) build $(BUILD_ARGS) --file=$(CONTROLPLANE_CONTAINERFILE) -t $(BLIXT_CONTROLPLANE_IMAGE):$(TAG) ./
94-
104+
mkdir -p target/
105+
$(CONTAINER_RUNTIME) build $(CONTAINER_BUILD_ARGS) --file=$(CONTROLPLANE_CONTAINERFILE) --tag $(BLIXT_CONTROLPLANE_IMAGE):$(TAG)
95106
.PHONY: build.image.udp-test-server
96107
build.image.udp-test-server:
97-
$(CONTAINER_RUNTIME) build $(BUILD_ARGS) --file=$(UDP_SERVER_CONTAINERFILE) -t $(BLIXT_UDP_SERVER_IMAGE):$(TAG) ./
108+
mkdir -p target/
109+
$(CONTAINER_RUNTIME) build $(CONTAINER_BUILD_ARGS) --file=$(UDP_SERVER_CONTAINERFILE) --tag $(BLIXT_UDP_SERVER_IMAGE):$(TAG)
98110

99111
.PHONY: build.image.dataplane
100112
build.image.dataplane:
101-
$(CONTAINER_RUNTIME) build $(BUILD_ARGS) --file=$(DATAPLANE_CONTAINERFILE) -t $(BLIXT_DATAPLANE_IMAGE):$(TAG) ./
113+
mkdir -p target/
114+
$(CONTAINER_RUNTIME) build $(CONTAINER_BUILD_ARGS) --file=$(DATAPLANE_CONTAINERFILE) --tag $(BLIXT_DATAPLANE_IMAGE):$(TAG)
102115

103116
.PHONY: build.all.images
104117
build.all.images:
@@ -131,7 +144,10 @@ test:
131144
cargo test -vv --workspace --exclude tests-integration
132145

133146
test.integration:
134-
cargo test --package tests-integration
147+
cargo test --package tests-integration
148+
149+
test.integration.reuse:
150+
CARGO_HOME="$(WORK_DIR)/target" RUSTUP_HOME="$(WORK_DIR)/target" cargo test --package tests-integration
135151

136152
.PHONY: test.gencert
137153
test.gencert: cfssl cfssljson

build/Containerfile.controlplane

Lines changed: 44 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,61 @@
22
# Builder
33
# ------------------------------------------------------------------------------
44

5-
FROM rust:alpine AS builder
6-
7-
RUN apk add --no-cache clang lld
8-
9-
WORKDIR /workspace
10-
11-
ARG PROJECT_DIR=/workspace
12-
13-
ARG BUILD_DIR=$PROJECT_DIR/build
14-
15-
COPY Cargo.toml Cargo.lock ./
16-
17-
COPY controlplane/ controlplane/
18-
19-
COPY dataplane/ dataplane/
20-
21-
COPY tests-integration/ tests-integration/
22-
23-
COPY tools/ tools/
24-
25-
COPY xtask/ xtask/
26-
27-
RUN cargo build -p controlplane --target x86_64-unknown-linux-musl
5+
FROM debian:trixie-slim AS builder
6+
7+
RUN apt update \
8+
&& apt install -y build-essential rustup
9+
10+
ARG UID
11+
ARG GID
12+
ARG WORK_DIR
13+
RUN chown "${UID}:${GID}" ${WORK_DIR}
14+
USER ${UID}:${GID}
15+
16+
ENV RUSTUP_HOME=${WORK_DIR}/target
17+
# allow re-using of cargo downloads trough saving in target/
18+
ENV CARGO_HOME=${WORK_DIR}/target
19+
20+
RUN rustup install stable \
21+
&& rustup default stable
22+
23+
ARG BUILD_TIMESTAMP
24+
WORKDIR ${WORK_DIR}
25+
26+
# /workspace needs to be volume mounted
27+
# ${WORK_DIR}/target can be optionally volume mounted
28+
RUN echo "${BUILD_TIMESTAMP}" \
29+
&& date +%s \
30+
&& cp -a /workspace/Cargo.toml \
31+
/workspace/Cargo.lock \
32+
/workspace/.cargo/ \
33+
/workspace/controlplane/ \
34+
/workspace/dataplane/ \
35+
/workspace/tests-integration/ \
36+
/workspace/tools/ \
37+
/workspace/xtask/ \
38+
${WORK_DIR}
39+
40+
RUN date +%s \
41+
&& cargo build --package controlplane \
42+
&& date +%s \
43+
&& mkdir -p results/ \
44+
&& cp target/debug/controller results/
2845

2946
# ------------------------------------------------------------------------------
3047
# Image
3148
# ------------------------------------------------------------------------------
3249

33-
FROM alpine:latest
50+
FROM debian:trixie-slim
3451

3552
LABEL org.opencontainers.image.source=https://github.com/kubernetes-sigs/blixt
3653

3754
WORKDIR /
3855

3956
USER 1000:1000
4057

41-
COPY --from=builder /workspace/target/x86_64-unknown-linux-musl/debug/controller /controller
58+
ARG WORK_DIR
59+
60+
COPY --from=builder ${WORK_DIR}/results/controller /controller
4261

4362
ENTRYPOINT [ "/controller" ]

0 commit comments

Comments
 (0)