Skip to content

Commit eaaa321

Browse files
committed
chore: migrate from kuttl to chainsaw
Signed-off-by: Charles-Edouard Brétéché <[email protected]>
1 parent 94c8420 commit eaaa321

File tree

7 files changed

+142
-5
lines changed

7 files changed

+142
-5
lines changed

.chainsaw.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/configuration-chainsaw-v1alpha1.json
2+
apiVersion: chainsaw.kyverno.io/v1alpha1
3+
kind: Configuration
4+
metadata:
5+
name: configuration
6+
spec:
7+
parallel: 4
8+
timeouts:
9+
assert: 5m0s
10+
cleanup: 5m0s
11+
delete: 5m0s
12+
error: 5m0s

.github/workflows/e2e.yaml

+60
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,63 @@ jobs:
8585
echo "One or more matrix jobs failed."
8686
false
8787
fi
88+
89+
chainsaw-tests:
90+
runs-on: ubuntu-22.04
91+
strategy:
92+
fail-fast: false
93+
matrix:
94+
# The e2e tests are run on the lowest and highest supported k8s version.
95+
# All Kubernetes version in between expose the same APIs, hence the operator
96+
# should be compatible with them.
97+
kube-version:
98+
- "1.23"
99+
- "1.29"
100+
group:
101+
# - e2e
102+
# - e2e-instrumentation
103+
# - e2e-autoscale
104+
- e2e-pdb
105+
- e2e-upgrade
106+
# - e2e-opampbridge
107+
# - e2e-prometheuscr
108+
# - e2e-multi-instrumentation
109+
include:
110+
- group: e2e-prometheuscr
111+
setup: "prepare-e2e-with-featuregates FEATUREGATES=+operator.observability.prometheus"
112+
- group: e2e-multi-instrumentation
113+
setup: "prepare-e2e-with-featuregates FEATUREGATES=+operator.autoinstrumentation.multi-instrumentation"
114+
115+
steps:
116+
- name: Check out code into the Go module directory
117+
uses: actions/checkout@v4
118+
- name: Set up Go
119+
uses: actions/setup-go@v5
120+
with:
121+
go-version: "~1.21.3"
122+
- name: Cache tools
123+
uses: actions/cache@v4
124+
with:
125+
path: bin
126+
key: ${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('Makefile') }}
127+
- name: Install tools
128+
run: make install-tools
129+
- name: Install chainsaw
130+
uses: kyverno/action-install-chainsaw@07b6c986572f2abaf6647c85d37cbecfddc4a6ab # v0.1.3
131+
- name: Prepare e2e tests
132+
env:
133+
KUBE_VERSION: ${{ matrix.kube-version }}
134+
run: |
135+
set -e
136+
make ${{ matrix.setup != '' && matrix.setup || 'prepare-e2e' }} KUBE_VERSION=$KUBE_VERSION VERSION=e2e
137+
- name: Run e2e tests
138+
env:
139+
KUBE_VERSION: ${{ matrix.kube-version }}
140+
run: |
141+
set -e
142+
make chainsaw-${{ matrix.group }}
143+
- name: "log operator if failed"
144+
if: ${{ failure() }}
145+
env:
146+
KUBE_VERSION: ${{ matrix.kube-version }}
147+
run: make e2e-log-operator KUBE_VERSION=$KUBE_VERSION

Makefile

+18-1
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,15 @@ lint: golangci-lint
195195
generate: controller-gen
196196
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
197197

198+
#########
199+
# KUTTL #
200+
#########
201+
198202
# end-to-tests
199203
.PHONY: e2e
200204
e2e:
201205
$(KUTTL) test
202206

203-
204207
# instrumentation end-to-tests
205208
.PHONY: e2e-instrumentation
206209
e2e-instrumentation:
@@ -246,6 +249,20 @@ e2e-multi-instrumentation:
246249
e2e-opampbridge:
247250
$(KUTTL) test --config kuttl-test-opampbridge.yaml
248251

252+
############
253+
# CHAINSAW #
254+
############
255+
256+
# end-to-end-test for testing pdb support
257+
.PHONY: chainsaw-e2e-pdb
258+
chainsaw-e2e-pdb:
259+
chainsaw test --test-dir ./tests/e2e-pdb
260+
261+
# end-to-end-test for testing upgrading
262+
.PHONY: chainsaw-e2e-upgrade
263+
chainsaw-e2e-upgrade: undeploy
264+
chainsaw test --test-dir ./tests/e2e-upgrade
265+
249266
.PHONY: prepare-e2e
250267
prepare-e2e: kuttl set-image-controller add-image-targetallocator add-image-opampbridge container container-target-allocator container-operator-opamp-bridge start-kind cert-manager install-metrics-server install-targetallocator-prometheus-crds load-image-all deploy
251268

tests/e2e-pdb/pdb/chainsaw-test.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json
2+
apiVersion: chainsaw.kyverno.io/v1alpha1
3+
kind: Test
4+
metadata:
5+
creationTimestamp: null
6+
name: pdb
7+
spec:
8+
steps:
9+
- name: step-00
10+
try:
11+
- apply:
12+
file: 00-install.yaml
13+
- assert:
14+
file: 00-assert.yaml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json
2+
apiVersion: chainsaw.kyverno.io/v1alpha1
3+
kind: Test
4+
metadata:
5+
creationTimestamp: null
6+
name: target-allocator
7+
spec:
8+
steps:
9+
- name: step-00
10+
try:
11+
- apply:
12+
file: 00-install.yaml
13+
- assert:
14+
file: 00-assert.yaml

tests/e2e-upgrade/upgrade-test/01-upgrade-operator.yaml

-4
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json
2+
apiVersion: chainsaw.kyverno.io/v1alpha1
3+
kind: Test
4+
metadata:
5+
creationTimestamp: null
6+
name: upgrade-test
7+
spec:
8+
steps:
9+
- name: step-00
10+
try:
11+
- apply:
12+
file: 00-install.yaml
13+
- assert:
14+
file: 00-assert.yaml
15+
- name: step-01
16+
try:
17+
- script:
18+
content: cd ../../../ && make deploy VERSION=e2e
19+
- name: step-02
20+
try:
21+
- apply:
22+
file: 02-upgrade-collector.yaml
23+
- assert:
24+
file: 02-assert.yaml

0 commit comments

Comments
 (0)