Skip to content
This repository has been archived by the owner on Oct 20, 2022. It is now read-only.

Commit

Permalink
Scales up and down a DC in multi-dcs (#335)
Browse files Browse the repository at this point in the history
  • Loading branch information
cscetbon authored Jun 17, 2021
1 parent a9c2d3d commit c442ff5
Show file tree
Hide file tree
Showing 12 changed files with 147 additions and 60 deletions.
49 changes: 0 additions & 49 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,27 +45,6 @@ orbs:
mkdir -p ${HOME}/.kube
- checkout:
path: /home/circleci/casskop
- run:
name: Create file with build image version
command: |
make build-image > casskop-build-image-tar
- restore_cache:
keys:
- '{{ checksum "casskop-build-image-tar" }}'
- run:
name: Load Casskop build image into k3d
command: |
if [ ! -f "casskop-build-image.tar" ]
then
docker pull $(cat casskop-build-image-tar)
docker save $(cat casskop-build-image-tar) > casskop-build-image.tar
fi
k3d image import casskop-build-image.tar
- save_cache:
name: Save Casskop build image
key: '{{ checksum "casskop-build-image-tar" }}'
paths:
- casskop-build-image.tar
- run:
name: Setup kubectl
command: |
Expand Down Expand Up @@ -259,34 +238,6 @@ orbs:
paths:
- sonar-scanner-3.3.0.1492-linux
- /home/circleci/<< parameters.operatorDir >>/.sonar
# - run: # Run sonar scan
# name: Sonarcloud Scan
# command: |
# ./sonar-scanner-3.3.0.1492-linux/bin/sonar-scanner -X \
# -Dsonar.projectName=<< parameters.operatorName >> \
# -Dsonar.projectKey=${SONAR_PROJECT} \
# -Dsonar.login=${SONAR_TOKEN} \
# -Dsonar.branch.name=${CIRCLE_BRANCH} \
# -Dsonar.organization=${SONAR_ORGANISATION} \
# -Dsonar.host.url=https://sonarcloud.io \
# -Dsonar.projectBaseDir=/home/circleci/<< parameters.operatorDir >> \
# -Dsonar.sources=. \
# -Dsonar.sources.inclusions="**/**.go" \
# -Dsonar.exclusions="**/*_test.go,**/vendor/**,**/sonar-scanner-3.3.0.1492-linux/**,**docs/**" \
# -Dsonar.coverage.exclusions="**/vendor/**,**/test/**,**docs/**" \
# -Dsonar.tests=. \
# -Dsonar.language=go \
# -Dsonar.sourceEncoding=UTF-8 \
# -Dsonar.test.inclusions="**/**_test.go" \
# -Dsonar.test.exclusions="**/vendor/**" \
# -Dsonar.go.coverage.reportPaths=coverage.out \
# -Dsonar.go.tests.reportPaths=test-report.out \
# -Dsonar.coverage.dtdVerification=false \
# -Dsonar.log.level=INFO
# cat -n .scannerwork/report-task.txt
# Artifacts definitions
# - store_test_results: # Store sonar scan reports
# path: reports

publish-helm:
<<: *params_operator
Expand Down
8 changes: 0 additions & 8 deletions test/kuttl/multi-dcs/00-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@ status:
currentReplicas: 1
replicas: 1
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: cassandra-e2e-dc2-rack1
status:
currentReplicas: 1
replicas: 1
---
apiVersion: db.orange.com/v1alpha1
kind: CassandraCluster
metadata:
Expand Down
3 changes: 0 additions & 3 deletions test/kuttl/multi-dcs/00-createCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,3 @@ spec:
- name: dc1
rack:
- name: rack1
- name: dc2
rack:
- name: rack1
13 changes: 13 additions & 0 deletions test/kuttl/multi-dcs/01-addDC.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: db.orange.com/v1alpha1
kind: CassandraCluster
metadata:
name: cassandra-e2e
spec:
topology:
dc:
- name: dc1
rack:
- name: rack1
- name: dc2
rack:
- name: rack1
24 changes: 24 additions & 0 deletions test/kuttl/multi-dcs/01-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: cassandra-e2e-dc1-rack1
status:
currentReplicas: 1
replicas: 1
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: cassandra-e2e-dc2-rack1
status:
currentReplicas: 1
replicas: 1
---
apiVersion: db.orange.com/v1alpha1
kind: CassandraCluster
metadata:
name: cassandra-e2e
status:
lastClusterAction: Initializing
lastClusterActionStatus: Done
phase: Running
24 changes: 24 additions & 0 deletions test/kuttl/multi-dcs/02-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: cassandra-e2e-dc1-rack1
status:
currentReplicas: 1
replicas: 1
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: cassandra-e2e-dc2-rack1
status:
currentReplicas: 1
replicas: 1
---
apiVersion: db.orange.com/v1alpha1
kind: CassandraCluster
metadata:
name: cassandra-e2e
status:
lastClusterAction: CorrectCRDConfig
lastClusterActionStatus: Done
phase: Running
14 changes: 14 additions & 0 deletions test/kuttl/multi-dcs/02-unallowedScaleDown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: db.orange.com/v1alpha1
kind: CassandraCluster
metadata:
name: cassandra-e2e
spec:
topology:
dc:
- name: dc1
rack:
- name: rack1
- name: dc2
nodesPerRacks: 0
rack:
- name: rack1
9 changes: 9 additions & 0 deletions test/kuttl/multi-dcs/03-disableReplToDC2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
# Replicate system_auth, system_traces and system_distributed to dc1 only
- script: |
for keyspace in system_auth system_traces system_distributed
do
kubectl exec -n $NAMESPACE cassandra-e2e-dc1-rack1-0 -- cqlsh -e "ALTER KEYSPACE $keyspace WITH replication = {'class': 'NetworkTopologyStrategy', 'dc1': '1'}"
done
23 changes: 23 additions & 0 deletions test/kuttl/multi-dcs/04-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: cassandra-e2e-dc1-rack1
status:
currentReplicas: 1
replicas: 1
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: cassandra-e2e-dc2-rack1
status:
replicas: 0
---
apiVersion: db.orange.com/v1alpha1
kind: CassandraCluster
metadata:
name: cassandra-e2e
status:
lastClusterAction: ScaleDown
lastClusterActionStatus: Done
phase: Running
14 changes: 14 additions & 0 deletions test/kuttl/multi-dcs/04-scaleDownDC2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: db.orange.com/v1alpha1
kind: CassandraCluster
metadata:
name: cassandra-e2e
spec:
topology:
dc:
- name: dc1
rack:
- name: rack1
- name: dc2
nodesPerRacks: 0
rack:
- name: rack1
16 changes: 16 additions & 0 deletions test/kuttl/multi-dcs/05-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: cassandra-e2e-dc1-rack1
status:
currentReplicas: 1
replicas: 1
---
apiVersion: db.orange.com/v1alpha1
kind: CassandraCluster
metadata:
name: cassandra-e2e
status:
lastClusterAction: ActionDeleteDC
lastClusterActionStatus: Done
phase: Running
10 changes: 10 additions & 0 deletions test/kuttl/multi-dcs/05-removeDC.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: db.orange.com/v1alpha1
kind: CassandraCluster
metadata:
name: cassandra-e2e
spec:
topology:
dc:
- name: dc1
rack:
- name: rack1

0 comments on commit c442ff5

Please sign in to comment.