From 6eaba0362aae976a188ed1a895c69b0d99d91639 Mon Sep 17 00:00:00 2001 From: hlts2 Date: Tue, 26 Sep 2023 17:33:47 +0900 Subject: [PATCH] add e2e test for mirror Signed-off-by: hlts2 --- .github/actions/e2e-deploy-vald/action.yaml | 11 +++ .github/helm/values/vald-mirror-target.yaml | 24 ++++++ .github/helm/values/values-mirror-01.yaml | 81 ++++++++++++++++++++ .github/helm/values/values-mirror-02.yaml | 85 +++++++++++++++++++++ .github/workflows/e2e.yml | 62 +++++++++++++++ 5 files changed, 263 insertions(+) create mode 100644 .github/helm/values/vald-mirror-target.yaml create mode 100644 .github/helm/values/values-mirror-01.yaml create mode 100644 .github/helm/values/values-mirror-02.yaml diff --git a/.github/actions/e2e-deploy-vald/action.yaml b/.github/actions/e2e-deploy-vald/action.yaml index d90ae83dc6..be004dd45c 100644 --- a/.github/actions/e2e-deploy-vald/action.yaml +++ b/.github/actions/e2e-deploy-vald/action.yaml @@ -29,6 +29,9 @@ inputs: description: "Path to the values.yaml that passed to Helm command." required: false default: "false" + namespace: + description: "Namespace to deploy." + required: false wait_for_selector: description: "Label selector used for specifying a pod waited for" required: false @@ -61,6 +64,14 @@ runs: run: | cat ${{ inputs.values }} + - name: Change namespace + if: ${{ inputs.namespace != '' }} + shell: bash + run: | + kubectl create ns ${NAMESPACE} || kubectl config set-context --current --namespace=${NAMESPACE} + env: + NAMESPACE: ${{ inputs.namespace }} + - name: Deploy vald from remote charts shell: bash id: deploy_vald_remote diff --git a/.github/helm/values/vald-mirror-target.yaml b/.github/helm/values/vald-mirror-target.yaml new file mode 100644 index 0000000000..fdd2ef9c0e --- /dev/null +++ b/.github/helm/values/vald-mirror-target.yaml @@ -0,0 +1,24 @@ +# +# Copyright (C) 2019-2023 vdaas.org vald team +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# You may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +apiVersion: vald.vdaas.org/v1 +kind: ValdMirrorTarget +metadata: + name: mirror-target-02 +spec: + colocation: dc1 + target: + host: vald-mirror-gateway.vald-02.svc.cluster.local + port: 8081 diff --git a/.github/helm/values/values-mirror-01.yaml b/.github/helm/values/values-mirror-01.yaml new file mode 100644 index 0000000000..75eb71f435 --- /dev/null +++ b/.github/helm/values/values-mirror-01.yaml @@ -0,0 +1,81 @@ +# +# Copyright (C) 2019-2023 vdaas.org vald team +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# You may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +defaults: + logging: + level: info + networkPolicy: + enabled: false + +gateway: + mirror: + enabled: true + clusterRoleBinding: + name: vald-mirror-01 + serviceAccount: + name: vald-mirror-01 + lb: + enabled: true + minReplicas: 1 + hpa: + enabled: false + resources: + requests: + cpu: 100m + memory: 50Mi + gateway_config: + index_replica: 3 + +agent: + minReplicas: 3 + maxReplicas: 10 + podManagementPolicy: Parallel + hpa: + enabled: false + resources: + requests: + cpu: 100m + memory: 50Mi + ngt: + auto_index_duration_limit: 2m + auto_index_check_duration: 30s + auto_index_length: 1000 + dimension: 784 + +discoverer: + minReplicas: 1 + hpa: + enabled: false + resources: + requests: + cpu: 100m + memory: 50Mi + clusterRoleBinding: + name: vald-01 + serviceAccount: + name: vald-01 + +manager: + index: + replicas: 1 + resources: + requests: + cpu: 100m + memory: 30Mi + indexer: + auto_index_duration_limit: 2m + auto_index_check_duration: 30s + auto_index_length: 1000 diff --git a/.github/helm/values/values-mirror-02.yaml b/.github/helm/values/values-mirror-02.yaml new file mode 100644 index 0000000000..79dc479e88 --- /dev/null +++ b/.github/helm/values/values-mirror-02.yaml @@ -0,0 +1,85 @@ +# +# Copyright (C) 2019-2023 vdaas.org vald team +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# You may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +defaults: + logging: + level: info + networkPolicy: + enabled: false + +gateway: + mirror: + enabled: true + clusterRole: + enabled: false + clusterRoleBinding: + name: vald-mirror-02 + serviceAccount: + name: vald-mirror-02 + lb: + enabled: true + minReplicas: 1 + hpa: + enabled: false + resources: + requests: + cpu: 100m + memory: 50Mi + gateway_config: + index_replica: 3 + +agent: + minReplicas: 3 + maxReplicas: 10 + podManagementPolicy: Parallel + hpa: + enabled: false + resources: + requests: + cpu: 100m + memory: 50Mi + ngt: + auto_index_duration_limit: 2m + auto_index_check_duration: 30s + auto_index_length: 1000 + dimension: 784 + +discoverer: + minReplicas: 1 + hpa: + enabled: false + resources: + requests: + cpu: 100m + memory: 50Mi + clusterRole: + enabled: false + clusterRoleBinding: + name: vald-02 + serviceAccount: + name: vald-02 + +manager: + index: + replicas: 1 + resources: + requests: + cpu: 100m + memory: 30Mi + indexer: + auto_index_duration_limit: 2m + auto_index_check_duration: 30s + auto_index_length: 1000 diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 924865531f..cf68e0da5d 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -269,6 +269,67 @@ jobs: env: POD_NAME: ${{ steps.deploy_vald.outputs.POD_NAME }} + e2e-stream-crud-with-mirror: + name: "E2E test (Stream CRUD) with mirror" + needs: [dump-contexts-to-log] + runs-on: ubuntu-latest + timeout-minutes: 60 + steps: + - uses: actions/checkout@v3 + + - name: Set Git config + run: | + git config --global --add safe.directory ${GITHUB_WORKSPACE} + + - name: Setup E2E environment + id: setup_e2e + uses: ./.github/actions/setup-e2e + with: + target_images: "vdaas/vald-agent-ngt vdaas/vald-discoverer-k8s vdaas/vald-lb-gateway vdaas/vald-manager-index vdaas/vald-mirror-gateway" + + - name: Deploy Vald-01 + id: deploy_vald_01 + uses: ./.github/actions/e2e-deploy-vald + with: + namespace: vald-01 + helm_extra_options: ${{ steps.setup_e2e.outputs.HELM_EXTRA_OPTIONS }} + values: .github/helm/values/values-mirror-01.yaml + wait_for_selector: app=vald-mirror-gateway + + - name: Deploy Vald-02 + id: deploy_vald_02 + uses: ./.github/actions/e2e-deploy-vald + with: + namespace: vald-02 + helm_extra_options: ${{ steps.setup_e2e.outputs.HELM_EXTRA_OPTIONS }} + values: .github/helm/values/values-mirror-02.yaml + wait_for_selector: app=vald-mirror-gateway + + - name: Deploy Mirror Target + run: | + kubectl apply -f .github/helm/values/vald-mirror-target.yaml -n vald-01 + sleep 30s + kubectl get vmt -o wide -A + + # - name: Run E2E CRUD + # run: | + # make hack/benchmark/assets/dataset/${{ env.DATASET }} + # make E2E_BIND_PORT=8081 \ + # E2E_DATASET_NAME=${{ env.DATASET }} \ + # E2E_INSERT_COUNT=10000\ + # E2E_SEARCH_COUNT=10000 \ + # E2E_SEARCH_BY_ID_COUNT=10000 \ + # E2E_GET_OBJECT_COUNT=100 \ + # E2E_UPDATE_COUNT=100 \ + # E2E_UPSERT_COUNT=100 \ + # E2E_REMOVE_COUNT=100 \ + # E2E_WAIT_FOR_CREATE_INDEX_DURATION=3m \ + # E2E_TARGET_POD_NAME=${POD_NAME} \ + # E2E_TARGET_NAMESPACE=vald-01 \ + # e2e + # env: + # POD_NAME: ${{ steps.deploy_vald_01.outputs.POD_NAME }} + slack-notification: name: "Slack notification" if: startsWith( github.ref, 'refs/tags/') @@ -278,6 +339,7 @@ jobs: - e2e-stream-crud - e2e-stream-crud-for-operator - e2e-stream-crud-skip-exist-check + - e2e-stream-crud-with-mirror runs-on: ubuntu-latest steps: - uses: actions/checkout@v3