Skip to content

Commit

Permalink
operator v1: add KUTTL test for deleting a nodepool
Browse files Browse the repository at this point in the history
  • Loading branch information
birdayz committed Nov 15, 2024
1 parent 2fdf396 commit 4ace3cf
Show file tree
Hide file tree
Showing 8 changed files with 230 additions and 0 deletions.
28 changes: 28 additions & 0 deletions operator/tests/e2e-with-flags/nodepools-delete/00-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
commands:
- script: |
kubectl wait --for=condition=ClusterConfigured=True cluster/nodepool-cluster --timeout 300s --namespace $NAMESPACE
kubectl wait --for=condition=OperatorQuiescent=True cluster/nodepool-cluster --timeout 300s --namespace $NAMESPACE
---
apiVersion: redpanda.vectorized.io/v1alpha1
kind: Cluster
metadata:
name: nodepools-delete
status:
readyReplicas: 3
replicas: 3
currentReplicas: 3
upgrading: false
restarting: false
nodePools:
first:
currentReplicas: 3
readyReplicas: 3
replicas: 3
restarting: false
---
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
collectors:
- command: ../../../hack/get-redpanda-info.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: redpanda.vectorized.io/v1alpha1
kind: Cluster
metadata:
name: nodepools-delete
spec:
image: "localhost/redpanda"
version: "dev"
nodePools:
- name: first
replicas: 3
resources:
requests:
cpu: "100m"
memory: 256Mi
limits:
cpu: "100m"
memory: 256Mi
configuration:
rpcServer:
port: 33145
kafkaApi:
- port: 9092
adminApi:
- port: 9644
developerMode: true
additionalCommandlineArguments:
dump-memory-diagnostics-on-alloc-failure-kind: all
abort-on-seastar-bad-alloc: ''
resources: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
apiVersion: redpanda.vectorized.io/v1alpha1
kind: Cluster
metadata:
name: nodepools-delete
spec:
image: "localhost/redpanda"
version: "dev"
nodePools:
- name: first
replicas: 3
resources:
requests:
cpu: "100m"
memory: 256Mi
limits:
cpu: "100m"
memory: 256Mi
- name: second
replicas: 3
resources:
requests:
cpu: "101m"
memory: 257Mi
limits:
cpu: "101m"
memory: 257Mi
configuration:
rpcServer:
port: 33145
kafkaApi:
- port: 9092
adminApi:
- port: 9644
developerMode: true
additionalCommandlineArguments:
dump-memory-diagnostics-on-alloc-failure-kind: all
abort-on-seastar-bad-alloc: ''
resources: {}
28 changes: 28 additions & 0 deletions operator/tests/e2e-with-flags/nodepools-delete/01-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
commands:
- script: |
kubectl wait --for=condition=ClusterConfigured=True cluster/nodepools-delete --timeout 300s --namespace $NAMESPACE
kubectl wait --for=condition=OperatorQuiescent=True cluster/nodepools-delete --timeout 300s --namespace $NAMESPACE
---
apiVersion: redpanda.vectorized.io/v1alpha1
kind: Cluster
metadata:
name: nodepools-delete
status:
nodePools:
first:
currentReplicas: 3
readyReplicas: 3
replicas: 3
restarting: false
second:
currentReplicas: 3
readyReplicas: 3
replicas: 3
restarting: false
---
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
collectors:
- command: ../../../hack/get-redpanda-info.sh
40 changes: 40 additions & 0 deletions operator/tests/e2e-with-flags/nodepools-delete/02-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
commands:
- script: |
kubectl wait --for=delete pod/nodepools-delete-first-2 --timeout 300s --namespace $NAMESPACE
---
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
commands:
- script: |
kubectl wait --for=delete pod/nodepools-delete-first-1 --timeout 300s --namespace $NAMESPACE
---
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
commands:
- script: |
kubectl wait --for=delete pod/nodepools-delete-first-0 --timeout 300s --namespace $NAMESPACE
---
apiVersion: redpanda.vectorized.io/v1alpha1
kind: Cluster
metadata:
name: nodepools-delete
status:
readyReplicas: 3
replicas: 3
currentReplicas: 3
upgrading: false
restarting: false
---
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
commands:
- script: |
kubectl wait --for=condition=ClusterConfigured=True cluster/nodepools-delete --timeout 300s --namespace $NAMESPACE
kubectl wait --for=condition=OperatorQuiescent=True cluster/nodepools-delete --timeout 300s --namespace $NAMESPACE
---
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
collectors:
- command: ../../../hack/get-redpanda-info.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Actually delete nodepool, not just scale to zero.
# WITHOUT scaling to zero first.
# Ensure that it goes 3->2->1-0->gone.
apiVersion: redpanda.vectorized.io/v1alpha1
kind: Cluster
metadata:
name: nodepools-delete
spec:
image: "localhost/redpanda"
version: "dev"
nodePools:
- name: second
replicas: 3
resources:
requests:
cpu: "101m"
memory: 257Mi
limits:
cpu: "101m"
memory: 257Mi
configuration:
rpcServer:
port: 33145
kafkaApi:
- port: 9092
adminApi:
- port: 9644
developerMode: true
additionalCommandlineArguments:
dump-memory-diagnostics-on-alloc-failure-kind: all
abort-on-seastar-bad-alloc: ''
resources: {}
4 changes: 4 additions & 0 deletions operator/tests/e2e-with-flags/nodepools-delete/03-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
collectors:
- command: ../../../hack/get-redpanda-info.sh
31 changes: 31 additions & 0 deletions operator/tests/e2e-with-flags/nodepools-delete/03-clean.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
delete:
- apiVersion: redpanda.vectorized.io/v1alpha1
kind: Cluster
name: nodepools-delete
namespace: redpanda-system
- apiVersion: v1
kind: PersistentVolumeClaim
name: datadir-nodepools-delete-0
namespace: redpanda-system
- apiVersion: v1
kind: PersistentVolumeClaim
name: datadir-nodepools-delete-1
namespace: redpanda-system
- apiVersion: v1
kind: PersistentVolumeClaim
name: datadir-nodepools-delete-2
namespace: redpanda-system
- apiVersion: v1
kind: PersistentVolumeClaim
name: datadir-nodepools-delete-3
namespace: redpanda-system
- apiVersion: v1
kind: PersistentVolumeClaim
name: datadir-nodepools-delete-4
namespace: redpanda-system
- apiVersion: v1
kind: PersistentVolumeClaim
name: datadir-nodepools-delete-5
namespace: redpanda-system

0 comments on commit 4ace3cf

Please sign in to comment.