Skip to content

Commit 86c2f0b

Browse files
committed
Merge remote-tracking branch 'upstream/master' into etcd-defrag-no-timeout
2 parents 09cea43 + e93317e commit 86c2f0b

File tree

177 files changed

+10398
-5144
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

177 files changed

+10398
-5144
lines changed

.github/actions/vagrant-setup/action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ runs:
1212
shell: bash
1313
run: |
1414
sudo apt-get update
15-
sudo apt-get install -y libvirt-daemon libvirt-daemon-system vagrant ruby-libvirt
15+
sudo apt-get install -y libvirt-daemon libvirt-daemon-system vagrant=2.4.1-1 ruby-libvirt
1616
sudo systemctl enable --now libvirtd
1717
- name: Install vagrant dependencies
1818
shell: bash

.github/workflows/build-k3s.yaml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ name: Build K3s
33
on:
44
workflow_call:
55
inputs:
6+
arch:
7+
type: string
8+
description: 'Architecture to build'
9+
default: 'ubuntu-latest'
610
upload-repo:
711
type: boolean
812
required: false
@@ -18,7 +22,7 @@ permissions:
1822
jobs:
1923
build:
2024
name: Build
21-
runs-on: ubuntu-latest
25+
runs-on: ${{ inputs.arch }} # defaults to ubuntu-latest, for arm64 use ubuntu-24.04-arm
2226
timeout-minutes: 20
2327
steps:
2428
- name: Checkout K3s
@@ -44,9 +48,15 @@ jobs:
4448
- name: "Save K3s image"
4549
if: inputs.upload-image == true
4650
run: docker image save rancher/k3s -o ./dist/artifacts/k3s-image.tar
47-
- name: "Upload K3s binary"
48-
if: inputs.upload-repo == false
51+
- name: "Upload K3s Artifacts"
52+
if: inputs.upload-repo == false && inputs.arch == 'ubuntu-latest'
4953
uses: actions/upload-artifact@v4
5054
with:
5155
name: k3s
56+
path: dist/artifacts/k3s*
57+
- name: "Upload K3s arm64 Artifacts"
58+
if: contains(inputs.arch, 'arm')
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: k3s-arm64
5262
path: dist/artifacts/k3s*

.github/workflows/e2e.yaml

Lines changed: 98 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ jobs:
3232
uses: ./.github/workflows/build-k3s.yaml
3333
with:
3434
upload-image: true
35+
build-arm64:
36+
uses: ./.github/workflows/build-k3s.yaml
37+
with:
38+
arch: ubuntu-24.04-arm
39+
upload-image: true
3540
e2e:
3641
name: "E2E Tests"
3742
needs: build
@@ -40,7 +45,7 @@ jobs:
4045
strategy:
4146
fail-fast: false
4247
matrix:
43-
etest: [startup, s3, btrfs, externalip, privateregistry, embeddedmirror, wasm]
48+
etest: [autoimport, startup, s3, btrfs, externalip, privateregistry, embeddedmirror, wasm]
4449
max-parallel: 3
4550
steps:
4651
- name: "Checkout"
@@ -80,44 +85,118 @@ jobs:
8085
chmod +x ./dist/artifacts/k3s
8186
cd tests/e2e/${{ matrix.etest }}
8287
go test -v -timeout=45m ./${{ matrix.etest}}_test.go -ci -local
88+
- name: On Failure, Upload Journald Logs
89+
uses: actions/upload-artifact@v4
90+
if: ${{ failure() }}
91+
with:
92+
name: ${{ matrix.etest}}-journald-logs
93+
path: tests/e2e/${{ matrix.etest }}/*-jlog.txt
94+
retention-days: 30
8395
- name: On Failure, Launch Debug Session
8496
uses: lhotari/action-upterm@v1
8597
if: ${{ failure() }}
8698
with:
8799
## If no one connects after 5 minutes, shut down server.
88100
wait-timeout-minutes: 5
89101
- name: Upload Results To Codecov
90-
uses: codecov/codecov-action@v4
102+
uses: codecov/codecov-action@v5
91103
with:
92104
token: ${{ secrets.CODECOV_TOKEN }}
93105
files: tests/e2e/${{ matrix.etest }}/coverage.out
94106
flags: e2etests # optional
95107
verbose: true # optional (default = false)
96-
docker:
97-
needs: build
98-
name: Docker Tests
99-
runs-on: ubuntu-latest
100-
timeout-minutes: 20
108+
109+
build-go-tests:
110+
name: "Build Go Tests"
101111
strategy:
102-
fail-fast: false
103112
matrix:
104-
dtest: [basics, bootstraptoken, cacerts, compat, lazypull, upgrade]
113+
arch: [amd64, arm64]
114+
runs-on: ${{ matrix.arch == 'arm64' && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
115+
outputs:
116+
channel: ${{ steps.channel_step.outputs.channel }}
105117
steps:
106118
- name: Checkout
107119
uses: actions/checkout@v4
120+
- name: Install Go
121+
uses: ./.github/actions/setup-go
122+
- name: Build Go Tests
123+
run: |
124+
mkdir -p ./dist/artifacts
125+
go test -c -ldflags="-w -s" -o ./dist/artifacts ./tests/docker/...
126+
- name: Upload Go Tests
127+
uses: actions/upload-artifact@v4
108128
with:
109-
fetch-depth: 1
110-
- name: "Download k3s image"
129+
name: docker-go-tests-${{ matrix.arch }}
130+
path: ./dist/artifacts/*.test
131+
compression-level: 9
132+
retention-days: 1
133+
# For upgrade and skew tests, we need to know the channel this run is based off.
134+
# Since this is predetermined, we can run this step before the actual test job, saving time.
135+
- name: Determine channel
136+
id: channel_step
137+
run: |
138+
. ./scripts/version.sh
139+
MINOR_VER=$(echo $VERSION_TAG | cut -d'.' -f1,2)
140+
echo "CHANNEL=$MINOR_VER" >> $GITHUB_OUTPUT
141+
# channel name should be v1.XX or latest
142+
- name: Fail if channel name does not match pattern
143+
run: |
144+
if [[ ! ${{ steps.channel_step.outputs.channel }} =~ ^v1\.[0-9]+$|latest$ ]]; then
145+
echo "Channel name ${{ steps.channel_step.outputs.channel }} does not match pattern"
146+
exit 1
147+
fi
148+
149+
docker-go:
150+
needs: [build, build-arm64, build-go-tests]
151+
name: Docker
152+
timeout-minutes: 30
153+
strategy:
154+
fail-fast: false
155+
matrix:
156+
dtest: [basics, bootstraptoken, cacerts, etcd, lazypull, skew, snapshotrestore, upgrade]
157+
arch: [amd64, arm64]
158+
runs-on: ${{ matrix.arch == 'arm64' && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
159+
env:
160+
CHANNEL: ${{ needs.build-go-tests.outputs.channel }}
161+
steps:
162+
- name: Checkout
163+
uses: actions/checkout@v4
164+
- name: "Download K3s image (amd64)"
165+
if: ${{ matrix.arch == 'amd64' }}
111166
uses: actions/download-artifact@v4
112167
with:
113168
name: k3s
114169
path: ./dist/artifacts
115-
- name: Load k3s image
116-
run: docker image load -i ./dist/artifacts/k3s-image.tar
117-
- name: Run ${{ matrix.dtest }} Test
118-
run: |
170+
- name: "Download K3s image (arm64)"
171+
if: ${{ matrix.arch == 'arm64' }}
172+
uses: actions/download-artifact@v4
173+
with:
174+
name: k3s-arm64
175+
path: ./dist/artifacts
176+
- name: Load and set K3s image
177+
run: |
178+
if [ ${{ matrix.arch }} = "arm64" ]; then
179+
mv ./dist/artifacts/k3s-arm64 ./dist/artifacts/k3s
180+
fi
119181
chmod +x ./dist/artifacts/k3s
120-
. ./scripts/version.sh
121-
. ./tests/docker/test-helpers
122-
. ./tests/docker/test-run-${{ matrix.dtest }}
123-
echo "Did test-run-${{ matrix.dtest }} pass $?"
182+
docker image load -i ./dist/artifacts/k3s-image.tar
183+
IMAGE_TAG=$(docker image ls --format '{{.Repository}}:{{.Tag}}' | grep 'rancher/k3s')
184+
echo "K3S_IMAGE=$IMAGE_TAG" >> $GITHUB_ENV
185+
- name: Download Go Tests
186+
uses: actions/download-artifact@v4
187+
with:
188+
name: docker-go-tests-${{ matrix.arch }}
189+
path: ./dist/artifacts
190+
- name: Run ${{ matrix.dtest }} Test
191+
# Put the compiled test binary back in the same place as the test source
192+
run: |
193+
chmod +x ./dist/artifacts/${{ matrix.dtest }}.test
194+
mv ./dist/artifacts/${{ matrix.dtest }}.test ./tests/docker/${{ matrix.dtest }}/
195+
cd ./tests/docker/${{ matrix.dtest }}
196+
if [ ${{ matrix.dtest }} = "upgrade" ] || [ ${{ matrix.dtest }} = "skew" ]; then
197+
./${{ matrix.dtest }}.test -k3sImage=$K3S_IMAGE -channel=$CHANNEL
198+
elif [ ${{ matrix.dtest }} = "snapshotrestore" ]; then
199+
./${{ matrix.dtest }}.test -ci
200+
else
201+
./${{ matrix.dtest }}.test -k3sImage=$K3S_IMAGE
202+
fi

.github/workflows/integration.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
- name: Generate coverage report
6767
run: go tool covdata textfmt -i $GOCOVERDIR -o ${{ matrix.itest }}.out
6868
- name: Upload Results To Codecov
69-
uses: codecov/codecov-action@v4
69+
uses: codecov/codecov-action@v5
7070
with:
7171
token: ${{ secrets.CODECOV_TOKEN }}
7272
files: ./${{ matrix.itest }}.out

.github/workflows/stale.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Close Stale Issues
14-
uses: actions/stale@v9.0.0
14+
uses: actions/stale@v9.1.0
1515
with:
1616
# ensure PRs are exempt
1717
days-before-pr-stale: -1

.github/workflows/trivy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
run: curl -fsSO https://raw.githubusercontent.com/rancher/vexhub/refs/heads/main/reports/rancher.openvex.json
4545

4646
- name: Run Trivy vulnerability scanner
47-
uses: aquasecurity/trivy-action@0.27.0
47+
uses: aquasecurity/trivy-action@0.29.0
4848
with:
4949
image-ref: 'rancher/k3s:latest'
5050
format: 'table'

.github/workflows/unitcoverage.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
with:
4848
wait-timeout-minutes: 5
4949
- name: Upload Results To Codecov
50-
uses: codecov/codecov-action@v4
50+
uses: codecov/codecov-action@v5
5151
with:
5252
token: ${{ secrets.CODECOV_TOKEN }}
5353
files: ./coverage.out

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ If you're interested in contributing documentation, please note the following:
1414

1515
If you're interested in contributing new tests, please see the [TESTING.md](./tests/TESTING.md).
1616

17-
## Code Convetion
17+
## Code Convention
1818

19-
See the [code convetions documentation](./docs/contrib/code_conventions.md) for more information on how to write code for K3s.
19+
See the [code conventions documentation](./docs/contrib/code_conventions.md) for more information on how to write code for K3s.
2020

2121
### Opening PRs and organizing commits
2222
PRs should generally address only 1 issue at a time. If you need to fix two bugs, open two separate PRs. This will keep the scope of your pull requests smaller and allow them to be reviewed and merged more quickly.

Dockerfile.dapper

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG GOLANG=golang:1.22.6-alpine3.20
1+
ARG GOLANG=golang:1.23.4-alpine3.20
22
FROM ${GOLANG}
33

44
# Set proxy environment variables
@@ -22,7 +22,7 @@ RUN apk -U --no-cache add \
2222
RUN PIPX_BIN_DIR=/usr/local/bin pipx install awscli
2323

2424
# Install Trivy
25-
ENV TRIVY_VERSION="0.56.2"
25+
ENV TRIVY_VERSION="0.59.0"
2626
RUN case "$(go env GOARCH)" in \
2727
arm64) TRIVY_ARCH="ARM64" ;; \
2828
amd64) TRIVY_ARCH="64bit" ;; \

Dockerfile.local

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
ARG GOLANG=golang:1.22.6-alpine3.19
2-
FROM ${GOLANG} as infra
1+
ARG GOLANG=golang:1.23.4-alpine3.20
2+
FROM ${GOLANG} AS infra
33

4-
ARG http_proxy=$http_proxy
5-
ARG https_proxy=$https_proxy
6-
ARG no_proxy=$no_proxy
4+
ARG http_proxy
5+
ARG https_proxy
6+
ARG no_proxy
77
ENV http_proxy=$http_proxy
88
ENV https_proxy=$https_proxy
99
ENV no_proxy=$no_proxy
@@ -28,13 +28,13 @@ RUN if [ "$(go env GOARCH)" = "amd64" ]; then \
2828
fi
2929

3030
ARG SELINUX=true
31-
ENV SELINUX $SELINUX
32-
ENV STATIC_BUILD true
31+
ENV SELINUX=$SELINUX
32+
ENV STATIC_BUILD=true
3333
ENV SRC_DIR=/go/src/github.com/k3s-io/k3s
3434
WORKDIR ${SRC_DIR}/
3535

3636

37-
FROM infra as build
37+
FROM infra AS build
3838

3939
ARG SKIP_VALIDATE
4040

@@ -60,7 +60,7 @@ RUN --mount=type=cache,id=gomod,target=/go/pkg/mod \
6060

6161
RUN ./scripts/binary_size_check.sh
6262

63-
FROM scratch as result
63+
FROM scratch AS result
6464
ENV SRC_DIR=/go/src/github.com/k3s-io/k3s
6565
COPY --from=build ${SRC_DIR}/dist /dist
6666
COPY --from=build ${SRC_DIR}/bin /bin

0 commit comments

Comments
 (0)