Skip to content

Commit

Permalink
chore: migrate from kuttl to chainsaw
Browse files Browse the repository at this point in the history
Signed-off-by: Charles-Edouard Brétéché <[email protected]>
  • Loading branch information
eddycharly committed Feb 15, 2024
1 parent 121c496 commit 97304d4
Show file tree
Hide file tree
Showing 485 changed files with 5,441 additions and 6,347 deletions.
13 changes: 13 additions & 0 deletions .chainsaw.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/configuration-chainsaw-v1alpha1.json
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Configuration
metadata:
creationTimestamp: null
name: configuration
spec:
timeouts:
assert: 3m0s
cleanup: 3m0s
delete: 3m0s
error: 3m0s
exec: 3m0s
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,5 @@ e2e-tests/conf/cloud-secret.yml
# Kubernetes Generated files - skip generated files, except for vendored files
!vendor/**/zz_generated.*

# Kuttl
kubeconfig
kind-logs-*/

# Other
gke_gcloud_auth_plugin_cache
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,11 @@ Contributions to the source tree should follow the workflow described below:
Run the command `make test`.
2. E2E tests

For e2e test we are using [kuttl](https://kuttl.dev/). To run a single test call:
For e2e test we are using [chainsaw](https://kyverno.github.io/chainsaw/). To run a single test call:

`kubectl kuttl test --config ./e2e-tests/kuttl.yaml --test ^<test-name>/$` where the `<test-name>` is the folder inside `e2e-tests/tests`.
`chainsaw test ./e2e-tests/tests/<test-name>` where the `<test-name>` is the folder inside `e2e-tests/tests`.

By default kuttl will delete created test namespace after test is finished, you can add `--skip-delete` flag in order to prevent deletion for potential troubleshooting.
By default chainsaw will delete created test namespace after test is finished, you can add `--skip-delete` flag in order to prevent deletion for potential troubleshooting.

**Running the Operator locally**

Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ vet: ## Run go vet against code.
test: manifests generate fmt vet envtest ## Run tests.
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./... -coverprofile cover.out

kuttl-shfmt:
chainsaw-shfmt:
shfmt -bn -ci -s -w e2e-tests/functions
find e2e-tests/tests/ -type f -not -name '*-assert.yaml' -name '*.yaml' | xargs ./e2e-tests/format

e2e-test: kuttl-shfmt
ROOT_REPO=$(ROOT_REPO) kubectl kuttl test --config e2e-tests/kuttl.yaml
e2e-test: chainsaw-shfmt
ROOT_REPO=$(ROOT_REPO) chainsaw test ./e2e-tests/tests

manifests: kustomize generate
$(KUSTOMIZE) build config/crd/ > $(DEPLOYDIR)/crd.yaml
Expand Down
5 changes: 0 additions & 5 deletions e2e-tests/kuttl.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions e2e-tests/tests/async-ignore-annotations/00-assert.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
timeout: 120
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
Expand Down
13 changes: 0 additions & 13 deletions e2e-tests/tests/async-ignore-annotations/00-deploy-operator.yaml

This file was deleted.

32 changes: 14 additions & 18 deletions e2e-tests/tests/async-ignore-annotations/01-assert.yaml
Original file line number Diff line number Diff line change
@@ -1,49 +1,45 @@
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
timeout: 600
---
kind: StatefulSet
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: async-ignore-annotations-mysql
status:
collisionCount: 0
currentReplicas: 3
observedGeneration: 1
replicas: 3
readyReplicas: 3
currentReplicas: 3
replicas: 3
updatedReplicas: 3
collisionCount: 0
---
kind: StatefulSet
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: async-ignore-annotations-orc
status:
collisionCount: 0
currentReplicas: 3
observedGeneration: 1
replicas: 3
readyReplicas: 3
currentReplicas: 3
replicas: 3
updatedReplicas: 3
collisionCount: 0
---
kind: StatefulSet
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: async-ignore-annotations-haproxy
status:
collisionCount: 0
currentReplicas: 3
observedGeneration: 1
replicas: 3
readyReplicas: 3
currentReplicas: 3
replicas: 3
updatedReplicas: 3
collisionCount: 0
---
apiVersion: ps.percona.com/v1alpha1
kind: PerconaServerMySQL
metadata:
name: async-ignore-annotations
finalizers:
- delete-mysql-pods-in-order
- delete-mysql-pods-in-order
name: async-ignore-annotations
status:
haproxy:
ready: 3
Expand Down
17 changes: 0 additions & 17 deletions e2e-tests/tests/async-ignore-annotations/01-create-cluster.yaml

This file was deleted.

This file was deleted.

28 changes: 12 additions & 16 deletions e2e-tests/tests/async-ignore-annotations/02-assert.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
timeout: 120
---
apiVersion: v1
kind: Service
metadata:
annotations:
async-annotations-not-to-ignore-mysql: "true"
async-annotations-to-ignore-mysql: "true"
labels:
async-labels-to-ignore-mysql: "true"
async-labels-not-to-ignore-mysql: "true"
app.kubernetes.io/component: mysql
app.kubernetes.io/instance: async-ignore-annotations
app.kubernetes.io/managed-by: percona-server-operator
app.kubernetes.io/name: percona-server
app.kubernetes.io/part-of: percona-server
async-labels-not-to-ignore-mysql: "true"
async-labels-to-ignore-mysql: "true"
percona.com/exposed: "true"
annotations:
async-annotations-to-ignore-mysql: "true"
async-annotations-not-to-ignore-mysql: "true"
name: async-ignore-annotations-mysql-0
ownerReferences:
- apiVersion: ps.percona.com/v1alpha1
Expand Down Expand Up @@ -54,17 +50,17 @@ spec:
apiVersion: v1
kind: Service
metadata:
annotations:
async-annotations-not-to-ignore-haproxy: "true"
async-annotations-to-ignore-haproxy: "true"
labels:
async-labels-to-ignore-haproxy: "true"
async-labels-not-to-ignore-haproxy: "true"
app.kubernetes.io/component: haproxy
app.kubernetes.io/instance: async-ignore-annotations
app.kubernetes.io/managed-by: percona-server-operator
app.kubernetes.io/name: percona-server
app.kubernetes.io/part-of: percona-server
annotations:
async-annotations-to-ignore-haproxy: "true"
async-annotations-not-to-ignore-haproxy: "true"
async-labels-not-to-ignore-haproxy: "true"
async-labels-to-ignore-haproxy: "true"
name: async-ignore-annotations-haproxy
ownerReferences:
- apiVersion: ps.percona.com/v1alpha1
Expand Down Expand Up @@ -110,16 +106,16 @@ apiVersion: v1
kind: Service
metadata:
annotations:
async-annotations-to-ignore-orc: "true"
async-annotations-not-to-ignore-orc: "true"
async-annotations-to-ignore-orc: "true"
labels:
app.kubernetes.io/component: orc
app.kubernetes.io/instance: async-ignore-annotations
app.kubernetes.io/managed-by: percona-server-operator
app.kubernetes.io/name: percona-server
app.kubernetes.io/part-of: percona-server
async-labels-to-ignore-orc: "true"
async-labels-not-to-ignore-orc: "true"
async-labels-to-ignore-orc: "true"
percona.com/exposed: "true"
name: async-ignore-annotations-orc-0
ownerReferences:
Expand Down

This file was deleted.

17 changes: 6 additions & 11 deletions e2e-tests/tests/async-ignore-annotations/03-assert.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
timeout: 120
---
apiVersion: ps.percona.com/v1alpha1
kind: PerconaServerMySQL
metadata:
name: async-ignore-annotations
spec:
ignoreAnnotations:
- async-annotations-to-ignore-mysql
- async-annotations-to-ignore-haproxy
- async-annotations-to-ignore-orc
- async-annotations-to-ignore-mysql
- async-annotations-to-ignore-haproxy
- async-annotations-to-ignore-orc
ignoreLabels:
- async-labels-to-ignore-mysql
- async-labels-to-ignore-haproxy
- async-labels-to-ignore-orc

- async-labels-to-ignore-mysql
- async-labels-to-ignore-haproxy
- async-labels-to-ignore-orc
status:
haproxy:
ready: 3
Expand Down

This file was deleted.

24 changes: 10 additions & 14 deletions e2e-tests/tests/async-ignore-annotations/04-assert.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
timeout: 20
---
apiVersion: v1
kind: Service
metadata:
annotations:
async-annotations-to-ignore-mysql: "true"
service.beta.kubernetes.io/aws-load-balancer-backend: test-type
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: http
labels:
async-labels-to-ignore-mysql: "true"
app.kubernetes.io/component: mysql
app.kubernetes.io/instance: async-ignore-annotations
app.kubernetes.io/managed-by: percona-server-operator
app.kubernetes.io/name: percona-server
app.kubernetes.io/part-of: percona-server
async-labels-to-ignore-mysql: "true"
percona.com/exposed: "true"
rack: rack-22
rack-test: rack-test-22
annotations:
async-annotations-to-ignore-mysql: "true"
service.beta.kubernetes.io/aws-load-balancer-backend: test-type
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: http
name: async-ignore-annotations-mysql-0
ownerReferences:
- apiVersion: ps.percona.com/v1alpha1
Expand Down Expand Up @@ -58,19 +54,19 @@ spec:
apiVersion: v1
kind: Service
metadata:
annotations:
async-annotations-to-ignore-haproxy: "true"
service.beta.kubernetes.io/aws-load-balancer-backend: test-type
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: http
labels:
async-labels-to-ignore-haproxy: "true"
app.kubernetes.io/component: haproxy
app.kubernetes.io/instance: async-ignore-annotations
app.kubernetes.io/managed-by: percona-server-operator
app.kubernetes.io/name: percona-server
app.kubernetes.io/part-of: percona-server
async-labels-to-ignore-haproxy: "true"
rack: rack-22
rack-test: rack-test-22
annotations:
async-annotations-to-ignore-haproxy: "true"
service.beta.kubernetes.io/aws-load-balancer-backend: test-type
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: http
name: async-ignore-annotations-haproxy
ownerReferences:
- apiVersion: ps.percona.com/v1alpha1
Expand Down
Loading

0 comments on commit 97304d4

Please sign in to comment.