diff --git a/.github/scripts/end2end/configs/zenko.yaml b/.github/scripts/end2end/configs/zenko.yaml index 9ac52e9793..4ad9acee37 100644 --- a/.github/scripts/end2end/configs/zenko.yaml +++ b/.github/scripts/end2end/configs/zenko.yaml @@ -5,7 +5,7 @@ metadata: name: ${ZENKO_NAME} ${ZENKO_ANNOTATIONS} zenko.io/x-backbeat-oneshard-replicaset: data-db-mongodb-sharded-shard-0 - zenko.io/x-backbeat-oneshard-replicaset-hosts: data-db-mongodb-sharded-shard0-data-0.data-db-mongodb-sharded-headless.default.svc.cluster.local:27017 + zenko.io/x-backbeat-oneshard-replicaset-hosts: ${ZENKO_BACKBEAT_SHARD_HOSTS} spec: version: ${ZENKO_VERSION_NAME} replicas: 1 diff --git a/.github/scripts/end2end/deploy-zenko.sh b/.github/scripts/end2end/deploy-zenko.sh index ec6d31ab8b..590ed6ce0f 100755 --- a/.github/scripts/end2end/deploy-zenko.sh +++ b/.github/scripts/end2end/deploy-zenko.sh @@ -17,6 +17,7 @@ export ZENKO_STS_INGRESS=${ZENKO_STS_INGRESS:-'sts.zenko.local'} export ZENKO_MANAGEMENT_INGRESS=${ZENKO_MANAGEMENT_INGRESS:-'management.zenko.local'} export ZENKO_S3_INGRESS=${ZENKO_S3_INGRESS:-'s3.zenko.local'} export ZENKO_UI_INGRESS=${ZENKO_UI_INGRESS:-'ui.zenko.local'} +export MONGODB_SHARD_COUNT=${MONGODB_SHARD_COUNT:-1} export BACKBEAT_LCC_CRON_RULE=${BACKBEAT_LCC_CRON_RULE:-'*/5 * * * * *'} @@ -128,7 +129,17 @@ create_encryption_secret() export AZURE_SECRET_KEY_ENCRYPTED } +generate_shard_hosts() { + local hosts="" + for ((i=0; i "$kustomization_file" << EOF +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: +- ${DIR}/_build/root/deploy/${base_yaml} +patchesStrategicMerge: +EOF + + # Add configsvr patch with correct path to add volumeClaimTemplates + cat >> "$kustomization_file" << EOF +- |- + apiVersion: apps/v1 + kind: StatefulSet + metadata: + name: data-db-mongodb-sharded-configsvr + spec: + volumeClaimTemplates: + - metadata: + name: datadir + spec: + accessModes: + - "ReadWriteOnce" + resources: + requests: + storage: "8Gi" + storageClassName: standard +EOF + + # Add shard patches for N shards with correct path to add volumeClaimTemplates + for ((i=0; i> "$kustomization_file" << EOF +- |- + apiVersion: apps/v1 + kind: StatefulSet + metadata: + name: data-db-mongodb-sharded-shard${i}-data + spec: + volumeClaimTemplates: + - metadata: + name: datadir + spec: + accessModes: + - "ReadWriteOnce" + resources: + requests: + storage: "8Gi" + storageClassName: standard +EOF + done +} diff --git a/.github/scripts/end2end/install-kind-dependencies.sh b/.github/scripts/end2end/install-kind-dependencies.sh index 4300063488..32e1f6709f 100755 --- a/.github/scripts/end2end/install-kind-dependencies.sh +++ b/.github/scripts/end2end/install-kind-dependencies.sh @@ -24,6 +24,10 @@ MONGODB_APP_PASSWORD=datapass MONGODB_APP_DATABASE=${ZENKO_MONGODB_DATABASE:-datadb} MONGODB_RS_KEY=0123456789abcdef +MONGODB_SHARD_COUNT=${MONGODB_SHARD_COUNT:-1} + +source "${DIR}/generate-kustomization.sh" && generate_kustomization "${NODE_COUNT:-1}" "${MONGODB_SHARD_COUNT}" + ENABLE_KEYCLOAK_HTTPS=${ENABLE_KEYCLOAK_HTTPS:-'false'} KAFKA_CHART=banzaicloud-stable/kafka-operator @@ -186,7 +190,7 @@ mongodb_wait_for_shards() { --eval "db.runCommand({ listshards: 1 }).shards.length" ) - [ $count == "1" ] + [ $count == "$MONGODB_SHARD_COUNT" ] } mongodb_sharded() { @@ -197,11 +201,14 @@ mongodb_sharded() { $SOLUTION_REGISTRY/os-shell=$(get_image_from_deps mongodb-shell) \ $SOLUTION_REGISTRY/mongodb-exporter=$(get_image_from_deps mongodb-sharded-exporter) - kubectl apply -k . + kubectl apply -k "${DIR}" - kubectl rollout status statefulset data-db-mongodb-sharded-mongos - kubectl rollout status statefulset data-db-mongodb-sharded-configsvr - kubectl rollout status statefulset data-db-mongodb-sharded-shard0-data + kubectl rollout status statefulset data-db-mongodb-sharded-mongos --timeout=5m + kubectl rollout status statefulset data-db-mongodb-sharded-configsvr --timeout=5m + + for ((i=0; i