Skip to content

Commit

Permalink
* Add kind config yamls.
Browse files Browse the repository at this point in the history
* Add kuttl test for management API heap size.
* Add kuttl makefile targets.
  • Loading branch information
Miles-Garnsey committed Dec 1, 2021
1 parent 1dc67e4 commit 7e7185d
Show file tree
Hide file tree
Showing 13 changed files with 158 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ build
*~
clientconfig
.vscode/
.devcontainer/
.devcontainer/
kind-log*/
kubeconfig
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -315,3 +315,16 @@ catalog-build: opm ## Build a catalog image.
.PHONY: catalog-push
catalog-push: ## Push a catalog image.
$(MAKE) docker-push IMG=$(CATALOG_IMG)

# E2E tests from kuttl
kuttl-test: install-kuttl docker-build
./bin/kubectl-kuttl test --kind-config=${KUTTL_KIND_CFG}

# Install kuttl for e2e tests.
install-kuttl:
mkdir -p ./bin ; \
cd ./bin ; \
OS="$$(uname | tr '[:upper:]' '[:lower:]')" ; \
ARCH="$$(uname -m | sed -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$$/arm64/')" ; \
curl -LO https://github.com/kudobuilder/kuttl/releases/download/v0.11.1/kuttl_0.11.1_$${OS}_$${ARCH}.tar.gz ; \
tar -zxvf kuttl_0.11.1_$${OS}_$${ARCH}.tar.gz ;
13 changes: 13 additions & 0 deletions kuttl-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: kuttl.dev/v1beta1
kind: TestSuite
testDirs:
- ./test/kuttl

startKIND: true
kindNodeCache: true
# we are using a k8s 1.21 as default. Other versions can be run using the --kind-config flag.
kindConfig: test/kuttl/config/kind/w3k1.21.yaml
timeout: 1400
namespace: k8ssandra-operator
kindContainers:
- k8ssandra/k8ssandra-operator:latest
9 changes: 9 additions & 0 deletions test/kuttl/config/kind/w1k1.20.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
networking:
apiServerPort: 45451
nodes:
- role: control-plane
image: kindest/node:v1.20.7
- role: worker
image: kindest/node:v1.20.7
9 changes: 9 additions & 0 deletions test/kuttl/config/kind/w1k1.21.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
networking:
apiServerPort: 45451
nodes:
- role: control-plane
image: kindest/node:v1.21.2
- role: worker
image: kindest/node:v1.21.2
9 changes: 9 additions & 0 deletions test/kuttl/config/kind/w1k1.22.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
networking:
apiServerPort: 45451
nodes:
- role: control-plane
image: kindest/node:v1.22.2
- role: worker
image: kindest/node:v1.22.2
12 changes: 12 additions & 0 deletions test/kuttl/config/kind/w3k1.21.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
networking:
apiServerPort: 45451
nodes:
- role: control-plane
- role: worker
image: kindest/node:v1.21.2
- role: worker
image: kindest/node:v1.21.2
- role: worker
image: kindest/node:v1.21.2
45 changes: 45 additions & 0 deletions test/kuttl/test-cassDC-deploys/00-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: cert-manager-cainjector
namespace: "cert-manager"
labels:
app: cainjector
app.kubernetes.io/name: cainjector
status:
conditions:
- status: "True"
type: Available
- status: "True"
type: Progressing
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: cert-manager
namespace: "cert-manager"
labels:
app: cert-manager
app.kubernetes.io/name: cert-manager
app.kubernetes.io/instance: cert-manager
status:
conditions:
- status: "True"
type: Available
- status: "True"
type: Progressing
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: cert-manager-webhook
namespace: "cert-manager"
labels:
app: webhook
app.kubernetes.io/name: webhook
status:
conditions:
- status: "True"
type: Available
- status: "True"
type: Progressing
5 changes: 5 additions & 0 deletions test/kuttl/test-cassDC-deploys/00-cert-manager.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- command: kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.6.0/cert-manager.yaml
ignoreFailure: false
22 changes: 22 additions & 0 deletions test/kuttl/test-cassDC-deploys/01-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# apiVersion: apiextensions.k8s.io/v1
# kind: CustomResourceDefinition
# name: k8ssandraclusters.k8ssandra.io
# spec:
# group: k8ssandra.io
# names:
# kind: K8ssandraCluster
# listKind: K8ssandraClusterList
# plural: k8ssandraclusters
# singular: k8ssandracluster
# ---
apiVersion: apps/v1
kind: Deployment
metadata:
name: k8ssandra-operator
namespace: k8ssandra-operator
status:
conditions:
- status: "True"
type: Available
- status: "True"
type: Progressing
6 changes: 6 additions & 0 deletions test/kuttl/test-cassDC-deploys/01-k8ssandra-operator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |
../../../bin/kustomize build ../../../config/deployments/control-plane | kubectl apply -n $NAMESPACE --server-side --force-conflicts -f -
ignoreFailure: false
7 changes: 7 additions & 0 deletions test/kuttl/test-cassDC-deploys/02-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: demo-dc1-default-sts
namespace: k8ssandra-operator
status:
readyReplicas: 3
5 changes: 5 additions & 0 deletions test/kuttl/test-cassDC-deploys/02-k8ssandra-cluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- command: kubectl apply -n $NAMESPACE --server-side --force-conflicts -f ../../testdata/samples/k8ssandra-multi-kind.yaml
ignoreFailure: false

0 comments on commit 7e7185d

Please sign in to comment.