Skip to content

Commit ca9b077

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

15 files changed

+362
-129
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

+65-3
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ jobs:
2626
group:
2727
- e2e
2828
- e2e-instrumentation
29-
- e2e-upgrade
29+
# - e2e-upgrade
3030
- e2e-autoscale
31-
- e2e-pdb
31+
# - e2e-pdb
3232
- e2e-opampbridge
33-
- e2e-prometheuscr
33+
# - e2e-prometheuscr
3434
- e2e-multi-instrumentation
3535
include:
3636
- group: e2e-prometheuscr
@@ -85,3 +85,65 @@ 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-prometheuscr
106+
- e2e-upgrade
107+
# - e2e-opampbridge
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: |
148+
set -e
149+
make e2e-log-operator KUBE_VERSION=$KUBE_VERSION

Makefile

+23-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,25 @@ 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 PrometheusCR E2E tests
262+
.PHONY: chainsaw-e2e-prometheuscr
263+
chainsaw-e2e-prometheuscr:
264+
chainsaw test --test-dir ./tests/e2e-prometheuscr
265+
266+
# end-to-end-test for testing upgrading
267+
.PHONY: chainsaw-e2e-upgrade
268+
chainsaw-e2e-upgrade: undeploy
269+
chainsaw test --test-dir ./tests/e2e-upgrade
270+
249271
.PHONY: prepare-e2e
250272
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
251273

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
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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: create-pm-prometheus-exporters
7+
spec:
8+
steps:
9+
- name: step-00
10+
try:
11+
- apply:
12+
file: 00-install.yaml
13+
- name: step-01
14+
try:
15+
- apply:
16+
file: 01-install-app.yaml
17+
- assert:
18+
file: 01-assert.yaml

tests/e2e-prometheuscr/create-sm-prometheus-exporters/07-delete.yaml

-8
This file was deleted.

tests/e2e-prometheuscr/create-sm-prometheus-exporters/08-install.yaml

-113
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: v1
2+
automountServiceAccountToken: true
3+
kind: ServiceAccount
4+
metadata:
5+
name: ta
6+
namespace: create-sm-prometheus
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRole
3+
metadata:
4+
name: ta
5+
rules:
6+
- apiGroups:
7+
- ""
8+
resources:
9+
- pods
10+
- nodes
11+
- services
12+
- endpoints
13+
- configmaps
14+
- secrets
15+
- namespaces
16+
verbs:
17+
- get
18+
- watch
19+
- list
20+
- apiGroups:
21+
- apps
22+
resources:
23+
- statefulsets
24+
- services
25+
- endpoints
26+
verbs:
27+
- get
28+
- watch
29+
- list
30+
- apiGroups:
31+
- discovery.k8s.io
32+
resources:
33+
- endpointslices
34+
verbs:
35+
- get
36+
- watch
37+
- list
38+
- apiGroups:
39+
- networking.k8s.io
40+
resources:
41+
- ingresses
42+
verbs:
43+
- get
44+
- watch
45+
- list
46+
- apiGroups:
47+
- monitoring.coreos.com
48+
resources:
49+
- servicemonitors
50+
- podmonitors
51+
verbs:
52+
- get
53+
- watch
54+
- list
55+
- nonResourceURLs:
56+
- /metrics
57+
verbs:
58+
- get

0 commit comments

Comments
 (0)