From 90206b0f99005155752a65408d2b0ce801d9b213 Mon Sep 17 00:00:00 2001 From: Mohamed Hamza Date: Tue, 3 Feb 2026 12:37:59 -0500 Subject: [PATCH 1/2] Remove Consul Consul has been deprecated since v7. This removes Consul entirely. Signed-off-by: Mohamed Hamza --- .github/workflows/cluster_endtoend_18.yml | 2 +- .../cluster_endtoend_mysql_server_vault.yml | 2 +- .../cluster_endtoend_tabletmanager_consul.yml | 146 ------ .../cluster_endtoend_vtgate_topo_consul.yml | 146 ------ Makefile | 2 +- bootstrap.sh | 55 -- build.env | 1 - changelog/24.0/24.0.0/summary.md | 9 +- docker/bootstrap/Dockerfile.common | 2 +- examples/common/backup-env.sh | 77 ++- examples/common/backup-scripts/consul-down.sh | 22 - examples/common/backup-scripts/consul-up.sh | 52 -- examples/common/env.sh | 77 ++- examples/common/scripts/consul-down.sh | 22 - examples/common/scripts/consul-up.sh | 52 -- examples/local/101_initial_cluster.sh | 5 +- examples/local/501_teardown.sh | 14 +- go.mod | 1 - go.sum | 4 - go/cmd/topo2topo/cli/plugin_consultopo.go | 23 - go/cmd/vtbackup/cli/plugin_consultopo.go | 21 - go/cmd/vtctld/cli/plugin_consultopo.go | 23 - go/cmd/vtctldclient/command/root.go | 1 - go/cmd/vtgate/cli/plugin_consultopo.go | 23 - go/cmd/vtorc/cli/plugin_consultopo.go | 23 - go/cmd/vttablet/cli/plugin_consultopo.go | 23 - go/cmd/vttestserver/cli/main_test.go | 72 --- go/test/endtoend/cluster/cluster_process.go | 2 +- go/test/endtoend/cluster/topo_process.go | 124 +---- go/test/endtoend/cluster/vt_process.go | 4 - go/test/endtoend/topotest/consul/main_test.go | 299 ----------- go/test/endtoend/vtorc/utils/utils.go | 1 - go/testfiles/ports.go | 4 - go/vt/topo/conn.go | 2 +- go/vt/topo/consultopo/config.go | 23 - go/vt/topo/consultopo/directory.go | 86 ---- go/vt/topo/consultopo/election.go | 141 ----- go/vt/topo/consultopo/error.go | 56 -- go/vt/topo/consultopo/file.go | 173 ------- go/vt/topo/consultopo/lock.go | 224 -------- go/vt/topo/consultopo/server.go | 186 ------- go/vt/topo/consultopo/server_flaky_test.go | 481 ------------------ go/vt/topo/consultopo/version.go | 29 -- go/vt/topo/consultopo/watch.go | 147 ------ go/vt/topo/etcd2topo/server.go | 2 +- go/vt/topo/locks.go | 3 +- go/vt/topo/server.go | 6 +- go/vt/vtadmin/cluster/config_test.go | 8 +- go/vt/vtadmin/cluster/discovery/discovery.go | 3 +- .../cluster/discovery/discovery_consul.go | 480 ----------------- .../discovery/discovery_consul_test.go | 460 ----------------- .../cluster/discovery/discovery_test.go | 9 +- go/vt/vtadmin/cluster/file_config.go | 2 +- go/vt/vtadmin/cluster/file_config_test.go | 96 ++-- go/vt/vtadmin/cluster/flags_test.go | 14 +- go/vt/vtctl/plugin_consultopo.go | 23 - go/vt/vtctl/vtctl.go | 2 +- go/vt/vttest/plugin_consultopo.go | 23 - test/ci_workflow_gen.go | 4 - test/config.json | 28 - test/templates/cluster_endtoend_test.tpl | 2 +- .../cluster_endtoend_test_mysql57.tpl | 2 +- tools/dependency_check.sh | 16 +- tools/remove_dependencies.sh | 18 - 64 files changed, 173 insertions(+), 3910 deletions(-) delete mode 100644 .github/workflows/cluster_endtoend_tabletmanager_consul.yml delete mode 100644 .github/workflows/cluster_endtoend_vtgate_topo_consul.yml delete mode 100755 examples/common/backup-scripts/consul-down.sh delete mode 100755 examples/common/backup-scripts/consul-up.sh delete mode 100755 examples/common/scripts/consul-down.sh delete mode 100755 examples/common/scripts/consul-up.sh delete mode 100644 go/cmd/topo2topo/cli/plugin_consultopo.go delete mode 100644 go/cmd/vtbackup/cli/plugin_consultopo.go delete mode 100644 go/cmd/vtctld/cli/plugin_consultopo.go delete mode 100644 go/cmd/vtgate/cli/plugin_consultopo.go delete mode 100644 go/cmd/vtorc/cli/plugin_consultopo.go delete mode 100644 go/cmd/vttablet/cli/plugin_consultopo.go delete mode 100644 go/test/endtoend/topotest/consul/main_test.go delete mode 100644 go/vt/topo/consultopo/config.go delete mode 100644 go/vt/topo/consultopo/directory.go delete mode 100644 go/vt/topo/consultopo/election.go delete mode 100644 go/vt/topo/consultopo/error.go delete mode 100644 go/vt/topo/consultopo/file.go delete mode 100644 go/vt/topo/consultopo/lock.go delete mode 100644 go/vt/topo/consultopo/server.go delete mode 100644 go/vt/topo/consultopo/server_flaky_test.go delete mode 100644 go/vt/topo/consultopo/version.go delete mode 100644 go/vt/topo/consultopo/watch.go delete mode 100644 go/vt/vtadmin/cluster/discovery/discovery_consul.go delete mode 100644 go/vt/vtadmin/cluster/discovery/discovery_consul_test.go delete mode 100644 go/vt/vtctl/plugin_consultopo.go delete mode 100644 go/vt/vttest/plugin_consultopo.go diff --git a/.github/workflows/cluster_endtoend_18.yml b/.github/workflows/cluster_endtoend_18.yml index f91396a6799..0eb1f53918c 100644 --- a/.github/workflows/cluster_endtoend_18.yml +++ b/.github/workflows/cluster_endtoend_18.yml @@ -100,7 +100,7 @@ jobs: go mod download - - name: Installing zookeeper and consul + - name: Installing zookeeper if: steps.changes.outputs.end_to_end == 'true' run: | make tools diff --git a/.github/workflows/cluster_endtoend_mysql_server_vault.yml b/.github/workflows/cluster_endtoend_mysql_server_vault.yml index d681bfc4f5b..46b2242877f 100644 --- a/.github/workflows/cluster_endtoend_mysql_server_vault.yml +++ b/.github/workflows/cluster_endtoend_mysql_server_vault.yml @@ -100,7 +100,7 @@ jobs: go mod download - - name: Installing zookeeper and consul + - name: Installing zookeeper if: steps.changes.outputs.end_to_end == 'true' run: | make tools diff --git a/.github/workflows/cluster_endtoend_tabletmanager_consul.yml b/.github/workflows/cluster_endtoend_tabletmanager_consul.yml deleted file mode 100644 index e6977f5d858..00000000000 --- a/.github/workflows/cluster_endtoend_tabletmanager_consul.yml +++ /dev/null @@ -1,146 +0,0 @@ -# DO NOT MODIFY: THIS FILE IS GENERATED USING "make generate_ci_workflows" - -name: Cluster (tabletmanager_consul) -on: - push: - branches: - - "main" - - "release-[0-9]+.[0-9]" - tags: '**' - pull_request: - branches: '**' -concurrency: - group: format('{0}-{1}', ${{ github.ref }}, 'Cluster (tabletmanager_consul)') - cancel-in-progress: true - -permissions: read-all - -env: - LAUNCHABLE_ORGANIZATION: "vitess" - LAUNCHABLE_WORKSPACE: "vitess-app" - GITHUB_PR_HEAD_SHA: "${{ github.event.pull_request.head.sha }}" - -jobs: - build: - timeout-minutes: 60 - name: Run endtoend tests on Cluster (tabletmanager_consul) - runs-on: ubuntu-24.04 - - steps: - - name: Harden the runner (Audit all outbound calls) - uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1 - with: - egress-policy: audit - - - name: Skip CI - run: | - if [[ "${{contains( github.event.pull_request.labels.*.name, 'Skip CI')}}" == "true" ]]; then - echo "skipping CI due to the 'Skip CI' label" - exit 1 - fi - - - name: Check out code - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - persist-credentials: 'false' - - - name: Check for changes in relevant files - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 - id: changes - with: - token: '' - filters: | - end_to_end: - - 'test/config.json' - - 'go/**/*.go' - - 'go/vt/sidecardb/**/*.sql' - - 'go/test/endtoend/onlineddl/vrepl_suite/**' - - 'test.go' - - 'Makefile' - - 'build.env' - - 'go.sum' - - 'go.mod' - - 'proto/*.proto' - - 'tools/**' - - 'config/**' - - 'bootstrap.sh' - - '.github/workflows/cluster_endtoend_tabletmanager_consul.yml' - - - name: Set up Go - if: steps.changes.outputs.end_to_end == 'true' - uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0 - with: - go-version-file: go.mod - - - name: Set up python - if: steps.changes.outputs.end_to_end == 'true' - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 - - - name: Tune the OS - if: steps.changes.outputs.end_to_end == 'true' - uses: ./.github/actions/tune-os - - - name: Setup MySQL - if: steps.changes.outputs.end_to_end == 'true' - uses: ./.github/actions/setup-mysql - with: - flavor: mysql-8.4 - - - name: Get dependencies - if: steps.changes.outputs.end_to_end == 'true' - timeout-minutes: 10 - run: | - - sudo apt-get -qq install -y mysql-shell - - # Install everything else we need, and configure - sudo apt-get -qq install -y make unzip g++ etcd-client etcd-server curl git wget xz-utils libncurses6 - - sudo service etcd stop - - go mod download - - - name: Installing zookeeper and consul - if: steps.changes.outputs.end_to_end == 'true' - run: | - make tools - - - name: Setup launchable dependencies - if: github.event_name == 'pull_request' && github.event.pull_request.draft == 'false' && steps.changes.outputs.end_to_end == 'true' && github.base_ref == 'main' - run: | - # Get Launchable CLI installed. If you can, make it a part of the builder image to speed things up - pip3 install --user launchable~=1.0 > /dev/null - - # verify that launchable setup is all correct. - launchable verify || true - - # Tell Launchable about the build you are producing and testing - launchable record build --name "$GITHUB_RUN_ID" --no-commit-collection --source . - - - name: Run cluster endtoend test - if: steps.changes.outputs.end_to_end == 'true' - timeout-minutes: 45 - run: | - # We set the VTDATAROOT to the /tmp folder to reduce the file path of mysql.sock file - # which musn't be more than 107 characters long. - export VTDATAROOT="/tmp/" - source build.env - - set -exo pipefail - - # Some of these tests require specific locales to be installed. - # See https://github.com/cncf/automation/commit/49f2ad7a791a62ff7d038002bbb2b1f074eed5d5 - go run test.go -docker=false -follow -shard tabletmanager_consul - - - name: Record test results in launchable if PR is not a draft - if: github.event_name == 'pull_request' && github.event.pull_request.draft == 'false' && steps.changes.outputs.end_to_end == 'true' && github.base_ref == 'main' && !cancelled() - run: | - # send recorded tests to launchable - launchable record tests --build "$GITHUB_RUN_ID" go-test . || true - - - name: Test Summary - if: steps.changes.outputs.end_to_end == 'true' && !cancelled() - uses: test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86 # v2.4 - with: - paths: "_test/junit/*.xml" - show: "fail" diff --git a/.github/workflows/cluster_endtoend_vtgate_topo_consul.yml b/.github/workflows/cluster_endtoend_vtgate_topo_consul.yml deleted file mode 100644 index 4e1d14738ca..00000000000 --- a/.github/workflows/cluster_endtoend_vtgate_topo_consul.yml +++ /dev/null @@ -1,146 +0,0 @@ -# DO NOT MODIFY: THIS FILE IS GENERATED USING "make generate_ci_workflows" - -name: Cluster (vtgate_topo_consul) -on: - push: - branches: - - "main" - - "release-[0-9]+.[0-9]" - tags: '**' - pull_request: - branches: '**' -concurrency: - group: format('{0}-{1}', ${{ github.ref }}, 'Cluster (vtgate_topo_consul)') - cancel-in-progress: true - -permissions: read-all - -env: - LAUNCHABLE_ORGANIZATION: "vitess" - LAUNCHABLE_WORKSPACE: "vitess-app" - GITHUB_PR_HEAD_SHA: "${{ github.event.pull_request.head.sha }}" - -jobs: - build: - timeout-minutes: 60 - name: Run endtoend tests on Cluster (vtgate_topo_consul) - runs-on: ubuntu-24.04 - - steps: - - name: Harden the runner (Audit all outbound calls) - uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1 - with: - egress-policy: audit - - - name: Skip CI - run: | - if [[ "${{contains( github.event.pull_request.labels.*.name, 'Skip CI')}}" == "true" ]]; then - echo "skipping CI due to the 'Skip CI' label" - exit 1 - fi - - - name: Check out code - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - persist-credentials: 'false' - - - name: Check for changes in relevant files - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 - id: changes - with: - token: '' - filters: | - end_to_end: - - 'test/config.json' - - 'go/**/*.go' - - 'go/vt/sidecardb/**/*.sql' - - 'go/test/endtoend/onlineddl/vrepl_suite/**' - - 'test.go' - - 'Makefile' - - 'build.env' - - 'go.sum' - - 'go.mod' - - 'proto/*.proto' - - 'tools/**' - - 'config/**' - - 'bootstrap.sh' - - '.github/workflows/cluster_endtoend_vtgate_topo_consul.yml' - - - name: Set up Go - if: steps.changes.outputs.end_to_end == 'true' - uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0 - with: - go-version-file: go.mod - - - name: Set up python - if: steps.changes.outputs.end_to_end == 'true' - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 - - - name: Tune the OS - if: steps.changes.outputs.end_to_end == 'true' - uses: ./.github/actions/tune-os - - - name: Setup MySQL - if: steps.changes.outputs.end_to_end == 'true' - uses: ./.github/actions/setup-mysql - with: - flavor: mysql-8.4 - - - name: Get dependencies - if: steps.changes.outputs.end_to_end == 'true' - timeout-minutes: 10 - run: | - - sudo apt-get -qq install -y mysql-shell - - # Install everything else we need, and configure - sudo apt-get -qq install -y make unzip g++ etcd-client etcd-server curl git wget xz-utils libncurses6 - - sudo service etcd stop - - go mod download - - - name: Installing zookeeper and consul - if: steps.changes.outputs.end_to_end == 'true' - run: | - make tools - - - name: Setup launchable dependencies - if: github.event_name == 'pull_request' && github.event.pull_request.draft == 'false' && steps.changes.outputs.end_to_end == 'true' && github.base_ref == 'main' - run: | - # Get Launchable CLI installed. If you can, make it a part of the builder image to speed things up - pip3 install --user launchable~=1.0 > /dev/null - - # verify that launchable setup is all correct. - launchable verify || true - - # Tell Launchable about the build you are producing and testing - launchable record build --name "$GITHUB_RUN_ID" --no-commit-collection --source . - - - name: Run cluster endtoend test - if: steps.changes.outputs.end_to_end == 'true' - timeout-minutes: 45 - run: | - # We set the VTDATAROOT to the /tmp folder to reduce the file path of mysql.sock file - # which musn't be more than 107 characters long. - export VTDATAROOT="/tmp/" - source build.env - - set -exo pipefail - - # Some of these tests require specific locales to be installed. - # See https://github.com/cncf/automation/commit/49f2ad7a791a62ff7d038002bbb2b1f074eed5d5 - go run test.go -docker=false -follow -shard vtgate_topo_consul - - - name: Record test results in launchable if PR is not a draft - if: github.event_name == 'pull_request' && github.event.pull_request.draft == 'false' && steps.changes.outputs.end_to_end == 'true' && github.base_ref == 'main' && !cancelled() - run: | - # send recorded tests to launchable - launchable record tests --build "$GITHUB_RUN_ID" go-test . || true - - - name: Test Summary - if: steps.changes.outputs.end_to_end == 'true' && !cancelled() - uses: test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86 # v2.4 - with: - paths: "_test/junit/*.xml" - show: "fail" diff --git a/Makefile b/Makefile index 30145c67a8c..b9f5facf6cc 100644 --- a/Makefile +++ b/Makefile @@ -369,7 +369,7 @@ clean_tools: minimaltools: echo $$(date): Installing minimal dependencies - BUILD_JAVA=0 BUILD_CONSUL=0 ./bootstrap.sh + BUILD_JAVA=0 ./bootstrap.sh dependency_check: ./tools/dependency_check.sh diff --git a/bootstrap.sh b/bootstrap.sh index 79e173d9a06..0cee2457e71 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -24,7 +24,6 @@ source ./dev.env # 1. Installation of dependencies. BUILD_JAVA=${BUILD_JAVA:-1} -BUILD_CONSUL=${BUILD_CONSUL:-1} VITESS_RESOURCES_DOWNLOAD_BASE_URL="https://github.com/vitessio/vitess-resources/releases/download" VITESS_RESOURCES_RELEASE="v4.0" @@ -255,55 +254,6 @@ install_etcd() { ln -snf "$dist/etcd-${version}-${platform}-${target}/etcdctl" "$VTROOT/bin/etcdctl" } -# Download and install consul, link consul binary into our root. -install_consul() { - local version="$1" - local dist="$2" - - case $(uname) in - Linux) local platform=linux ;; - Darwin) local platform=darwin ;; - *) - echo "ERROR: unsupported platform for consul" - exit 1 - ;; - esac - - case $(get_arch) in - aarch64) local target=arm64 ;; - x86_64) local target=amd64 ;; - arm64) local target=arm64 ;; - *) - echo "ERROR: unsupported architecture for consul" - exit 1 - ;; - esac - - # SHA256 checksums for consul 1.11.4 from Vitess resources mirror. - # Note: darwin checksums differ from official HashiCorp releases. - local sha256 - case "${platform}_${target}" in - linux_amd64) sha256="5155f6a3b7ff14d3671b0516f6b7310530b509a2b882b95b4fdf25f4219342c8" ;; - linux_arm64) sha256="97dbf36500dcefbe463f070471602992d148cb2fe91db7e37319e1b9c809f1f0" ;; - darwin_amd64) sha256="f00f81897ec0c608019a37dec243837ce0fd471b67401ea05be9a8b105d247ce" ;; - darwin_arm64) sha256="22a87e88c9fd36f773ebd62b18f41dad5512e753769f5a385a7842a0b9364e0a" ;; - *) - echo "ERROR: no checksum for consul ${platform}_${target}" - exit 1 - ;; - esac - - local file="consul_${version}_${platform}_${target}.zip" - - # This is how we'd download directly from source: - # download_url=https://releases.hashicorp.com/consul - # wget "${download_url}/${version}/${file}" - "${VTROOT}/tools/wget-retry" -q "${VITESS_RESOURCES_DOWNLOAD_URL}/${file}" - verify_sha256 "$file" "$sha256" - unzip "$file" - ln -snf "$dist/consul" "$VTROOT/bin/consul" -} - install_all() { echo "##local system details..." echo "##platform: $(uname) target:$(get_arch) OS: $OSTYPE" @@ -318,11 +268,6 @@ install_all() { # etcd install_dep "etcd" "$ETCD_VER" "$VTROOT/dist/etcd" install_etcd - # consul - if [ "$BUILD_CONSUL" == 1 ]; then - install_dep "Consul" "$CONSUL_VER" "$VTROOT/dist/consul" install_consul - fi - echo echo "bootstrap finished - run 'make build' to compile" } diff --git a/build.env b/build.env index 2f212bbd57a..376fa17d4f6 100755 --- a/build.env +++ b/build.env @@ -30,7 +30,6 @@ export PATH="$PWD/bin:$PATH" export PROTOC_VER=21.3 export ZK_VER=${ZK_VERSION:-3.9.4} export ETCD_VER=v3.6.7 -export CONSUL_VER=1.11.4 mkdir -p "$VTDATAROOT" diff --git a/changelog/24.0/24.0.0/summary.md b/changelog/24.0/24.0.0/summary.md index 652ef201785..4e4b1a4a400 100644 --- a/changelog/24.0/24.0.0/summary.md +++ b/changelog/24.0/24.0.0/summary.md @@ -7,6 +7,8 @@ - **[New Support](#new-support)** - [Window function pushdown for sharded keyspaces](#window-function-pushdown) - [Tablet targeting via USE statement](#tablet-targeting) + - **[Removed Support](#removed-support)** + - [Consul topology and discovery support removed](#consul-removed) - **[Minor Changes](#minor-changes)** - **[VReplication](#minor-changes-vreplication)** - [`--shards` flag for MoveTables/Reshard start and stop](#vreplication-shards-flag-start-stop) @@ -57,6 +59,12 @@ Once set, all subsequent queries in the session route to the specified tablet un Note: A shard must be specified when using tablet targeting. Like shard targeting, this bypasses vindex-based routing, so use with care. +### Removed Support + +#### Consul topology and discovery support removed + +Consul support for topology servers and VTAdmin discovery has been removed in v24. Use etcd2 or zk2 for topology storage, and use the staticfile or dynamic discovery implementations for VTAdmin. + ## Minor Changes ### VReplication @@ -187,4 +195,3 @@ The lack of facilities to read the snapshots created by this feature coupled wit **Migration**: remove the VTOrc flag `--snapshot-topology-interval` before v25. **Impact**: VTOrc can no longer create snapshots of the topology in it's backend database. - diff --git a/docker/bootstrap/Dockerfile.common b/docker/bootstrap/Dockerfile.common index dda7b69b71b..618a4a1e338 100644 --- a/docker/bootstrap/Dockerfile.common +++ b/docker/bootstrap/Dockerfile.common @@ -51,7 +51,7 @@ RUN su vitess -c "mkdir -p /vt/src/vitess.io/vitess/bin && rm -rf /vt/bin && ln WORKDIR /vt/src/vitess.io/vitess USER vitess -RUN BUILD_CONSUL=0 ./bootstrap.sh +RUN ./bootstrap.sh # If the user doesn't specify a command, load a shell. CMD ["/bin/bash"] diff --git a/examples/common/backup-env.sh b/examples/common/backup-env.sh index 40de8230bc8..05670030104 100644 --- a/examples/common/backup-env.sh +++ b/examples/common/backup-env.sh @@ -1,13 +1,13 @@ #!/bin/bash # Copyright 2019 The Vitess Authors. -# +# # 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 -# +# # http://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. @@ -21,56 +21,48 @@ vtctld_web_port=15000 export VTDATAROOT="${VTDATAROOT:-${PWD}/vtdataroot}" if [[ $EUID -eq 0 ]]; then - fail "This script refuses to be run as root. Please switch to a regular user." + fail "This script refuses to be run as root. Please switch to a regular user." fi # mysqld might be in /usr/sbin which will not be in the default PATH PATH="/usr/sbin:$PATH" for binary in mysqld etcd etcdctl curl vtctldclient vttablet vtgate vtctld mysqlctl; do - command -v "$binary" > /dev/null || fail "${binary} is not installed in PATH. See https://vitess.io/docs/get-started/local/ for install instructions." -done; + command -v "$binary" >/dev/null || fail "${binary} is not installed in PATH. See https://vitess.io/docs/get-started/local/ for install instructions." +done # vtctldclient has a separate alias setup below for binary in vttablet vtgate vtctld mysqlctl vtorc vtctl; do - alias $binary="$binary --config-file-not-found-handling=ignore" -done; + alias $binary="$binary --config-file-not-found-handling=ignore" +done if [ "${TOPO}" = "zk2" ]; then - # Each ZooKeeper server needs a list of all servers in the quorum. - # Since we're running them all locally, we need to give them unique ports. - # In a real deployment, these should be on different machines, and their - # respective hostnames should be given. - zkcfg=(\ - "1@$hostname:28881:38881:21811" \ - "2@$hostname:28882:38882:21812" \ - "3@$hostname:28883:38883:21813" \ - ) - printf -v zkcfg ",%s" "${zkcfg[@]}" - zkcfg=${zkcfg:1} - - zkids='1 2 3' - - # Set topology environment parameters. - ZK_SERVER="localhost:21811,localhost:21812,localhost:21813" - # shellcheck disable=SC2034 - #TODO: Remove underscore(_) flags in v25, replace them with dashed(-) notation - TOPOLOGY_FLAGS="--topo_implementation zk2 --topo_global_server_address ${ZK_SERVER} --topo_global_root /vitess/global" - - mkdir -p "${VTDATAROOT}/tmp" -elif [ "${TOPO}" = "consul" ]; then - # Set up topology environment parameters. - CONSUL_SERVER=127.0.0.1 - CONSUL_HTTP_PORT=8500 - CONSUL_SERVER_PORT=8300 - #TODO: Remove underscore(_) flags in v25, replace them with dashed(-) notation - TOPOLOGY_FLAGS="--topo_implementation consul --topo_global_server_address ${CONSUL_SERVER}:${CONSUL_HTTP_PORT} --topo_global_root vitess/global/" - mkdir -p "${VTDATAROOT}/consul" + # Each ZooKeeper server needs a list of all servers in the quorum. + # Since we're running them all locally, we need to give them unique ports. + # In a real deployment, these should be on different machines, and their + # respective hostnames should be given. + zkcfg=( + "1@$hostname:28881:38881:21811" + "2@$hostname:28882:38882:21812" + "3@$hostname:28883:38883:21813" + ) + printf -v zkcfg ",%s" "${zkcfg[@]}" + zkcfg=${zkcfg:1} + + zkids='1 2 3' + + # Set topology environment parameters. + ZK_SERVER="localhost:21811,localhost:21812,localhost:21813" + # shellcheck disable=SC2034 + #TODO: Remove underscore(_) flags in v25, replace them with dashed(-) notation + TOPOLOGY_FLAGS="--topo_implementation zk2 --topo_global_server_address ${ZK_SERVER} --topo_global_root /vitess/global" + + mkdir -p "${VTDATAROOT}/tmp" else - ETCD_SERVER="localhost:2379" - #TODO: Remove underscore(_) flags in v25, replace them with dashed(-) notation - TOPOLOGY_FLAGS="--topo_implementation etcd2 --topo_global_server_address $ETCD_SERVER --topo_global_root /vitess/global" + ETCD_SERVER="localhost:2379" + #TODO: Remove underscore(_) flags in v25, replace them with dashed(-) notation + TOPOLOGY_FLAGS="--topo_implementation etcd2 --topo_global_server_address $ETCD_SERVER --topo_global_root /vitess/global" - mkdir -p "${VTDATAROOT}/etcd" + mkdir -p "${VTDATAROOT}/etcd" fi mkdir -p "${VTDATAROOT}/tmp" @@ -84,6 +76,5 @@ alias vtctldclient="command vtctldclient --server localhost:15999" # If using bash, make sure aliases are expanded in non-interactive shell if [[ -n ${BASH} ]]; then - shopt -s expand_aliases + shopt -s expand_aliases fi - diff --git a/examples/common/backup-scripts/consul-down.sh b/examples/common/backup-scripts/consul-down.sh deleted file mode 100755 index 2eccb8b5d96..00000000000 --- a/examples/common/backup-scripts/consul-down.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -# Copyright 2022 The Vitess Authors. -# -# 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 -# -# http://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. - -# This is an example script that stops the consul server started by consul-up.sh. - -source "$(dirname "${BASH_SOURCE[0]:-$0}")/../env.sh" - -stop_process "consul" "$VTDATAROOT/tmp/consul.pid" - diff --git a/examples/common/backup-scripts/consul-up.sh b/examples/common/backup-scripts/consul-up.sh deleted file mode 100755 index 989bb745a25..00000000000 --- a/examples/common/backup-scripts/consul-up.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash - -# Copyright 2022 The Vitess Authors. -# -# 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 -# -# http://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. - -# This is an example script that creates a single-node consul datacenter. - -source "$(dirname "${BASH_SOURCE[0]:-$0}")/../env.sh" - -cell=${CELL:-'test'} -consul_http_port=${CONSUL_HTTP_PORT:-'8500'} -consul_server_port=${CONSUL_SERVER_PORT:-'8300'} - -# Check that consul is not already running -curl "http://${CONSUL_SERVER}:${consul_http_port}" &> /dev/null && fail "consul is already running. Exiting." - -set -x -consul agent \ - -server \ - -bootstrap-expect=1 \ - -node=vitess-consul \ - -bind="${CONSUL_SERVER}" \ - -server-port="${consul_server_port}" \ - -data-dir="${VTDATAROOT}/consul/" -ui > "${VTDATAROOT}/tmp/consul.out" 2>&1 & - -PID=$! -echo $PID > "${VTDATAROOT}/tmp/consul.pid" -sleep 5 - -# Add the CellInfo description for the cell. -# If the node already exists, it's fine, means we used existing data. -echo "add ${cell} CellInfo" -set +e -# shellcheck disable=SC2086 -command vtctldclient --server internal --topo_implementation consul --topo_global_server_address "${CONSUL_SERVER}:${consul_http_port}" AddCellInfo \ - --root "/vitess/${cell}" \ - --server-address "${CONSUL_SERVER}:${consul_http_port}" \ - "${cell}" -set -e - -echo "consul start done..." diff --git a/examples/common/env.sh b/examples/common/env.sh index eea6759e533..3b4c86fdd56 100644 --- a/examples/common/env.sh +++ b/examples/common/env.sh @@ -1,13 +1,13 @@ #!/bin/bash # Copyright 2019 The Vitess Authors. -# +# # 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 -# +# # http://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. @@ -21,56 +21,48 @@ vtctld_web_port=15000 export VTDATAROOT="${VTDATAROOT:-${PWD}/vtdataroot}" if [[ $EUID -eq 0 ]]; then - fail "This script refuses to be run as root. Please switch to a regular user." + fail "This script refuses to be run as root. Please switch to a regular user." fi # mysqld might be in /usr/sbin which will not be in the default PATH PATH="/usr/sbin:$PATH" for binary in mysqld etcd etcdctl curl vtctldclient vttablet vtgate vtctld mysqlctl; do - command -v "$binary" > /dev/null || fail "${binary} is not installed in PATH. See https://vitess.io/docs/get-started/local/ for install instructions." -done; + command -v "$binary" >/dev/null || fail "${binary} is not installed in PATH. See https://vitess.io/docs/get-started/local/ for install instructions." +done # vtctldclient has a separate alias setup below for binary in vttablet vtgate vtctld mysqlctl vtorc vtctl; do - alias $binary="$binary --config-file-not-found-handling=ignore" -done; + alias $binary="$binary --config-file-not-found-handling=ignore" +done if [ "${TOPO}" = "zk2" ]; then - # Each ZooKeeper server needs a list of all servers in the quorum. - # Since we're running them all locally, we need to give them unique ports. - # In a real deployment, these should be on different machines, and their - # respective hostnames should be given. - zkcfg=(\ - "1@$hostname:28881:38881:21811" \ - "2@$hostname:28882:38882:21812" \ - "3@$hostname:28883:38883:21813" \ - ) - printf -v zkcfg ",%s" "${zkcfg[@]}" - zkcfg=${zkcfg:1} - - zkids='1 2 3' - - # Set topology environment parameters. - ZK_SERVER="localhost:21811,localhost:21812,localhost:21813" - # shellcheck disable=SC2034 - #TODO: Remove underscore(_) flags in v25, replace them with dashed(-) notation - TOPOLOGY_FLAGS="--topo-implementation zk2 --topo-global-server-address ${ZK_SERVER} --topo-global-root /vitess/global" - - mkdir -p "${VTDATAROOT}/tmp" -elif [ "${TOPO}" = "consul" ]; then - # Set up topology environment parameters. - CONSUL_SERVER=127.0.0.1 - CONSUL_HTTP_PORT=8500 - CONSUL_SERVER_PORT=8300 - #TODO: Remove underscore(_) flags in v25, replace them with dashed(-) notation - TOPOLOGY_FLAGS="--topo-implementation consul --topo-global-server-address ${CONSUL_SERVER}:${CONSUL_HTTP_PORT} --topo-global-root vitess/global/" - mkdir -p "${VTDATAROOT}/consul" + # Each ZooKeeper server needs a list of all servers in the quorum. + # Since we're running them all locally, we need to give them unique ports. + # In a real deployment, these should be on different machines, and their + # respective hostnames should be given. + zkcfg=( + "1@$hostname:28881:38881:21811" + "2@$hostname:28882:38882:21812" + "3@$hostname:28883:38883:21813" + ) + printf -v zkcfg ",%s" "${zkcfg[@]}" + zkcfg=${zkcfg:1} + + zkids='1 2 3' + + # Set topology environment parameters. + ZK_SERVER="localhost:21811,localhost:21812,localhost:21813" + # shellcheck disable=SC2034 + #TODO: Remove underscore(_) flags in v25, replace them with dashed(-) notation + TOPOLOGY_FLAGS="--topo-implementation zk2 --topo-global-server-address ${ZK_SERVER} --topo-global-root /vitess/global" + + mkdir -p "${VTDATAROOT}/tmp" else - ETCD_SERVER="localhost:2379" - #TODO: Remove underscore(_) flags in v25, replace them with dashed(-) notation - TOPOLOGY_FLAGS="--topo-implementation etcd2 --topo-global-server-address $ETCD_SERVER --topo-global-root /vitess/global" + ETCD_SERVER="localhost:2379" + #TODO: Remove underscore(_) flags in v25, replace them with dashed(-) notation + TOPOLOGY_FLAGS="--topo-implementation etcd2 --topo-global-server-address $ETCD_SERVER --topo-global-root /vitess/global" - mkdir -p "${VTDATAROOT}/etcd" + mkdir -p "${VTDATAROOT}/etcd" fi mkdir -p "${VTDATAROOT}/tmp" @@ -84,6 +76,5 @@ alias vtctldclient="command vtctldclient --server localhost:15999" # If using bash, make sure aliases are expanded in non-interactive shell if [[ -n ${BASH} ]]; then - shopt -s expand_aliases + shopt -s expand_aliases fi - diff --git a/examples/common/scripts/consul-down.sh b/examples/common/scripts/consul-down.sh deleted file mode 100755 index 2eccb8b5d96..00000000000 --- a/examples/common/scripts/consul-down.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -# Copyright 2022 The Vitess Authors. -# -# 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 -# -# http://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. - -# This is an example script that stops the consul server started by consul-up.sh. - -source "$(dirname "${BASH_SOURCE[0]:-$0}")/../env.sh" - -stop_process "consul" "$VTDATAROOT/tmp/consul.pid" - diff --git a/examples/common/scripts/consul-up.sh b/examples/common/scripts/consul-up.sh deleted file mode 100755 index 0ce571e4330..00000000000 --- a/examples/common/scripts/consul-up.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash - -# Copyright 2022 The Vitess Authors. -# -# 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 -# -# http://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. - -# This is an example script that creates a single-node consul datacenter. - -source "$(dirname "${BASH_SOURCE[0]:-$0}")/../env.sh" - -cell=${CELL:-'test'} -consul_http_port=${CONSUL_HTTP_PORT:-'8500'} -consul_server_port=${CONSUL_SERVER_PORT:-'8300'} - -# Check that consul is not already running -curl "http://${CONSUL_SERVER}:${consul_http_port}" &> /dev/null && fail "consul is already running. Exiting." - -set -x -consul agent \ - -server \ - -bootstrap-expect=1 \ - -node=vitess-consul \ - -bind="${CONSUL_SERVER}" \ - -server-port="${consul_server_port}" \ - -data-dir="${VTDATAROOT}/consul/" -ui > "${VTDATAROOT}/tmp/consul.out" 2>&1 & - -PID=$! -echo $PID > "${VTDATAROOT}/tmp/consul.pid" -sleep 5 - -# Add the CellInfo description for the cell. -# If the node already exists, it's fine, means we used existing data. -echo "add ${cell} CellInfo" -set +e -# shellcheck disable=SC2086 -command vtctldclient --server internal --topo-implementation consul --topo-global-server-address "${CONSUL_SERVER}:${consul_http_port}" AddCellInfo \ - --root "/vitess/${cell}" \ - --server-address "${CONSUL_SERVER}:${consul_http_port}" \ - "${cell}" -set -e - -echo "consul start done..." diff --git a/examples/local/101_initial_cluster.sh b/examples/local/101_initial_cluster.sh index a3397034d6c..08a68cf4fc3 100755 --- a/examples/local/101_initial_cluster.sh +++ b/examples/local/101_initial_cluster.sh @@ -31,8 +31,6 @@ SIDECAR_DB_NAME=${SIDECAR_DB_NAME:-"_vt"} # start topo server if [ "${TOPO}" = "zk2" ]; then CELL=zone1 ../common/scripts/zk-up.sh -elif [ "${TOPO}" = "consul" ]; then - CELL=zone1 ../common/scripts/consul-up.sh else CELL=zone1 ../common/scripts/etcd-up.sh fi @@ -40,7 +38,7 @@ fi # start vtctld CELL=zone1 ../common/scripts/vtctld-up.sh -if vtctldclient GetKeyspace commerce > /dev/null 2>&1 ; then +if vtctldclient GetKeyspace commerce >/dev/null 2>&1; then # Keyspace already exists: we could be running this 101 example on an non-empty VTDATAROOT vtctldclient SetKeyspaceDurabilityPolicy --durability-policy=semi_sync commerce || fail "Failed to set keyspace durability policy on the commerce keyspace" else @@ -90,4 +88,3 @@ if [[ -n ${SKIP_VTADMIN} ]]; then else ../common/scripts/vtadmin-up.sh fi - diff --git a/examples/local/501_teardown.sh b/examples/local/501_teardown.sh index fbc1ba4e37b..0bd29ac6b41 100755 --- a/examples/local/501_teardown.sh +++ b/examples/local/501_teardown.sh @@ -33,15 +33,15 @@ for tablet in 100 200 300 400; do printf -v alias '%s-%010d' 'zone1' $uid echo "Shutting down tablet $alias" CELL=zone1 TABLET_UID=$uid ../common/scripts/vttablet-down.sh - # because MySQL takes time to stop, we do this in parallel + # because MySQL takes time to stop, we do this in parallel CELL=zone1 TABLET_UID=$uid ../common/scripts/mysqlctl-down.sh & done - # without a sleep below, we can have the echo happen before the echo of mysqlctl-down.sh - sleep 2 - echo "Waiting mysqlctl to stop..." - wait - echo "mysqlctls are stopped!" + # without a sleep below, we can have the echo happen before the echo of mysqlctl-down.sh + sleep 2 + echo "Waiting mysqlctl to stop..." + wait + echo "mysqlctls are stopped!" fi done @@ -49,8 +49,6 @@ done if [ "${TOPO}" = "zk2" ]; then CELL=zone1 ../common/scripts/zk-down.sh -elif [ "${TOPO}" = "consul" ]; then - CELL=zone1 ../common/scripts/consul-down.sh else CELL=zone1 ../common/scripts/etcd-down.sh fi diff --git a/go.mod b/go.mod index bb1f042428e..f35ea2b40af 100644 --- a/go.mod +++ b/go.mod @@ -32,7 +32,6 @@ require ( github.com/gorilla/mux v1.8.1 github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 - github.com/hashicorp/consul/api v1.33.2 github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/serf v0.10.2 // indirect github.com/icrowley/fake v0.0.0-20180203215853-4178557ae428 diff --git a/go.sum b/go.sum index e0679221d8f..8847654ef08 100644 --- a/go.sum +++ b/go.sum @@ -337,10 +337,6 @@ github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDa github.com/grpc-ecosystem/go-grpc-middleware v1.4.0/go.mod h1:g5qyo/la0ALbONm6Vbp88Yd8NsDy6rZz+RcrMPxvld8= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/hashicorp/consul/api v1.33.2 h1:Q6mE0WZsUTJerlnl9TuXzqrtZ0cKdOCsxcZhj5mKbMs= -github.com/hashicorp/consul/api v1.33.2/go.mod h1:K3yoL/vnIBcQV/25NeMZVokRvPPERiqp2Udtr4xAfhs= -github.com/hashicorp/consul/sdk v0.17.1 h1:LumAh8larSXmXw2wvw/lK5ZALkJ2wK8VRwWMLVV5M5c= -github.com/hashicorp/consul/sdk v0.17.1/go.mod h1:EngiixMhmw9T7wApycq6rDRFXXVUwjjf7HuLiGMH/Sw= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= diff --git a/go/cmd/topo2topo/cli/plugin_consultopo.go b/go/cmd/topo2topo/cli/plugin_consultopo.go deleted file mode 100644 index 56d178e2975..00000000000 --- a/go/cmd/topo2topo/cli/plugin_consultopo.go +++ /dev/null @@ -1,23 +0,0 @@ -/* -Copyright 2019 The Vitess Authors. - -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 - - http://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. -*/ - -package cli - -// This plugin imports consultopo to register the consul implementation of TopoServer. - -import ( - _ "vitess.io/vitess/go/vt/topo/consultopo" -) diff --git a/go/cmd/vtbackup/cli/plugin_consultopo.go b/go/cmd/vtbackup/cli/plugin_consultopo.go deleted file mode 100644 index c2f8de3339e..00000000000 --- a/go/cmd/vtbackup/cli/plugin_consultopo.go +++ /dev/null @@ -1,21 +0,0 @@ -/* -Copyright 2019 The Vitess Authors - -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 - - http://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. -*/ - -package cli - -import ( - _ "vitess.io/vitess/go/vt/topo/consultopo" -) diff --git a/go/cmd/vtctld/cli/plugin_consultopo.go b/go/cmd/vtctld/cli/plugin_consultopo.go deleted file mode 100644 index b8f8f2e8cdc..00000000000 --- a/go/cmd/vtctld/cli/plugin_consultopo.go +++ /dev/null @@ -1,23 +0,0 @@ -/* -Copyright 2019 The Vitess Authors. - -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 - - http://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. -*/ - -package cli - -// Imports and register the 'consul' topo.Server. - -import ( - _ "vitess.io/vitess/go/vt/topo/consultopo" -) diff --git a/go/cmd/vtctldclient/command/root.go b/go/cmd/vtctldclient/command/root.go index ca712a23f5c..75c74e624d6 100644 --- a/go/cmd/vtctldclient/command/root.go +++ b/go/cmd/vtctldclient/command/root.go @@ -51,7 +51,6 @@ import ( _ "vitess.io/vitess/go/cmd/vtctldclient/command/vreplication/workflow" // These imports register the topo factories to use when --server=internal. - _ "vitess.io/vitess/go/vt/topo/consultopo" _ "vitess.io/vitess/go/vt/topo/etcd2topo" _ "vitess.io/vitess/go/vt/topo/zk2topo" ) diff --git a/go/cmd/vtgate/cli/plugin_consultopo.go b/go/cmd/vtgate/cli/plugin_consultopo.go deleted file mode 100644 index 56d178e2975..00000000000 --- a/go/cmd/vtgate/cli/plugin_consultopo.go +++ /dev/null @@ -1,23 +0,0 @@ -/* -Copyright 2019 The Vitess Authors. - -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 - - http://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. -*/ - -package cli - -// This plugin imports consultopo to register the consul implementation of TopoServer. - -import ( - _ "vitess.io/vitess/go/vt/topo/consultopo" -) diff --git a/go/cmd/vtorc/cli/plugin_consultopo.go b/go/cmd/vtorc/cli/plugin_consultopo.go deleted file mode 100644 index 56d178e2975..00000000000 --- a/go/cmd/vtorc/cli/plugin_consultopo.go +++ /dev/null @@ -1,23 +0,0 @@ -/* -Copyright 2019 The Vitess Authors. - -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 - - http://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. -*/ - -package cli - -// This plugin imports consultopo to register the consul implementation of TopoServer. - -import ( - _ "vitess.io/vitess/go/vt/topo/consultopo" -) diff --git a/go/cmd/vttablet/cli/plugin_consultopo.go b/go/cmd/vttablet/cli/plugin_consultopo.go deleted file mode 100644 index 56d178e2975..00000000000 --- a/go/cmd/vttablet/cli/plugin_consultopo.go +++ /dev/null @@ -1,23 +0,0 @@ -/* -Copyright 2019 The Vitess Authors. - -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 - - http://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. -*/ - -package cli - -// This plugin imports consultopo to register the consul implementation of TopoServer. - -import ( - _ "vitess.io/vitess/go/vt/topo/consultopo" -) diff --git a/go/cmd/vttestserver/cli/main_test.go b/go/cmd/vttestserver/cli/main_test.go index fee457d9640..7265c48402b 100644 --- a/go/cmd/vttestserver/cli/main_test.go +++ b/go/cmd/vttestserver/cli/main_test.go @@ -21,14 +21,11 @@ import ( "fmt" "io" "math/rand/v2" - "os/exec" "path" - "strconv" "strings" "testing" "time" - "github.com/hashicorp/consul/api" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "google.golang.org/protobuf/encoding/protojson" @@ -36,7 +33,6 @@ import ( "vitess.io/vitess/go/mysql" "vitess.io/vitess/go/sqltypes" "vitess.io/vitess/go/test/endtoend/cluster" - "vitess.io/vitess/go/vt/log" "vitess.io/vitess/go/vt/logutil" "vitess.io/vitess/go/vt/tlstest" "vitess.io/vitess/go/vt/vtctl/vtctlclient" @@ -269,33 +265,6 @@ func TestGatewayInitialTabletTimeout(t *testing.T) { assertGetKeyspaces(ctx, t, cluster) } -func TestExternalTopoServerConsul(t *testing.T) { - conf := config - defer resetConfig(conf) - - // Start a single consul in the background. - cmd, serverAddr := startConsul(t) - defer func() { - // Alerts command did not run successful - if err := cmd.Process.Kill(); err != nil { - log.Errorf("cmd process kill has an error: %v", err) - } - // Alerts command did not run successful - if err := cmd.Wait(); err != nil { - log.Errorf("cmd process wait has an error: %v", err) - } - }() - - cluster, err := startCluster("--external-topo-implementation=consul", - "--external-topo-global-server-address="+serverAddr, "--external-topo-global-root=consul_test/global") - require.NoError(t, err) - defer cluster.TearDown() - - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) - defer cancel() - assertGetKeyspaces(ctx, t, cluster) -} - func TestMtlsAuth(t *testing.T) { conf := config defer resetConfig(conf) @@ -504,44 +473,3 @@ func consumeEventStream(stream logutil.EventStream) (string, error) { } } } - -// startConsul starts a consul subprocess, and waits for it to be ready. -// Returns the exec.Cmd forked, and the server address to RPC-connect to. -func startConsul(t *testing.T) (*exec.Cmd, string) { - // pick a random port to make sure things work with non-default port - port := randomPort() - - cmd := exec.Command("consul", - "agent", - "-dev", - "-http-port", strconv.Itoa(port)) - err := cmd.Start() - if err != nil { - t.Fatalf("failed to start consul: %v", err) - } - - // Create a client to connect to the created consul. - serverAddr := fmt.Sprintf("localhost:%v", port) - cfg := api.DefaultConfig() - cfg.Address = serverAddr - c, err := api.NewClient(cfg) - if err != nil { - t.Fatalf("api.NewClient(%v) failed: %v", serverAddr, err) - } - - // Wait until we can list "/", or timeout. - start := time.Now() - kv := c.KV() - for { - _, _, err := kv.List("/", nil) - if err == nil { - break - } - if time.Since(start) > 10*time.Second { - t.Fatalf("Failed to start consul daemon in time. Consul is returning error: %v", err) - } - time.Sleep(10 * time.Millisecond) - } - - return cmd, serverAddr -} diff --git a/go/test/endtoend/cluster/cluster_process.go b/go/test/endtoend/cluster/cluster_process.go index 097a3c04c1b..915ce170198 100644 --- a/go/test/endtoend/cluster/cluster_process.go +++ b/go/test/endtoend/cluster/cluster_process.go @@ -69,7 +69,7 @@ const ( var ( keepData = flag.Bool("keep-data", true, "don't delete the per-test VTDATAROOT subfolders") - topoFlavor = flag.String("topo-flavor", "etcd2", "choose a topo server from etcd2, zk2 or consul") + topoFlavor = flag.String("topo-flavor", "etcd2", "choose a topo server from etcd2 or zk2") isCoverage = flag.Bool("is-coverage", false, "whether coverage is required") forceVTDATAROOT = flag.String("force-vtdataroot", "", "force path for VTDATAROOT, which may already be populated") forcePortStart = flag.Int("force-port-start", 0, "force assigning ports based on this seed") diff --git a/go/test/endtoend/cluster/topo_process.go b/go/test/endtoend/cluster/topo_process.go index 80070f6ca47..8fcbd6ca8d1 100644 --- a/go/test/endtoend/cluster/topo_process.go +++ b/go/test/endtoend/cluster/topo_process.go @@ -18,7 +18,6 @@ package cluster import ( "context" - "encoding/json" "errors" "fmt" "net" @@ -37,7 +36,6 @@ import ( vtopo "vitess.io/vitess/go/vt/topo" // Register topo server implementations - _ "vitess.io/vitess/go/vt/topo/consultopo" _ "vitess.io/vitess/go/vt/topo/etcd2topo" _ "vitess.io/vitess/go/vt/topo/zk2topo" ) @@ -69,8 +67,6 @@ func (topo *TopoProcess) Setup(topoFlavor string, cluster *LocalProcessCluster) switch topoFlavor { case "zk2": err = topo.SetupZookeeper(cluster) - case "consul": - err = topo.SetupConsul(cluster) default: // Override any inherited ETCDCTL_API env value to // ensure that we use the v3 API and storage. @@ -192,116 +188,6 @@ func (topo *TopoProcess) SetupZookeeper(cluster *LocalProcessCluster) error { return topo.proc.Run() } -// ConsulConfigs are the configurations that are added the config files which are used by consul -type ConsulConfigs struct { - Ports PortsInfo `json:"ports"` - DataDir string `json:"data_dir"` - LogFile string `json:"log_file"` -} - -// PortsInfo is the different ports used by consul -type PortsInfo struct { - DNS int `json:"dns"` - HTTP int `json:"http"` - SerfLan int `json:"serf_lan"` - SerfWan int `json:"serf_wan"` - Server int `json:"server"` -} - -// SetupConsul spawns a new consul service and initializes it with the defaults. -// The service is kept running in the background until TearDown() is called. -func (topo *TopoProcess) SetupConsul(cluster *LocalProcessCluster) (err error) { - topo.VerifyURL = fmt.Sprintf("http://%s:%d/v1/kv/?keys", topo.Host, topo.Port) - - err = os.MkdirAll(topo.LogDirectory, os.ModePerm) - if err != nil { - log.Errorf("Failed to create directory for consul logs: %v", err) - return - } - err = os.MkdirAll(topo.DataDirectory, os.ModePerm) - if err != nil { - log.Errorf("Failed to create directory for consul data: %v", err) - return - } - - configFile := path.Join(os.Getenv("VTDATAROOT"), "consul.json") - - logFile := path.Join(topo.LogDirectory, "/consul.log") - _, err = os.Create(logFile) - if err != nil { - log.Errorf("Failed to create file for consul logs: %v", err) - return - } - - var config []byte - configs := ConsulConfigs{ - Ports: PortsInfo{ - DNS: cluster.GetAndReservePort(), - HTTP: topo.Port, - SerfLan: cluster.GetAndReservePort(), - SerfWan: cluster.GetAndReservePort(), - Server: cluster.GetAndReservePort(), - }, - DataDir: topo.DataDirectory, - LogFile: logFile, - } - config, err = json.Marshal(configs) - if err != nil { - log.Error(err.Error()) - return - } - - err = os.WriteFile(configFile, config, 0o666) - if err != nil { - return - } - - topo.proc = exec.Command( - topo.Binary, "agent", - "-server", - "-ui", - "-bootstrap-expect", "1", - "-bind", "127.0.0.1", - "-config-file", configFile, - ) - - errFile, err := os.Create(path.Join(topo.LogDirectory, "topo-stderr.txt")) - if err != nil { - log.Errorf("Failed to create file for consul stderr: %v", err) - return - } - topo.proc.Stderr = errFile - - topo.proc.Env = append(topo.proc.Env, os.Environ()...) - - log.Errorf("Starting consul with args %v", strings.Join(topo.proc.Args, " ")) - err = topo.proc.Start() - if err != nil { - return - } - - topo.exit = make(chan error) - go func() { - topo.exit <- topo.proc.Wait() - close(topo.exit) - }() - - timeout := time.Now().Add(60 * time.Second) - for time.Now().Before(timeout) { - if topo.IsHealthy() { - return - } - select { - case err := <-topo.exit: - return fmt.Errorf("process '%s' exited prematurely (err: %s)", topo.Binary, err) - default: - time.Sleep(300 * time.Millisecond) - } - } - - return fmt.Errorf("process '%s' timed out after 60s (err: %s)", topo.Binary, <-topo.exit) -} - // TearDown shutdowns the running topo service. func (topo *TopoProcess) TearDown(Cell string, originalVtRoot string, currentRoot string, keepdata bool, topoFlavor string) error { if topo.Server != nil { @@ -439,9 +325,6 @@ func TopoProcessInstance(port int, peerPort int, hostname string, flavor string, if flavor == "zk2" { binary = "zkctl" } - if flavor == "consul" { - binary = "consul" - } topo := &TopoProcess{ Name: name, @@ -461,10 +344,5 @@ func TopoProcessInstance(port int, peerPort int, hostname string, flavor string, // TopoGlobalRoot returns the global root for the given topo flavor. func TopoGlobalRoot(flavor string) string { - switch flavor { - case "consul": - return "global" - default: - return "/vitess/global" - } + return "/vitess/global" } diff --git a/go/test/endtoend/cluster/vt_process.go b/go/test/endtoend/cluster/vt_process.go index d1b7180b31d..a13c9c8bfcf 100644 --- a/go/test/endtoend/cluster/vt_process.go +++ b/go/test/endtoend/cluster/vt_process.go @@ -43,10 +43,6 @@ func VtProcessInstance(name, binary string, topoPort int, hostname string) VtPro switch *topoFlavor { case "zk2": topoImplementation = "zk2" - case "consul": - topoImplementation = "consul" - // For consul we do not need "/" in the path - topoRootPath = "" } vt := VtProcess{ diff --git a/go/test/endtoend/topotest/consul/main_test.go b/go/test/endtoend/topotest/consul/main_test.go deleted file mode 100644 index 6b61aa4c633..00000000000 --- a/go/test/endtoend/topotest/consul/main_test.go +++ /dev/null @@ -1,299 +0,0 @@ -/* -Copyright 2021 The Vitess Authors. - -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 - - http://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. -*/ - -package consul - -import ( - "context" - "flag" - "fmt" - "os" - "testing" - "time" - - "github.com/google/go-cmp/cmp" - "github.com/stretchr/testify/require" - - "vitess.io/vitess/go/mysql" - "vitess.io/vitess/go/sqltypes" - "vitess.io/vitess/go/test/endtoend/cluster" - topoutils "vitess.io/vitess/go/test/endtoend/topotest/utils" - "vitess.io/vitess/go/vt/log" - "vitess.io/vitess/go/vt/topo" -) - -var ( - clusterInstance *cluster.LocalProcessCluster - cell = "zone1" - hostname = "localhost" - KeyspaceName = "customer" - SchemaSQL = ` -CREATE TABLE t1 ( - c1 BIGINT NOT NULL, - c2 BIGINT NOT NULL, - c3 BIGINT, - c4 varchar(100), - PRIMARY KEY (c1), - UNIQUE KEY (c2), - UNIQUE KEY (c3), - UNIQUE KEY (c4) -) ENGINE=Innodb;` - VSchema = ` -{ - "sharded": false, - "tables": { - "t1": {} - } -} -` -) - -func TestMain(m *testing.M) { - flag.Parse() - - exitCode := func() int { - clusterInstance = cluster.NewCluster(cell, hostname) - defer clusterInstance.Teardown() - - // Start topo server - clusterInstance.TopoFlavor = "consul" - if err := clusterInstance.StartTopo(); err != nil { - return 1 - } - - // Start keyspace - Keyspace := &cluster.Keyspace{ - Name: KeyspaceName, - SchemaSQL: SchemaSQL, - VSchema: VSchema, - } - if err := clusterInstance.StartUnshardedKeyspace(*Keyspace, 0, false, clusterInstance.Cell); err != nil { - log.Fatal(err.Error()) - return 1 - } - - // Start vtgate - if err := clusterInstance.StartVtgate(); err != nil { - log.Fatal(err.Error()) - return 1 - } - - return m.Run() - }() - os.Exit(exitCode) -} - -func TestTopoRestart(t *testing.T) { - ctx := t.Context() - vtParams := mysql.ConnParams{ - Host: "localhost", - Port: clusterInstance.VtgateMySQLPort, - } - conn, err := mysql.Connect(ctx, &vtParams) - require.Nil(t, err) - defer conn.Close() - - execMulti(t, conn, `insert into t1(c1, c2, c3, c4) values (300,100,300,'abc'); ;; insert into t1(c1, c2, c3, c4) values (301,101,301,'abcd');;`) - assertMatches(t, conn, `select c1,c2,c3 from t1`, `[[INT64(300) INT64(100) INT64(300)] [INT64(301) INT64(101) INT64(301)]]`) - - defer execute(t, conn, `delete from t1`) - - ch := make(chan any) - - go func() { - clusterInstance.TopoProcess.TearDown(clusterInstance.Cell, clusterInstance.OriginalVTDATAROOT, clusterInstance.CurrentVTDATAROOT, true, *clusterInstance.TopoFlavorString()) - - // Some sleep to server few queries when topo is down. - time.Sleep(400 * time.Millisecond) - - clusterInstance.TopoProcess.Setup(*clusterInstance.TopoFlavorString(), clusterInstance) - - // topo is up now. - ch <- 1 - }() - - timeOut := time.After(15 * time.Second) - - for { - select { - case <-ch: - return - case <-timeOut: - require.Fail(t, "timed out - topo process did not come up") - case <-time.After(100 * time.Millisecond): - assertMatches(t, conn, `select c1,c2,c3 from t1`, `[[INT64(300) INT64(100) INT64(300)] [INT64(301) INT64(101) INT64(301)]]`) - } - } -} - -// TestShardLocking tests that shard locking works as intended. -func TestShardLocking(t *testing.T) { - // create topo server connection - ts, err := topo.OpenServer(*clusterInstance.TopoFlavorString(), clusterInstance.VtctldClientProcess.TopoGlobalAddress, clusterInstance.VtctldClientProcess.TopoGlobalRoot) - require.NoError(t, err) - - // Acquire a shard lock. - ctx, unlock, err := ts.LockShard(context.Background(), KeyspaceName, "0", "TestShardLocking") - require.NoError(t, err) - // Check that we can't reacquire it from the same context. - _, _, err = ts.LockShard(ctx, KeyspaceName, "0", "TestShardLocking") - require.ErrorContains(t, err, "lock for shard customer/0 is already held") - // Also check that TryLockShard is non-blocking and returns an error. - _, _, err = ts.TryLockShard(context.Background(), KeyspaceName, "0", "TestShardLocking") - require.ErrorContains(t, err, "node already exists: lock already exists at path keyspaces/customer/shards/0") - // Check that CheckShardLocked doesn't return an error. - err = topo.CheckShardLocked(ctx, KeyspaceName, "0") - require.NoError(t, err) - - // We'll now try to acquire the lock from a different thread. - secondThreadLockAcquired := false - go func() { - _, unlock, err := ts.LockShard(context.Background(), KeyspaceName, "0", "TestShardLocking") - defer unlock(&err) - require.NoError(t, err) - secondThreadLockAcquired = true - }() - - // Wait for some time and ensure that the second acquiring of lock shard is blocked. - time.Sleep(100 * time.Millisecond) - require.False(t, secondThreadLockAcquired) - - // Unlock the shard. - unlock(&err) - // Check that we no longer have shard lock acquired. - err = topo.CheckShardLocked(ctx, KeyspaceName, "0") - require.ErrorContains(t, err, "shard customer/0 is not locked (no lockInfo in map)") - - // Wait to see that the second thread was able to acquire the shard lock. - topoutils.WaitForBoolValue(t, &secondThreadLockAcquired, true) -} - -// TestKeyspaceLocking tests that keyspace locking works as intended. -func TestKeyspaceLocking(t *testing.T) { - // create topo server connection - ts, err := topo.OpenServer(*clusterInstance.TopoFlavorString(), clusterInstance.VtctldClientProcess.TopoGlobalAddress, clusterInstance.VtctldClientProcess.TopoGlobalRoot) - require.NoError(t, err) - - // Acquire a keyspace lock. - ctx, unlock, err := ts.LockKeyspace(context.Background(), KeyspaceName, "TestKeyspaceLocking") - require.NoError(t, err) - // Check that we can't reacquire it from the same context. - _, _, err = ts.LockKeyspace(ctx, KeyspaceName, "TestKeyspaceLocking") - require.ErrorContains(t, err, "lock for keyspace customer is already held") - // Check that CheckKeyspaceLocked doesn't return an error. - err = topo.CheckKeyspaceLocked(ctx, KeyspaceName) - require.NoError(t, err) - - // We'll now try to acquire the lock from a different thread. - secondThreadLockAcquired := false - go func() { - _, unlock, err := ts.LockKeyspace(context.Background(), KeyspaceName, "TestKeyspaceLocking") - defer unlock(&err) - require.NoError(t, err) - secondThreadLockAcquired = true - }() - - // Wait for some time and ensure that the second acquiring of lock shard is blocked. - time.Sleep(100 * time.Millisecond) - require.False(t, secondThreadLockAcquired) - - // Unlock the keyspace. - unlock(&err) - // Check that we no longer have keyspace lock acquired. - err = topo.CheckKeyspaceLocked(ctx, KeyspaceName) - require.ErrorContains(t, err, "keyspace customer is not locked (no lockInfo in map)") - - // Wait to see that the second thread was able to acquire the shard lock. - topoutils.WaitForBoolValue(t, &secondThreadLockAcquired, true) -} - -// TestNamedLocking tests that named locking works as intended. -func TestNamedLocking(t *testing.T) { - // Create topo server connection. - ts, err := topo.OpenServer(*clusterInstance.TopoFlavorString(), clusterInstance.VtctldClientProcess.TopoGlobalAddress, clusterInstance.VtctldClientProcess.TopoGlobalRoot) - require.NoError(t, err) - - ctx := t.Context() - lockName := "TestNamedLocking" - action := "Testing" - - // Acquire a named lock. - ctx, unlock, err := ts.LockName(ctx, lockName, action) - require.NoError(t, err) - - // Check that we can't reacquire it from the same context. - _, _, err = ts.LockName(ctx, lockName, action) - require.ErrorContains(t, err, fmt.Sprintf("lock for named %s is already held", lockName)) - - // Check that CheckNameLocked doesn't return an error as we should still be - // holding the lock. - err = topo.CheckNameLocked(ctx, lockName) - require.NoError(t, err) - - // We'll now try to acquire the lock from a different goroutine. - secondCallerAcquired := false - go func() { - _, unlock, err := ts.LockName(context.Background(), lockName, action) - defer unlock(&err) - require.NoError(t, err) - secondCallerAcquired = true - }() - - // Wait for some time and ensure that the second attempt at acquiring the lock - // is blocked. - time.Sleep(100 * time.Millisecond) - require.False(t, secondCallerAcquired) - - // Unlock the name. - unlock(&err) - // Check that we no longer have the named lock. - err = topo.CheckNameLocked(ctx, lockName) - require.ErrorContains(t, err, fmt.Sprintf("named %s is not locked (no lockInfo in map)", lockName)) - - // Wait to see that the second goroutine WAS now able to acquire the named lock. - topoutils.WaitForBoolValue(t, &secondCallerAcquired, true) -} - -func execute(t *testing.T, conn *mysql.Conn, query string) *sqltypes.Result { - t.Helper() - qr, err := conn.ExecuteFetch(query, 1000, true) - require.NoError(t, err) - return qr -} - -func execMulti(t *testing.T, conn *mysql.Conn, query string) []*sqltypes.Result { - t.Helper() - var res []*sqltypes.Result - qr, more, err := conn.ExecuteFetchMulti(query, 1000, true) - res = append(res, qr) - require.NoError(t, err) - for more == true { - qr, more, _, err = conn.ReadQueryResult(1000, true) - require.NoError(t, err) - res = append(res, qr) - } - return res -} - -func assertMatches(t *testing.T, conn *mysql.Conn, query, expected string) { - t.Helper() - qr := execute(t, conn, query) - got := fmt.Sprintf("%v", qr.Rows) - diff := cmp.Diff(expected, got) - if diff != "" { - t.Errorf("Query: %s (-want +got):\n%s", query, diff) - } -} diff --git a/go/test/endtoend/vtorc/utils/utils.go b/go/test/endtoend/vtorc/utils/utils.go index 0d04b8f325c..dc5637c58e8 100644 --- a/go/test/endtoend/vtorc/utils/utils.go +++ b/go/test/endtoend/vtorc/utils/utils.go @@ -45,7 +45,6 @@ import ( "vitess.io/vitess/go/vt/vtorc/logic" // Register topo implementations. - _ "vitess.io/vitess/go/vt/topo/consultopo" _ "vitess.io/vitess/go/vt/topo/etcd2topo" _ "vitess.io/vitess/go/vt/topo/zk2topo" ) diff --git a/go/testfiles/ports.go b/go/testfiles/ports.go index b6e0800d23f..cc53b18e339 100644 --- a/go/testfiles/ports.go +++ b/go/testfiles/ports.go @@ -40,10 +40,6 @@ var ( // GoVtTopoZk2topoPort is used by the go/vt/topo/zk2topo package. // Takes three ports. GoVtTopoZk2topoPort = GoVtTopoEtcd2topoPort + 2 - - // GoVtTopoConsultopoPort is used by the go/vt/topo/consultopo package. - // Takes four ports. - GoVtTopoConsultopoPort = GoVtTopoZk2topoPort + 3 ) // Zookeeper server ID definitions. Unit tests may run at the diff --git a/go/vt/topo/conn.go b/go/vt/topo/conn.go index 980981b24c4..885cc276993 100644 --- a/go/vt/topo/conn.go +++ b/go/vt/topo/conn.go @@ -123,7 +123,7 @@ type Conn interface { // LockWithTTL is similar to `Lock` but the difference is that it allows // you to override the global default TTL that is configured for the - // implementation (--topo-etcd-lease-ttl and --topo-consul-lock-session-ttl). + // implementation (--topo-etcd-lease-ttl). // Note: this is no different than `Lock` for ZooKeeper as it does not // support lock TTLs and they exist until released or the session ends. LockWithTTL(ctx context.Context, dirPath, contents string, ttl time.Duration) (LockDescriptor, error) diff --git a/go/vt/topo/consultopo/config.go b/go/vt/topo/consultopo/config.go deleted file mode 100644 index da3e7f44fb4..00000000000 --- a/go/vt/topo/consultopo/config.go +++ /dev/null @@ -1,23 +0,0 @@ -/* -Copyright 2019 The Vitess Authors. - -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 - - http://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. -*/ - -package consultopo - -const ( - // Path components - locksFilename = "Lock" - electionsPath = "elections" -) diff --git a/go/vt/topo/consultopo/directory.go b/go/vt/topo/consultopo/directory.go deleted file mode 100644 index 36eb22886a6..00000000000 --- a/go/vt/topo/consultopo/directory.go +++ /dev/null @@ -1,86 +0,0 @@ -/* -Copyright 2019 The Vitess Authors. - -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 - - http://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. -*/ - -package consultopo - -import ( - "context" - "path" - "strings" - - "vitess.io/vitess/go/vt/topo" -) - -// ListDir is part of the topo.Conn interface. -func (s *Server) ListDir(ctx context.Context, dirPath string, full bool) ([]topo.DirEntry, error) { - nodePath := path.Join(s.root, dirPath) + "/" - if nodePath == "//" { - // Special case where c.root is "/", dirPath is empty, - // we would end up with "//". in that case, we want "/". - nodePath = "/" - } - - isRoot := dirPath == "" || dirPath == "/" - - keys, _, err := s.kv.Keys(nodePath, "", nil) - if err != nil { - return nil, err - } - if len(keys) == 0 { - // No key starts with this prefix, means the directory - // doesn't exist. - return nil, topo.NewError(topo.NoNode, nodePath) - } - - prefixLen := len(nodePath) - var result []topo.DirEntry - for _, p := range keys { - // Remove the prefix, base path. - if !strings.HasPrefix(p, nodePath) { - return nil, ErrBadResponse - } - p = p[prefixLen:] - - // Keep only the part until the first '/'. - t := topo.TypeFile - if i := strings.Index(p, "/"); i >= 0 { - p = p[:i] - t = topo.TypeDirectory - } - - // Remove duplicates, add to list. - if len(result) == 0 || result[len(result)-1].Name != p { - e := topo.DirEntry{ - Name: p, - } - if full { - e.Type = t - if isRoot && p == electionsPath { - e.Ephemeral = true - } - if p == locksFilename && t == topo.TypeFile { - // A file called 'Lock' is always ephemeral. - // (A directory called 'Lock' could be a keyspace or - // a shard named Lock). - e.Ephemeral = true - } - } - result = append(result, e) - } - } - - return result, nil -} diff --git a/go/vt/topo/consultopo/election.go b/go/vt/topo/consultopo/election.go deleted file mode 100644 index 9f3ad61e5ee..00000000000 --- a/go/vt/topo/consultopo/election.go +++ /dev/null @@ -1,141 +0,0 @@ -/* -Copyright 2019 The Vitess Authors. - -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 - - http://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. -*/ - -package consultopo - -import ( - "context" - "path" - - "github.com/hashicorp/consul/api" - - "vitess.io/vitess/go/vt/log" - "vitess.io/vitess/go/vt/topo" -) - -// NewLeaderParticipation is part of the topo.Server interface -func (s *Server) NewLeaderParticipation(name, id string) (topo.LeaderParticipation, error) { - return &consulLeaderParticipation{ - s: s, - name: name, - id: id, - stop: make(chan struct{}), - done: make(chan struct{}), - }, nil -} - -// consulLeaderParticipation implements topo.LeaderParticipation. -// -// We use a key with name /elections/ for the lock, -// that contains the id. -type consulLeaderParticipation struct { - // s is our parent consul topo Server - s *Server - - // name is the name of this LeaderParticipation - name string - - // id is the process's current id. - id string - - // stop is a channel closed when Stop is called. - stop chan struct{} - - // done is a channel closed when we're done processing the Stop - done chan struct{} -} - -// WaitForLeadership is part of the topo.LeaderParticipation interface. -func (mp *consulLeaderParticipation) WaitForLeadership() (context.Context, error) { - electionPath := path.Join(mp.s.root, electionsPath, mp.name) - l, err := mp.s.client.LockOpts(&api.LockOptions{ - Key: electionPath, - Value: []byte(mp.id), - }) - if err != nil { - return nil, err - } - - // If Stop was already called, mp.done is closed, so we are interrupted. - select { - case <-mp.done: - return nil, topo.NewError(topo.Interrupted, "Leadership") - default: - } - - // Try to lock until mp.stop is closed. - lost, err := l.Lock(mp.stop) - if err != nil { - // We can't lock. See if it was because we got canceled. - select { - case <-mp.stop: - close(mp.done) - default: - } - return nil, err - } - - // We have the lock, keep primaryship until we lose it. - lockCtx, lockCancel := context.WithCancel(context.Background()) - go func() { - select { - case <-lost: - lockCancel() - // We could have lost the lock. Per consul API, explicitly call Unlock to make sure that session will not be renewed. - if err := l.Unlock(); err != nil { - log.Errorf("Leader election(%v) Unlock failed: %v", mp.name, err) - } - case <-mp.stop: - // Stop was called. We stop the context first, - // so the running process is not thinking it - // is the primary any more, then we unlock. - lockCancel() - if err := l.Unlock(); err != nil { - log.Errorf("Leader election(%v) Unlock failed: %v", mp.name, err) - } - close(mp.done) - } - }() - - return lockCtx, nil -} - -// Stop is part of the topo.LeaderParticipation interface -func (mp *consulLeaderParticipation) Stop() { - close(mp.stop) - <-mp.done -} - -// GetCurrentLeaderID is part of the topo.LeaderParticipation interface -func (mp *consulLeaderParticipation) GetCurrentLeaderID(ctx context.Context) (string, error) { - electionPath := path.Join(mp.s.root, electionsPath, mp.name) - pair, _, err := mp.s.kv.Get(electionPath, nil) - if err != nil { - return "", err - } - if pair == nil { - return "", nil - } - return string(pair.Value), nil -} - -// WaitForNewLeader is part of the topo.LeaderParticipation interface -func (mp *consulLeaderParticipation) WaitForNewLeader(context.Context) (<-chan string, error) { - // This isn't implemented yet, but likely can be implemented using List - // with blocking logic on election path. - // See also how WatchRecursive could be implemented as well. - return nil, topo.NewError(topo.NoImplementation, "wait for leader not supported in Consul topo") -} diff --git a/go/vt/topo/consultopo/error.go b/go/vt/topo/consultopo/error.go deleted file mode 100644 index 0567049026d..00000000000 --- a/go/vt/topo/consultopo/error.go +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright 2019 The Vitess Authors. - -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 - - http://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. -*/ - -package consultopo - -import ( - "context" - "errors" - "net/url" - - "vitess.io/vitess/go/vt/topo" -) - -// Errors specific to this package. -var ( - // ErrBadResponse is returned from this package if the - // response from the consul server does not contain the data - // that the API promises. The consul client unmarshals JSON - // from the server into a Response struct that uses pointers, - // so we need to check for nil pointers, or else a misbehaving - // consul could cause us to panic. - ErrBadResponse = errors.New("consul request returned success, but response is missing required data") -) - -// convertError converts a context error into a topo error. All errors -// are either application-level errors, or context errors. -func convertError(err error, nodePath string) error { - // Unwrap errors from the Go HTTP client. - var urlErr *url.Error - if errors.As(err, &urlErr) { - err = urlErr.Err - } - - // Convert specific sentinel values. - switch { - case errors.Is(err, context.Canceled): - return topo.NewError(topo.Interrupted, nodePath) - case errors.Is(err, context.DeadlineExceeded): - return topo.NewError(topo.Timeout, nodePath) - } - - return err -} diff --git a/go/vt/topo/consultopo/file.go b/go/vt/topo/consultopo/file.go deleted file mode 100644 index 24759b5e43c..00000000000 --- a/go/vt/topo/consultopo/file.go +++ /dev/null @@ -1,173 +0,0 @@ -/* -Copyright 2019 The Vitess Authors. - -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 - - http://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. -*/ - -package consultopo - -import ( - "context" - "path" - - "github.com/hashicorp/consul/api" - - "vitess.io/vitess/go/vt/topo" -) - -// Create is part of the topo.Conn interface. -func (s *Server) Create(ctx context.Context, filePath string, contents []byte) (topo.Version, error) { - nodePath := path.Join(s.root, filePath) - - // We need to do a Put with version=0 and get the version - // back. KV.CAS does not return that information. However, a - // CAS in a transaction will return the node's data, so we use that. - ops := api.KVTxnOps{ - &api.KVTxnOp{ - Verb: api.KVCAS, - Key: nodePath, - Value: contents, - Index: 0, - }, - } - ok, resp, _, err := s.kv.Txn(ops, nil) - if err != nil { - // Communication error. - return nil, err - } - if !ok { - // Transaction was rolled back, means the node exists. - return nil, topo.NewError(topo.NodeExists, nodePath) - } - return ConsulVersion(resp.Results[0].ModifyIndex), nil -} - -// Update is part of the topo.Conn interface. -func (s *Server) Update(ctx context.Context, filePath string, contents []byte, version topo.Version) (topo.Version, error) { - nodePath := path.Join(s.root, filePath) - - // Again, we need to get the final version back. - // So we have to use a transaction, as Put doesn't return the version. - ops := api.KVTxnOps{ - &api.KVTxnOp{ - Verb: api.KVSet, - Key: nodePath, - Value: contents, - }, - } - if version != nil { - ops[0].Verb = api.KVCAS - ops[0].Index = uint64(version.(ConsulVersion)) - } - ok, resp, _, err := s.kv.Txn(ops, nil) - if err != nil { - // Communication error. - return nil, err - } - if !ok { - // Transaction was rolled back, means the node has a - // bad version. - return nil, topo.NewError(topo.BadVersion, nodePath) - } - return ConsulVersion(resp.Results[0].ModifyIndex), nil -} - -// Get is part of the topo.Conn interface. -func (s *Server) Get(ctx context.Context, filePath string) ([]byte, topo.Version, error) { - nodePath := path.Join(s.root, filePath) - - pair, _, err := s.kv.Get(nodePath, nil) - if err != nil { - return nil, nil, err - } - if pair == nil { - return nil, nil, topo.NewError(topo.NoNode, nodePath) - } - - return pair.Value, ConsulVersion(pair.ModifyIndex), nil -} - -// GetVersion is part of topo.Conn interface. -func (s *Server) GetVersion(ctx context.Context, filePath string, version int64) ([]byte, error) { - return nil, topo.NewError(topo.NoImplementation, "GetVersion not supported in consul topo") -} - -// List is part of the topo.Conn interface. -func (s *Server) List(ctx context.Context, filePathPrefix string) ([]topo.KVInfo, error) { - nodePathPrefix := path.Join(s.root, filePathPrefix) - - pairs, _, err := s.kv.List(nodePathPrefix, nil) - if err != nil { - return []topo.KVInfo{}, err - } - if len(pairs) == 0 { - return []topo.KVInfo{}, topo.NewError(topo.NoNode, nodePathPrefix) - } - results := make([]topo.KVInfo, len(pairs)) - for n := range pairs { - results[n].Key = []byte(pairs[n].Key) - results[n].Value = pairs[n].Value - results[n].Version = ConsulVersion(pairs[n].ModifyIndex) - } - - return results, nil -} - -// Delete is part of the topo.Conn interface. -func (s *Server) Delete(ctx context.Context, filePath string, version topo.Version) error { - nodePath := path.Join(s.root, filePath) - - // We need to differentiate if the node existed or not. - // So we cannot use a regular Delete, which returns success - // whether or not the node originally existed. - // Let's do a 'Get' and then a 'Delete' in a transaction: - // - If the node doesn't exists, the Get will fail and abort. - // - If the node exists, the Get will work, and the Delete will - // then execute (and may or may not work for other reasons). - ops := api.KVTxnOps{ - &api.KVTxnOp{ - Verb: api.KVGet, - Key: nodePath, - }, - &api.KVTxnOp{ - Verb: api.KVDelete, - Key: nodePath, - }, - } - if version != nil { - // if we have a version, the delete we use specifies it. - ops[1].Verb = api.KVDeleteCAS - ops[1].Index = uint64(version.(ConsulVersion)) - } - ok, resp, _, err := s.kv.Txn(ops, nil) - if err != nil { - // Communication error. - return err - } - if !ok { - // Transaction was rolled back, means the Get failed, - // or the Delete had the wrong version. See which one it was. - switch resp.Errors[0].OpIndex { - case 0: - // Get failed (operation 0), the node didn't exist. - return topo.NewError(topo.NoNode, nodePath) - case 1: - // DeleteCAS failed (operation 1), means bad version. - return topo.NewError(topo.BadVersion, nodePath) - default: - // very unexpected. - return ErrBadResponse - } - } - return nil -} diff --git a/go/vt/topo/consultopo/lock.go b/go/vt/topo/consultopo/lock.go deleted file mode 100644 index a9ca98d6f14..00000000000 --- a/go/vt/topo/consultopo/lock.go +++ /dev/null @@ -1,224 +0,0 @@ -/* -Copyright 2019 The Vitess Authors. - -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 - - http://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. -*/ - -package consultopo - -import ( - "context" - "path" - "time" - - "github.com/hashicorp/consul/api" - - "vitess.io/vitess/go/vt/proto/vtrpc" - "vitess.io/vitess/go/vt/vterrors" - - "vitess.io/vitess/go/vt/log" - "vitess.io/vitess/go/vt/topo" -) - -// consulLockDescriptor implements topo.LockDescriptor. -type consulLockDescriptor struct { - s *Server - lockPath string - lost <-chan struct{} -} - -// Lock is part of the topo.Conn interface. -func (s *Server) Lock(ctx context.Context, dirPath, contents string) (topo.LockDescriptor, error) { - // We list the directory first to make sure it exists. - if _, err := s.ListDir(ctx, dirPath, false /*full*/); err != nil { - // We need to return the right error codes, like - // topo.ErrNoNode and topo.ErrInterrupted, and the - // easiest way to do this is to return convertError(err). - // It may lose some of the context, if this is an issue, - // maybe logging the error would work here. - return nil, convertError(err, dirPath) - } - - return s.lock(ctx, dirPath, contents, s.lockTTL) -} - -// LockWithTTL is part of the topo.Conn interface. -func (s *Server) LockWithTTL(ctx context.Context, dirPath, contents string, ttl time.Duration) (topo.LockDescriptor, error) { - // We list the directory first to make sure it exists. - if _, err := s.ListDir(ctx, dirPath, false /*full*/); err != nil { - // We need to return the right error codes, like - // topo.ErrNoNode and topo.ErrInterrupted, and the - // easiest way to do this is to return convertError(err). - // It may lose some of the context, if this is an issue, - // maybe logging the error would work here. - return nil, convertError(err, dirPath) - } - - return s.lock(ctx, dirPath, contents, ttl.String()) -} - -// LockName is part of the topo.Conn interface. -func (s *Server) LockName(ctx context.Context, dirPath, contents string) (topo.LockDescriptor, error) { - return s.lock(ctx, dirPath, contents, topo.NamedLockTTL.String()) -} - -// TryLock is part of the topo.Conn interface. -func (s *Server) TryLock(ctx context.Context, dirPath, contents string) (topo.LockDescriptor, error) { - // We list all the entries under dirPath - entries, err := s.ListDir(ctx, dirPath, true) - if err != nil { - // We need to return the right error codes, like - // topo.ErrNoNode and topo.ErrInterrupted, and the - // easiest way to do this is to return convertError(err). - // It may lose some of the context, if this is an issue, - // maybe logging the error would work here. - return nil, convertError(err, dirPath) - } - - // If there is a file 'lock' in it then we can assume that someone else already has a lock. - // Throw error in this case - for _, e := range entries { - if e.Name == locksFilename && e.Type == topo.TypeFile && e.Ephemeral { - return nil, topo.NewError(topo.NodeExists, "lock already exists at path "+dirPath) - } - } - - // everything is good let's acquire the lock. - return s.lock(ctx, dirPath, contents, s.lockTTL) -} - -// Lock is part of the topo.Conn interface. -func (s *Server) lock(ctx context.Context, dirPath, contents, ttl string) (topo.LockDescriptor, error) { - lockPath := path.Join(s.root, dirPath, locksFilename) - - lockOpts := &api.LockOptions{ - Key: lockPath, - Value: []byte(contents), - SessionOpts: &api.SessionEntry{ - Name: api.DefaultLockSessionName, - TTL: api.DefaultLockSessionTTL, - }, - } - lockOpts.SessionOpts.Checks = s.lockChecks - if s.lockTTL != "" { - // Override the API default with the global default from - // --topo-consul-lock-session-ttl. - lockOpts.SessionOpts.TTL = s.lockTTL - } - if ttl != "" { - // Override the global default with the one provided by the - // caller. - lockOpts.SessionOpts.TTL = ttl - } - if s.lockDelay > 0 { - lockOpts.SessionOpts.LockDelay = s.lockDelay - } - // Build the lock structure. - l, err := s.client.LockOpts(lockOpts) - if err != nil { - return nil, err - } - - // Wait until we are the only ones in this client trying to - // lock that path. - s.mu.Lock() - li, ok := s.locks[lockPath] - for ok { - // Unlock, wait for something to change. - s.mu.Unlock() - select { - case <-ctx.Done(): - return nil, convertError(ctx.Err(), dirPath) - case <-li.done: - } - - // The original locker is gone, try to get it again - s.mu.Lock() - li, ok = s.locks[lockPath] - } - li = &lockInstance{ - lock: l, - done: make(chan struct{}), - } - s.locks[lockPath] = li - s.mu.Unlock() - - // We are the only ones trying to lock now. - lost, err := l.Lock(ctx.Done()) - if err != nil || lost == nil { - // Failed to lock, give up our slot in locks map. - // Close the channel to unblock anyone else. - s.mu.Lock() - delete(s.locks, lockPath) - s.mu.Unlock() - close(li.done) - // Consul will return empty leaderCh with nil error if we cannot get lock before the timeout - // therefore we return a timeout error here - if lost == nil { - return nil, topo.NewError(topo.Timeout, lockPath) - } - return nil, err - } - - // We got the lock, we're good. - return &consulLockDescriptor{ - s: s, - lockPath: lockPath, - lost: lost, - }, nil -} - -// Check is part of the topo.LockDescriptor interface. -func (ld *consulLockDescriptor) Check(ctx context.Context) error { - select { - case <-ld.lost: - return vterrors.Errorf(vtrpc.Code_INTERNAL, "lost channel closed") - default: - } - return nil -} - -// Unlock is part of the topo.LockDescriptor interface. -func (ld *consulLockDescriptor) Unlock(ctx context.Context) error { - return ld.s.unlock(ctx, ld.lockPath) -} - -// unlock releases a lock acquired by Lock() on the given directory. -func (s *Server) unlock(ctx context.Context, lockPath string) error { - s.mu.Lock() - li, ok := s.locks[lockPath] - s.mu.Unlock() - if !ok { - return vterrors.Errorf(vtrpc.Code_INVALID_ARGUMENT, "unlock: lock %v not held", lockPath) - } - - // Try to unlock our lock. We will clean up our entry anyway. - unlockErr := li.lock.Unlock() - - s.mu.Lock() - delete(s.locks, lockPath) - s.mu.Unlock() - close(li.done) - - // Then try to remove the lock entirely. This will only work if - // no one else has the lock. - if err := li.lock.Destroy(); err != nil { - // If someone else has the lock, we can't remove it, - // but we don't need to. - if err != api.ErrLockInUse { - log.Warningf("failed to clean up lock file %v: %v", lockPath, err) - } - } - - return unlockErr -} diff --git a/go/vt/topo/consultopo/server.go b/go/vt/topo/consultopo/server.go deleted file mode 100644 index 70448349927..00000000000 --- a/go/vt/topo/consultopo/server.go +++ /dev/null @@ -1,186 +0,0 @@ -/* -Copyright 2019 The Vitess Authors. - -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 - - http://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. -*/ - -/* -Package consultopo implements topo.Server with consul as the backend. -*/ -package consultopo - -import ( - "encoding/json" - "os" - "strings" - "sync" - "time" - - "github.com/hashicorp/consul/api" - "github.com/spf13/pflag" - - "vitess.io/vitess/go/vt/log" - "vitess.io/vitess/go/vt/proto/vtrpc" - "vitess.io/vitess/go/vt/servenv" - "vitess.io/vitess/go/vt/topo" - "vitess.io/vitess/go/vt/utils" - "vitess.io/vitess/go/vt/vterrors" -) - -var ( - consulAuthClientStaticFile string - // serfHealth is the default check from consul - consulLockSessionChecks = "serfHealth" - consulLockSessionTTL string - consulLockDelay = 15 * time.Second -) - -func init() { - servenv.RegisterFlagsForTopoBinaries(registerServerFlags) -} - -func registerServerFlags(fs *pflag.FlagSet) { - utils.SetFlagStringVar(fs, &consulAuthClientStaticFile, "consul-auth-static-file", consulAuthClientStaticFile, "JSON File to read the topos/tokens from.") - utils.SetFlagStringVar(fs, &consulLockSessionChecks, "topo-consul-lock-session-checks", consulLockSessionChecks, "List of checks for consul session.") - utils.SetFlagStringVar(fs, &consulLockSessionTTL, "topo-consul-lock-session-ttl", consulLockSessionTTL, "TTL for consul session.") - utils.SetFlagDurationVar(fs, &consulLockDelay, "topo-consul-lock-delay", consulLockDelay, "LockDelay for consul session.") -} - -// ClientAuthCred credential to use for consul clusters -type ClientAuthCred struct { - // ACLToken when provided, the client will use this token when making requests to the Consul server. - ACLToken string `json:"acl_token,omitempty"` -} - -// Factory is the consul topo.Factory implementation. -type Factory struct{} - -// HasGlobalReadOnlyCell is part of the topo.Factory interface. -func (f Factory) HasGlobalReadOnlyCell(serverAddr, root string) bool { - return false -} - -// Create is part of the topo.Factory interface. -func (f Factory) Create(cell, serverAddr, root string) (topo.Conn, error) { - return NewServer(cell, serverAddr, root) -} - -func getClientCreds() (creds map[string]*ClientAuthCred, err error) { - creds = make(map[string]*ClientAuthCred) - - if consulAuthClientStaticFile == "" { - // Not configured, nothing to do. - log.Infof("Consul client auth is not set up. consul-auth-static-file was not provided") - return nil, nil - } - - data, err := os.ReadFile(consulAuthClientStaticFile) - if err != nil { - err = vterrors.Wrapf(err, "Failed to read consul-auth-static-file file") - return creds, err - } - - if err := json.Unmarshal(data, &creds); err != nil { - err = vterrors.Wrapf(err, "Error parsing consul-auth-static-file") - return creds, err - } - if len(creds) == 0 { - err = vterrors.New(vtrpc.Code_FAILED_PRECONDITION, "Found no credentials in consul_auth_static_file") - return creds, err - } - return creds, nil -} - -// Server is the implementation of topo.Server for consul. -type Server struct { - // client is the consul api client. - client *api.Client - kv *api.KV - - // root is the root path for this client. - root string - - // mu protects the following fields. - mu sync.Mutex - // locks is a map of *lockInstance structures. - // The key is the filepath of the Lock file. - locks map[string]*lockInstance - - lockChecks []string - lockTTL string // This is the default used for all non-named locks - lockDelay time.Duration -} - -// lockInstance keeps track of one lock held by this client. -type lockInstance struct { - // lock has the api.Lock structure. - lock *api.Lock - - // done is closed when the lock is release by this process. - done chan struct{} -} - -// NewServer returns a new consultopo.Server. -func NewServer(cell, serverAddr, root string) (*Server, error) { - creds, err := getClientCreds() - if err != nil { - return nil, err - } - cfg := api.DefaultConfig() - cfg.Address = serverAddr - if creds != nil { - if creds[cell] != nil { - cfg.Token = creds[cell].ACLToken - } else { - log.Warningf("Client auth not configured for cell: %v", cell) - } - } - - client, err := api.NewClient(cfg) - if err != nil { - return nil, err - } - - return &Server{ - client: client, - kv: client.KV(), - root: root, - locks: make(map[string]*lockInstance), - lockChecks: parseConsulLockSessionChecks(consulLockSessionChecks), - lockTTL: consulLockSessionTTL, - lockDelay: consulLockDelay, - }, nil -} - -func parseConsulLockSessionChecks(s string) []string { - var res []string - if len(s) == 0 { - return res - } - return strings.Split(consulLockSessionChecks, ",") -} - -// Close implements topo.Server.Close. -// It will nil out the global and cells fields, so any attempt to -// re-use this server will panic. -func (s *Server) Close() { - s.client = nil - s.kv = nil - s.mu.Lock() - defer s.mu.Unlock() - s.locks = nil -} - -func init() { - topo.RegisterFactory("consul", Factory{}) -} diff --git a/go/vt/topo/consultopo/server_flaky_test.go b/go/vt/topo/consultopo/server_flaky_test.go deleted file mode 100644 index a4d54a19be9..00000000000 --- a/go/vt/topo/consultopo/server_flaky_test.go +++ /dev/null @@ -1,481 +0,0 @@ -/* -Copyright 2019 The Vitess Authors. - -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 - - http://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. -*/ - -package consultopo - -import ( - "context" - "encoding/json" - "fmt" - "os" - "os/exec" - "path" - "sync/atomic" - "testing" - "time" - - "github.com/hashicorp/consul/api" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "vitess.io/vitess/go/stats" - "vitess.io/vitess/go/testfiles" - "vitess.io/vitess/go/vt/log" - topodatapb "vitess.io/vitess/go/vt/proto/topodata" - vschemapb "vitess.io/vitess/go/vt/proto/vschema" - "vitess.io/vitess/go/vt/srvtopo" - "vitess.io/vitess/go/vt/topo" - "vitess.io/vitess/go/vt/topo/test" -) - -// startConsul starts a consul subprocess, and waits for it to be ready. -// Returns the exec.Cmd forked, the config file to remove after the test, -// and the server address to RPC-connect to. -func startConsul(t *testing.T, authToken string) (*exec.Cmd, string, string) { - // Create a temporary config file, as ports cannot all be set - // via command line. The file name has to end with '.json' so - // we're not using TempFile. - configDir := t.TempDir() - - configFilename := path.Join(configDir, "consul.json") - configFile, err := os.OpenFile(configFilename, os.O_RDWR|os.O_CREATE, 0o600) - if err != nil { - t.Fatalf("cannot create tempfile: %v", err) - } - - // Create the JSON config, save it. - port := testfiles.GoVtTopoConsultopoPort - config := map[string]any{ - "ports": map[string]int{ - "dns": port, - "http": port + 1, - "serf_lan": port + 2, - "serf_wan": port + 3, - }, - } - - // TODO(deepthi): this is the legacy ACL format. We run v1.4.0 by default in which this has been deprecated. - // We should start using the new format - // https://learn.hashicorp.com/tutorials/consul/access-control-replication-multiple-datacenters?in=consul/security-operations - if authToken != "" { - config["datacenter"] = "vitess" - config["acl_datacenter"] = "vitess" - config["acl_master_token"] = authToken - config["acl_default_policy"] = "deny" - config["acl_down_policy"] = "extend-cache" - } - - data, err := json.Marshal(config) - if err != nil { - t.Fatalf("cannot json-encode config: %v", err) - } - if _, err := configFile.Write(data); err != nil { - t.Fatalf("cannot write config: %v", err) - } - if err := configFile.Close(); err != nil { - t.Fatalf("cannot close config: %v", err) - } - - cmd := exec.Command("consul", - "agent", - "-dev", - "-config-file", configFilename) - err = cmd.Start() - if err != nil { - t.Fatalf("failed to start consul: %v", err) - } - - // Create a client to connect to the created consul. - serverAddr := fmt.Sprintf("localhost:%v", port+1) - cfg := api.DefaultConfig() - cfg.Address = serverAddr - if authToken != "" { - cfg.Token = authToken - } - c, err := api.NewClient(cfg) - if err != nil { - t.Fatalf("api.NewClient(%v) failed: %v", serverAddr, err) - } - - // Wait until we can list "/", or timeout. - start := time.Now() - kv := c.KV() - for { - _, _, err := kv.List("/", nil) - if err == nil { - break - } - if time.Since(start) > 10*time.Second { - t.Fatalf("Failed to start consul daemon in time. Consul is returning error: %v", err) - } - time.Sleep(10 * time.Millisecond) - } - - return cmd, configFilename, serverAddr -} - -func TestConsulTopo(t *testing.T) { - originalWatchPollDuration := watchPollDuration - defer func() { - watchPollDuration = originalWatchPollDuration - }() - - // One test is going to wait that full period, so make it shorter. - watchPollDuration = 100 * time.Millisecond - - // Start a single consul in the background. - cmd, configFilename, serverAddr := startConsul(t, "") - defer func() { - // Alerts command did not run successful - if err := cmd.Process.Kill(); err != nil { - log.Errorf("cmd process kill has an error: %v", err) - } - // Alerts command did not run successful - if err := cmd.Wait(); err != nil { - log.Errorf("cmd wait has an error: %v", err) - } - - os.Remove(configFilename) - }() - - // Run the TopoServerTestSuite tests. - testIndex := 0 - ctx := t.Context() - - test.TopoServerTestSuite(t, ctx, func() *topo.Server { - // Each test will use its own sub-directories. - testRoot := fmt.Sprintf("test-%v", testIndex) - testIndex++ - - // Create the server on the new root. - ts, err := topo.OpenServer("consul", serverAddr, path.Join(testRoot, topo.GlobalCell)) - if err != nil { - t.Fatalf("OpenServer() failed: %v", err) - } - - // Create the CellInfo. - if err := ts.CreateCellInfo(context.Background(), test.LocalCellName, &topodatapb.CellInfo{ - ServerAddress: serverAddr, - Root: path.Join(testRoot, test.LocalCellName), - }); err != nil { - t.Fatalf("CreateCellInfo() failed: %v", err) - } - - return ts - }, []string{}) -} - -func TestConsulTopoWithChecks(t *testing.T) { - // One test is going to wait that full period, so make it shorter. - originalWatchPollDuration := watchPollDuration - originalConsulLockSessionChecks := consulLockSessionChecks - originalConsulLockSessionTTL := consulLockSessionTTL - - defer func() { - watchPollDuration = originalWatchPollDuration - consulLockSessionTTL = originalConsulLockSessionTTL - consulLockSessionChecks = originalConsulLockSessionChecks - }() - - watchPollDuration = 100 * time.Millisecond - consulLockSessionChecks = "serfHealth" - consulLockSessionTTL = "15s" - - // Start a single consul in the background. - cmd, configFilename, serverAddr := startConsul(t, "") - defer func() { - // Alerts command did not run successful - if err := cmd.Process.Kill(); err != nil { - log.Errorf("cmd process kill has an error: %v", err) - } - // Alerts command did not run successful - if err := cmd.Wait(); err != nil { - log.Errorf("cmd wait has an error: %v", err) - } - - os.Remove(configFilename) - }() - - // Run the TopoServerTestSuite tests. - testIndex := 0 - ctx := t.Context() - test.TopoServerTestSuite(t, ctx, func() *topo.Server { - // Each test will use its own sub-directories. - testRoot := fmt.Sprintf("test-%v", testIndex) - testIndex++ - - // Create the server on the new root. - ts, err := topo.OpenServer("consul", serverAddr, path.Join(testRoot, topo.GlobalCell)) - if err != nil { - t.Fatalf("OpenServer() failed: %v", err) - } - - // Create the CellInfo. - if err := ts.CreateCellInfo(context.Background(), test.LocalCellName, &topodatapb.CellInfo{ - ServerAddress: serverAddr, - Root: path.Join(testRoot, test.LocalCellName), - }); err != nil { - t.Fatalf("CreateCellInfo() failed: %v", err) - } - - return ts - }, []string{}) -} - -func TestConsulTopoWithAuth(t *testing.T) { - // One test is going to wait that full period, so make it shorter. - watchPollDuration = 100 * time.Millisecond - - // Start a single consul in the background. - cmd, configFilename, serverAddr := startConsul(t, "123456") - defer func() { - // Alerts command did not run successful - if err := cmd.Process.Kill(); err != nil { - log.Errorf("cmd process kill has an error: %v", err) - } - // Alerts command did not run successful - if err := cmd.Wait(); err != nil { - log.Errorf("cmd process wait has an error: %v", err) - } - os.Remove(configFilename) - }() - - // Run the TopoServerTestSuite tests. - testIndex := 0 - tmpFile, err := os.CreateTemp("", "consul_auth_client_static_file.json") - if err != nil { - t.Fatalf("couldn't create temp file: %v", err) - } - defer os.Remove(tmpFile.Name()) - - originalConsulAuthClientStaticFile := consulAuthClientStaticFile - defer func() { - consulAuthClientStaticFile = originalConsulAuthClientStaticFile - }() - - consulAuthClientStaticFile = tmpFile.Name() - - jsonConfig := "{\"global\":{\"acl_token\":\"123456\"}, \"test\":{\"acl_token\":\"123456\"}}" - if err := os.WriteFile(tmpFile.Name(), []byte(jsonConfig), 0o600); err != nil { - t.Fatalf("couldn't write temp file: %v", err) - } - - ctx := t.Context() - test.TopoServerTestSuite(t, ctx, func() *topo.Server { - // Each test will use its own sub-directories. - testRoot := fmt.Sprintf("test-%v", testIndex) - testIndex++ - - // Create the server on the new root. - ts, err := topo.OpenServer("consul", serverAddr, path.Join(testRoot, topo.GlobalCell)) - if err != nil { - t.Fatalf("OpenServer() failed: %v", err) - } - - // Create the CellInfo. - if err := ts.CreateCellInfo(context.Background(), test.LocalCellName, &topodatapb.CellInfo{ - ServerAddress: serverAddr, - Root: path.Join(testRoot, test.LocalCellName), - }); err != nil { - t.Fatalf("CreateCellInfo() failed: %v", err) - } - - return ts - }, []string{}) -} - -func TestConsulTopoWithAuthFailure(t *testing.T) { - // One test is going to wait that full period, so make it shorter. - watchPollDuration = 100 * time.Millisecond - - // Start a single consul in the background. - cmd, configFilename, serverAddr := startConsul(t, "123456") - defer func() { - cmd.Process.Kill() - cmd.Wait() - os.Remove(configFilename) - }() - - tmpFile, err := os.CreateTemp("", "consul_auth_client_static_file.json") - if err != nil { - t.Fatalf("couldn't create temp file: %v", err) - } - defer os.Remove(tmpFile.Name()) - - originalConsulAuthClientStaticFile := consulAuthClientStaticFile - defer func() { - consulAuthClientStaticFile = originalConsulAuthClientStaticFile - }() - - consulAuthClientStaticFile = tmpFile.Name() - - // check valid, empty json causes error - { - jsonConfig := "{}" - if err := os.WriteFile(tmpFile.Name(), []byte(jsonConfig), 0o600); err != nil { - t.Fatalf("couldn't write temp file: %v", err) - } - - // Create the server on the new root. - _, err := topo.OpenServer("consul", serverAddr, path.Join("globalRoot", topo.GlobalCell)) - if err == nil { - t.Fatal("Expected OpenServer() to return an error due to bad config, got nil") - } - } - - // check bad token causes error - { - jsonConfig := "{\"global\":{\"acl_token\":\"badtoken\"}}" - if err := os.WriteFile(tmpFile.Name(), []byte(jsonConfig), 0o600); err != nil { - t.Fatalf("couldn't write temp file: %v", err) - } - - // Create the server on the new root. - ts, err := topo.OpenServer("consul", serverAddr, path.Join("globalRoot", topo.GlobalCell)) - if err != nil { - t.Fatalf("OpenServer() failed: %v", err) - } - - // Attempt to Create the CellInfo. - err = ts.CreateCellInfo(context.Background(), test.LocalCellName, &topodatapb.CellInfo{ - ServerAddress: serverAddr, - Root: path.Join("globalRoot", test.LocalCellName), - }) - - want := "Failed request: ACL not found" - if err == nil || err.Error() != want { - t.Errorf("Expected CreateCellInfo to fail: got %v, want %s", err, want) - } - } -} - -// TestConsulWatcherStormPrevention tests that resilient watchers don't storm subscribers during Consul outages. -// This test validates the fix for the specific Consul storm scenario reported by the team. -func TestConsulWatcherStormPrevention(t *testing.T) { - // Save original values and restore them after the test - originalWatchPollDuration := watchPollDuration - originalConsulAuthClientStaticFile := consulAuthClientStaticFile - defer func() { - watchPollDuration = originalWatchPollDuration - consulAuthClientStaticFile = originalConsulAuthClientStaticFile - }() - - // Configure test settings - using direct assignment since flag parsing in tests is complex - watchPollDuration = 100 * time.Millisecond // Faster polling for test - consulAuthClientStaticFile = "" // Clear auth file to avoid conflicts - - // Start Consul server - cmd, configFilename, serverAddr := startConsul(t, "") - defer func() { - if err := cmd.Process.Kill(); err != nil { - log.Errorf("cmd process kill has an error: %v", err) - } - if err := cmd.Wait(); err != nil { - log.Errorf("cmd wait has an error: %v", err) - } - os.Remove(configFilename) - }() - - ctx := t.Context() - - testRoot := "storm-test" - - // Create the topo server - ts, err := topo.OpenServer("consul", serverAddr, path.Join(testRoot, topo.GlobalCell)) - require.NoError(t, err, "OpenServer() failed") - - // Create the CellInfo - cellName := "test_cell" - err = ts.CreateCellInfo(ctx, cellName, &topodatapb.CellInfo{ - ServerAddress: serverAddr, - Root: path.Join(testRoot, cellName), - }) - require.NoError(t, err, "CreateCellInfo() failed") - - // Create resilient server - counts := stats.NewCountersWithSingleLabel("", "Consul storm test", "type") - rs := srvtopo.NewResilientServer(ctx, ts, counts) - - // Set initial VSchema - initialVSchema := &vschemapb.SrvVSchema{ - Keyspaces: map[string]*vschemapb.Keyspace{ - "test_keyspace": {Sharded: false}, - }, - } - err = ts.UpdateSrvVSchema(ctx, cellName, initialVSchema) - require.NoError(t, err, "UpdateSrvVSchema() failed") - - // Set up watcher with call counter - var watcherCallCount atomic.Int32 - var lastWatcherError error - - rs.WatchSrvVSchema(ctx, cellName, func(v *vschemapb.SrvVSchema, e error) bool { - count := watcherCallCount.Add(1) - lastWatcherError = e - if e != nil { - t.Logf("Watcher callback #%d - error: %v", count, e) - } else { - t.Logf("Watcher callback #%d - success", count) - } - return true - }) - - // Wait for initial callback - assert.Eventually(t, func() bool { - return watcherCallCount.Load() >= 1 - }, 10*time.Second, 10*time.Millisecond) - - initialWatcherCalls := watcherCallCount.Load() - require.GreaterOrEqual(t, initialWatcherCalls, int32(1), "Expected at least 1 initial watcher call") - require.NoError(t, lastWatcherError, "Initial watcher call should not have error") - - // Verify Get operations work normally - vschema, err := rs.GetSrvVSchema(ctx, cellName) - require.NoError(t, err, "GetSrvVSchema() failed") - require.NotNil(t, vschema, "GetSrvVSchema() returned nil") - - t.Logf("Setup complete. Initial watcher calls: %d", initialWatcherCalls) - - // Simulate Consul outage by killing the Consul process - // This will cause watch errors which previously triggered storms - err = cmd.Process.Kill() - require.NoError(t, err, "Failed to kill consul process") - - // Get should still work from cache during outage - vschema, err = rs.GetSrvVSchema(ctx, cellName) - assert.NoError(t, err, "GetSrvVSchema() should work from cache during outage") - assert.NotNil(t, vschema, "GetSrvVSchema() should return cached value during outage") - - // Wait during outage period - this is when storms would occur without our fix - outageDuration := 2 * time.Second - t.Logf("Waiting %v during Consul outage to check for watcher storms...", outageDuration) - time.Sleep(outageDuration) - - // Check watcher calls during outage - key assertion for storm prevention - watcherCallsDuringOutage := watcherCallCount.Load() - initialWatcherCalls - t.Logf("Watcher calls during outage: %d", watcherCallsDuringOutage) - - // With our fix, watchers should remain silent during outage when cached data is available - // This is the core validation: no storm of subscriber calls during Consul outages - assert.Equal(t, int32(0), watcherCallsDuringOutage, "Watchers should remain completely silent during Consul outage") - - // Get operations should continue working from cache - vschema, err = rs.GetSrvVSchema(ctx, cellName) - assert.NoError(t, err, "GetSrvVSchema() should continue working from cache") - assert.NotNil(t, vschema, "GetSrvVSchema() should continue returning cached value") - - t.Log("Consul storm prevention test completed - watchers remained quiet during outage") -} diff --git a/go/vt/topo/consultopo/version.go b/go/vt/topo/consultopo/version.go deleted file mode 100644 index 5ff24ccb42a..00000000000 --- a/go/vt/topo/consultopo/version.go +++ /dev/null @@ -1,29 +0,0 @@ -/* -Copyright 2019 The Vitess Authors. - -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 - - http://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. -*/ - -package consultopo - -import "strconv" - -// ConsulVersion is consul's idea of a version. -// It implements topo.Version. -// We use the native consul version type, uint64. -type ConsulVersion uint64 - -// String is part of the topo.Version interface. -func (v ConsulVersion) String() string { - return strconv.FormatUint(uint64(v), 10) -} diff --git a/go/vt/topo/consultopo/watch.go b/go/vt/topo/consultopo/watch.go deleted file mode 100644 index b63276ab52f..00000000000 --- a/go/vt/topo/consultopo/watch.go +++ /dev/null @@ -1,147 +0,0 @@ -/* -Copyright 2019 The Vitess Authors. - -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 - - http://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. -*/ - -package consultopo - -import ( - "context" - "path" - "time" - - "github.com/hashicorp/consul/api" - "github.com/spf13/pflag" - - "vitess.io/vitess/go/vt/servenv" - "vitess.io/vitess/go/vt/topo" - "vitess.io/vitess/go/vt/utils" -) - -var watchPollDuration = 30 * time.Second - -func init() { - servenv.RegisterFlagsForTopoBinaries(registerWatchFlags) -} - -func registerWatchFlags(fs *pflag.FlagSet) { - utils.SetFlagDurationVar(fs, &watchPollDuration, "topo-consul-watch-poll-duration", watchPollDuration, "time of the long poll for watch queries.") -} - -// Watch is part of the topo.Conn interface. -func (s *Server) Watch(ctx context.Context, filePath string) (*topo.WatchData, <-chan *topo.WatchData, error) { - // Initial get. - nodePath := path.Join(s.root, filePath) - options := &api.QueryOptions{} - - initialCtx, initialCancel := context.WithTimeout(ctx, topo.RemoteOperationTimeout) - defer initialCancel() - - pair, _, err := s.kv.Get(nodePath, options.WithContext(initialCtx)) - if err != nil { - return nil, nil, err - } - if pair == nil { - // Node doesn't exist. - return nil, nil, topo.NewError(topo.NoNode, nodePath) - } - - // Initial value to return. - wd := &topo.WatchData{ - Contents: pair.Value, - Version: ConsulVersion(pair.ModifyIndex), - } - - // Create the notifications channel, send updates to it. - notifications := make(chan *topo.WatchData, 10) - go func() { - defer close(notifications) - - var getCtx context.Context - // Initialize to no-op function to avoid having to check for nil. - cancelGetCtx := func() {} - - defer cancelGetCtx() - - for { - // Wait/poll until we get a new version. - // Get with a WaitIndex and WaitTime will return - // the current version at the end of WaitTime - // if it didn't change. So we just check for that - // and swallow the notifications when version matches. - waitIndex := pair.ModifyIndex - opts := &api.QueryOptions{ - WaitIndex: waitIndex, - WaitTime: watchPollDuration, - } - - // Make a new Context for just this one Get() call. - // The server should send us something after WaitTime at the latest. - // If it takes more than 2x that long, assume we've lost contact. - // This essentially uses WaitTime as a heartbeat interval to detect - // a dead connection. - cancelGetCtx() - getCtx, cancelGetCtx = context.WithTimeout(ctx, 2*opts.WaitTime) - - pair, _, err = s.kv.Get(nodePath, opts.WithContext(getCtx)) - if err != nil { - // Serious error or context timeout/cancelled. - notifications <- &topo.WatchData{ - Err: convertError(err, nodePath), - } - cancelGetCtx() - return - } - - // If the node disappeared, pair is nil. - if pair == nil { - notifications <- &topo.WatchData{ - Err: topo.NewError(topo.NoNode, nodePath), - } - cancelGetCtx() - return - } - - // If we got a new value, send it. - if pair.ModifyIndex != waitIndex { - notifications <- &topo.WatchData{ - Contents: pair.Value, - Version: ConsulVersion(pair.ModifyIndex), - } - } - - // See if the watch was canceled. - select { - case <-ctx.Done(): - notifications <- &topo.WatchData{ - Err: convertError(ctx.Err(), nodePath), - } - cancelGetCtx() - return - default: - } - } - }() - - return wd, notifications, nil -} - -// WatchRecursive is part of the topo.Conn interface. -func (s *Server) WatchRecursive(_ context.Context, path string) ([]*topo.WatchDataRecursive, <-chan *topo.WatchDataRecursive, error) { - // This isn't implemented yet, but likely can be implemented using List - // with blocking logic like how we use Get with blocking for regular Watch. - // See also how https://www.consul.io/docs/dynamic-app-config/watches#keyprefix - // works under the hood. - return nil, nil, topo.NewError(topo.NoImplementation, path) -} diff --git a/go/vt/topo/etcd2topo/server.go b/go/vt/topo/etcd2topo/server.go index 1d82331c17d..d85abb540db 100644 --- a/go/vt/topo/etcd2topo/server.go +++ b/go/vt/topo/etcd2topo/server.go @@ -57,7 +57,7 @@ var ( serverCaPath string ) -// Factory is the consul topo.Factory implementation. +// Factory is the etcd topo.Factory implementation. type Factory struct{} // HasGlobalReadOnlyCell is part of the topo.Factory interface. diff --git a/go/vt/topo/locks.go b/go/vt/topo/locks.go index b2a3957d116..593ef4a11c2 100644 --- a/go/vt/topo/locks.go +++ b/go/vt/topo/locks.go @@ -325,8 +325,7 @@ func newFuncLockOption(f func(*lockOptions)) *funcLockOption { // WithTTL allows you to specify how long the underlying topo server // implementation should hold the lock before releasing it — even if the caller // has not explicitly released it. This provides a way to override the global -// ttl values that are set via --topo-consul-lock-session-ttl and -// --topo-etcd-lease-ttl. +// ttl values that are set via --topo-etcd-lease-ttl. // Note: This option is ignored by the ZooKeeper implementation as it does not // support TTLs. func WithTTL(ttl time.Duration) LockOption { diff --git a/go/vt/topo/server.go b/go/vt/topo/server.go index 21814255206..b041cbe8b73 100644 --- a/go/vt/topo/server.go +++ b/go/vt/topo/server.go @@ -21,8 +21,8 @@ possibly another one to a read-only version of the global topo service), and one to each cell topo service. It contains the plug-in interfaces Conn, Factory and Version that topo -implementations will use. We support Zookeeper, etcd, consul as real -topo servers, and in-memory, tee as test and utility topo servers. +implementations will use. We support Zookeeper and etcd as real topo +servers, and in-memory, tee as test and utility topo servers. Implementations are in sub-directories here. In tests, we do not mock this package. Instead, we just use a memorytopo. @@ -122,7 +122,7 @@ type Factory interface { // Server is the main topo.Server object. We support two ways of creating one: // 1. From an implementation, server address, and root path. // This uses a plugin mechanism, and we have implementations for -// etcd, zookeeper and consul. +// etcd and zookeeper. // 2. Specific implementations may have higher level creation methods // (in which case they may provide a more complex Factory). // We support memorytopo (for tests and processes that only need an diff --git a/go/vt/vtadmin/cluster/config_test.go b/go/vt/vtadmin/cluster/config_test.go index 252fa217bdc..5774ffc3755 100644 --- a/go/vt/vtadmin/cluster/config_test.go +++ b/go/vt/vtadmin/cluster/config_test.go @@ -38,12 +38,12 @@ func TestMergeConfig(t *testing.T) { Name: "cluster1", }, override: Config{ - DiscoveryImpl: "consul", + DiscoveryImpl: "staticfile", }, expected: Config{ ID: "c1", Name: "cluster1", - DiscoveryImpl: "consul", + DiscoveryImpl: "staticfile", DiscoveryFlagsByImpl: FlagsByImpl{}, VtSQLFlags: map[string]string{}, VtctldFlags: map[string]string{}, @@ -55,7 +55,7 @@ func TestMergeConfig(t *testing.T) { ID: "c1", Name: "cluster1", DiscoveryFlagsByImpl: map[string]map[string]string{ - "consul": { + "staticfile": { "key1": "val1", }, "zk": { @@ -75,7 +75,7 @@ func TestMergeConfig(t *testing.T) { ID: "c1", Name: "cluster1", DiscoveryFlagsByImpl: map[string]map[string]string{ - "consul": { + "staticfile": { "key1": "val1", }, "zk": { diff --git a/go/vt/vtadmin/cluster/discovery/discovery.go b/go/vt/vtadmin/cluster/discovery/discovery.go index 4e939978131..f2966b3908a 100644 --- a/go/vt/vtadmin/cluster/discovery/discovery.go +++ b/go/vt/vtadmin/cluster/discovery/discovery.go @@ -40,7 +40,7 @@ var ( ) // Discovery defines the interface that service discovery plugins must -// implement. See ConsulDiscovery for an example implementation. +// implement. See StaticFileDiscovery for an example implementation. type Discovery interface { // DiscoverVTGate returns a vtgate found in the discovery service. // Tags can optionally be used to filter the set of potential gates further. @@ -125,7 +125,6 @@ func New(impl string, cluster *vtadminpb.Cluster, args []string) (Discovery, err } func init() { - Register("consul", NewConsul) Register("staticfile", NewStaticFile) Register("dynamic", NewDynamic) } diff --git a/go/vt/vtadmin/cluster/discovery/discovery_consul.go b/go/vt/vtadmin/cluster/discovery/discovery_consul.go deleted file mode 100644 index aba6d677657..00000000000 --- a/go/vt/vtadmin/cluster/discovery/discovery_consul.go +++ /dev/null @@ -1,480 +0,0 @@ -/* -Copyright 2020 The Vitess Authors. - -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 - - http://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. -*/ - -package discovery - -import ( - "context" - "fmt" - "math/rand/v2" - "strings" - "text/template" - "time" - - consul "github.com/hashicorp/consul/api" - "github.com/spf13/pflag" - - "vitess.io/vitess/go/textutil" - "vitess.io/vitess/go/trace" - - vtadminpb "vitess.io/vitess/go/vt/proto/vtadmin" -) - -// ConsulDiscovery implements the Discovery interface for consul. -type ConsulDiscovery struct { - cluster *vtadminpb.Cluster - client ConsulClient - queryOptions *consul.QueryOptions - - /* misc options */ - passingOnly bool - - /* vtgate options */ - vtgateDatacenter string - vtgateService string - vtgatePoolTag string - vtgateCellTag string - vtgateKeyspacesToWatchTag string - vtgateAddrTmpl *template.Template - vtgateFQDNTmpl *template.Template - - /* vtctld options */ - vtctldDatacenter string - vtctldService string - vtctldAddrTmpl *template.Template - vtctldFQDNTmpl *template.Template -} - -// NewConsul returns a ConsulDiscovery for the given cluster. Args are a slice -// of command-line flags (e.g. "-key=value") that are parsed by a consul- -// specific flag set. -func NewConsul(cluster *vtadminpb.Cluster, flags *pflag.FlagSet, args []string) (Discovery, error) { - c, err := consul.NewClient(consul.DefaultConfig()) - if err != nil { - return nil, err - } - - qopts := &consul.QueryOptions{ - AllowStale: false, - RequireConsistent: true, - WaitIndex: uint64(0), - UseCache: true, - } - - disco := &ConsulDiscovery{ - cluster: cluster, - client: &consulClient{c}, - queryOptions: qopts, - } - - flags.DurationVar(&disco.queryOptions.MaxAge, "max-age", time.Second*30, - "how old a cached value can be before consul queries stop using it") - flags.StringVar(&disco.queryOptions.Token, "token", "", "consul ACL token to use for requests") - flags.BoolVar(&disco.passingOnly, "passing-only", true, "whether to include only nodes passing healthchecks") - - /* vtgate discovery config options */ - flags.StringVar(&disco.vtgateService, "vtgate-service-name", "vtgate", "consul service name vtgates register as") - flags.StringVar(&disco.vtgatePoolTag, "vtgate-pool-tag", "pool", "consul service tag to group vtgates by pool") - flags.StringVar(&disco.vtgateCellTag, "vtgate-cell-tag", "cell", "consul service tag to group vtgates by cell") - flags.StringVar(&disco.vtgateKeyspacesToWatchTag, "vtgate-keyspaces-to-watch-tag", "keyspaces", - "consul service tag identifying -keyspaces-to-watch for vtgates") - - vtgateAddrTmplStr := flags.String("vtgate-addr-tmpl", "{{ .Hostname }}", - "Go template string to produce a dialable address from a *vtadminpb.VTGate "+ - "NOTE: the .FQDN field will never be set in the addr template context.") - vtgateDatacenterTmplStr := flags.String("vtgate-datacenter-tmpl", "", - "Go template string to generate the datacenter for vtgate consul queries. "+ - "The meta information about the cluster is provided to the template via {{ .Cluster }}. "+ - "Used once during initialization.") - vtgateFQDNTmplStr := flags.String("vtgate-fqdn-tmpl", "", - "Optional Go template string to produce an FQDN to access the vtgate from a browser. "+ - "E.g. \"{{ .Hostname }}.example.com\".") - - /* vtctld discovery config options */ - flags.StringVar(&disco.vtctldService, "vtctld-service-name", "vtctld", "consul service name vtctlds register as") - - vtctldAddrTmplStr := flags.String("vtctld-addr-tmpl", "{{ .Hostname }}", - "Go template string to produce a dialable address from a *vtadminpb.Vtctld "+ - "NOTE: the .FQDN field will never be set in the addr template context.") - vtctldDatacenterTmplStr := flags.String("vtctld-datacenter-tmpl", "", - "Go template string to generate the datacenter for vtgate consul queries. "+ - "The cluster name is provided to the template via {{ .Cluster }}. "+ - "Used once during initialization.") - vtctldFQDNTmplStr := flags.String("vtctld-fqdn-tmpl", "", - "Optional Go template string to produce an FQDN to access the vtctld from a browser. "+ - "E.g. \"{{ .Hostname }}.example.com\".") - - if err := flags.Parse(args); err != nil { - return nil, err - } - - /* gates options */ - if *vtgateDatacenterTmplStr != "" { - disco.vtgateDatacenter, err = generateConsulDatacenter("vtgate", cluster, *vtgateDatacenterTmplStr) - if err != nil { - return nil, fmt.Errorf("failed to generate vtgate consul datacenter from template: %w", err) - } - } - - if *vtgateFQDNTmplStr != "" { - disco.vtgateFQDNTmpl, err = template.New("consul-vtgate-fqdn-template-" + cluster.Id).Parse(*vtgateFQDNTmplStr) - if err != nil { - return nil, fmt.Errorf("failed to parse vtgate FQDN template %s: %w", *vtgateFQDNTmplStr, err) - } - } - - disco.vtgateAddrTmpl, err = template.New("consul-vtgate-address-template-" + cluster.Id).Parse(*vtgateAddrTmplStr) - if err != nil { - return nil, fmt.Errorf("failed to parse vtgate host address template %s: %w", *vtgateAddrTmplStr, err) - } - - /* vtctld options */ - if *vtctldDatacenterTmplStr != "" { - disco.vtctldDatacenter, err = generateConsulDatacenter("vtctld", cluster, *vtctldDatacenterTmplStr) - if err != nil { - return nil, fmt.Errorf("failed to generate vtctld consul datacenter from template: %w", err) - } - } - - if *vtctldFQDNTmplStr != "" { - disco.vtctldFQDNTmpl, err = template.New("consul-vtctld-fqdn-template-" + cluster.Id).Parse(*vtctldFQDNTmplStr) - if err != nil { - return nil, fmt.Errorf("failed to parse vtctld FQDN template %s: %w", *vtctldFQDNTmplStr, err) - } - } - - disco.vtctldAddrTmpl, err = template.New("consul-vtctld-address-template-" + cluster.Id).Parse(*vtctldAddrTmplStr) - if err != nil { - return nil, fmt.Errorf("failed to parse vtctld host address template %s: %w", *vtctldAddrTmplStr, err) - } - - return disco, nil -} - -func generateConsulDatacenter(component string, cluster *vtadminpb.Cluster, tmplStr string) (string, error) { - tmpl, err := template.New("consul-" + component + "-datacenter-" + cluster.Id).Parse(tmplStr) - if err != nil { - return "", fmt.Errorf("error parsing template %s: %w", tmplStr, err) - } - - dc, err := textutil.ExecuteTemplate(tmpl, &struct { - Cluster *vtadminpb.Cluster - }{ - Cluster: cluster, - }) - if err != nil { - return "", fmt.Errorf("failed to execute template: %w", err) - } - - return dc, nil -} - -// DiscoverVTGate is part of the Discovery interface. -func (c *ConsulDiscovery) DiscoverVTGate(ctx context.Context, tags []string) (*vtadminpb.VTGate, error) { - span, ctx := trace.NewSpan(ctx, "ConsulDiscovery.DiscoverVTGate") - defer span.Finish() - - executeFQDNTemplate := true - - return c.discoverVTGate(ctx, tags, executeFQDNTemplate) -} - -// discoverVTGate calls discoverVTGates and then returns a random VTGate from -// the result. see discoverVTGates for further documentation. -func (c *ConsulDiscovery) discoverVTGate(ctx context.Context, tags []string, executeFQDNTemplate bool) (*vtadminpb.VTGate, error) { - vtgates, err := c.discoverVTGates(ctx, tags, executeFQDNTemplate) - if err != nil { - return nil, err - } - - if len(vtgates) == 0 { - return nil, ErrNoVTGates - } - - return vtgates[rand.IntN(len(vtgates))], nil -} - -// DiscoverVTGateAddr is part of the Discovery interface. -func (c *ConsulDiscovery) DiscoverVTGateAddr(ctx context.Context, tags []string) (string, error) { - span, ctx := trace.NewSpan(ctx, "ConsulDiscovery.DiscoverVTGateAddr") - defer span.Finish() - - executeFQDNTemplate := false - - vtgate, err := c.discoverVTGate(ctx, tags, executeFQDNTemplate) - if err != nil { - return "", err - } - - addr, err := textutil.ExecuteTemplate(c.vtgateAddrTmpl, vtgate) - if err != nil { - return "", fmt.Errorf("failed to execute vtgate address template for %v: %w", vtgate, err) - } - - return addr, nil -} - -// DiscoverVTGateAddrs is part of the Discovery interface. -func (c *ConsulDiscovery) DiscoverVTGateAddrs(ctx context.Context, tags []string) ([]string, error) { - span, ctx := trace.NewSpan(ctx, "ConsulDiscovery.DiscoverVTGateAddrs") - defer span.Finish() - - executeFQDNTemplate := false - - vtgates, err := c.discoverVTGates(ctx, tags, executeFQDNTemplate) - if err != nil { - return nil, err - } - - addrs := make([]string, len(vtgates)) - for i, vtgate := range vtgates { - addr, err := textutil.ExecuteTemplate(c.vtgateAddrTmpl, vtgate) - if err != nil { - return nil, fmt.Errorf("failed to execute vtgate address template for %v: %w", vtgate, err) - } - - addrs[i] = addr - } - - return addrs, nil -} - -// DiscoverVTGates is part of the Discovery interface. -func (c *ConsulDiscovery) DiscoverVTGates(ctx context.Context, tags []string) ([]*vtadminpb.VTGate, error) { - span, ctx := trace.NewSpan(ctx, "ConsulDiscovery.DiscoverVTGates") - defer span.Finish() - - executeFQDNTemplate := true - - return c.discoverVTGates(ctx, tags, executeFQDNTemplate) -} - -// discoverVTGates does the actual work of discovering VTGate hosts from a -// consul datacenter. executeFQDNTemplate is boolean to allow an optimization -// for DiscoverVTGateAddr (the only function that sets the boolean to false). -func (c *ConsulDiscovery) discoverVTGates(_ context.Context, tags []string, executeFQDNTemplate bool) ([]*vtadminpb.VTGate, error) { - opts := c.getQueryOptions() - opts.Datacenter = c.vtgateDatacenter - - entries, _, err := c.client.Health().ServiceMultipleTags(c.vtgateService, tags, c.passingOnly, &opts) - if err != nil { - return nil, err - } - - vtgates := make([]*vtadminpb.VTGate, len(entries)) - - for i, entry := range entries { - vtgate := &vtadminpb.VTGate{ - Hostname: entry.Node.Node, - Cluster: &vtadminpb.Cluster{ - Id: c.cluster.Id, - Name: c.cluster.Name, - }, - } - - var cell, pool string - for _, tag := range entry.Service.Tags { - if pool != "" && cell != "" { - break - } - - parts := strings.Split(tag, ":") - if len(parts) != 2 { - continue - } - - name, value := parts[0], parts[1] - switch name { - case c.vtgateCellTag: - cell = value - case c.vtgatePoolTag: - pool = value - } - } - - vtgate.Cell = cell - vtgate.Pool = pool - - if keyspaces, ok := entry.Service.Meta[c.vtgateKeyspacesToWatchTag]; ok { - vtgate.Keyspaces = strings.Split(keyspaces, ",") - } - - if executeFQDNTemplate { - if c.vtgateFQDNTmpl != nil { - vtgate.FQDN, err = textutil.ExecuteTemplate(c.vtgateFQDNTmpl, vtgate) - if err != nil { - return nil, fmt.Errorf("failed to execute vtgate fqdn template for %v: %w", vtgate, err) - } - } - } - - vtgates[i] = vtgate - } - - return vtgates, nil -} - -// DiscoverVtctld is part of the Discovery interface. -func (c *ConsulDiscovery) DiscoverVtctld(ctx context.Context, tags []string) (*vtadminpb.Vtctld, error) { - span, ctx := trace.NewSpan(ctx, "ConsulDiscovery.DiscoverVtctld") - defer span.Finish() - - executeFQDNTemplate := true - - return c.discoverVtctld(ctx, tags, executeFQDNTemplate) -} - -// discoverVtctld calls discoverVtctlds and then returns a random vtctld from -// the result. see discoverVtctlds for further documentation. -func (c *ConsulDiscovery) discoverVtctld(ctx context.Context, tags []string, executeFQDNTemplate bool) (*vtadminpb.Vtctld, error) { - vtctlds, err := c.discoverVtctlds(ctx, tags, executeFQDNTemplate) - if err != nil { - return nil, err - } - - if len(vtctlds) == 0 { - return nil, ErrNoVtctlds - } - - return vtctlds[rand.IntN(len(vtctlds))], nil -} - -// DiscoverVtctldAddr is part of the Discovery interface. -func (c *ConsulDiscovery) DiscoverVtctldAddr(ctx context.Context, tags []string) (string, error) { - span, ctx := trace.NewSpan(ctx, "ConsulDiscovery.DiscoverVtctldAddr") - defer span.Finish() - - executeFQDNTemplate := false - - vtctld, err := c.discoverVtctld(ctx, tags, executeFQDNTemplate) - if err != nil { - return "", err - } - - addr, err := textutil.ExecuteTemplate(c.vtctldAddrTmpl, vtctld) - if err != nil { - return "", fmt.Errorf("failed to execute vtctld address template for %v: %w", vtctld, err) - } - - return addr, nil -} - -// DiscoverVtctldAddrs is part of the Discovery interface. -func (c *ConsulDiscovery) DiscoverVtctldAddrs(ctx context.Context, tags []string) ([]string, error) { - span, ctx := trace.NewSpan(ctx, "ConsulDiscovery.DiscoverVtctldAddrs") - defer span.Finish() - - executeFQDNTemplate := false - - vtctlds, err := c.discoverVtctlds(ctx, tags, executeFQDNTemplate) - if err != nil { - return nil, err - } - - addrs := make([]string, len(vtctlds)) - for i, vtctld := range vtctlds { - addr, err := textutil.ExecuteTemplate(c.vtctldAddrTmpl, vtctld) - if err != nil { - return nil, fmt.Errorf("failed to execute vtctld address template for %v: %w", vtctld, err) - } - - addrs[i] = addr - } - - return addrs, nil -} - -// DiscoverVtctlds is part of the Discovery interface. -func (c *ConsulDiscovery) DiscoverVtctlds(ctx context.Context, tags []string) ([]*vtadminpb.Vtctld, error) { - span, ctx := trace.NewSpan(ctx, "ConsulDiscovery.DiscoverVtctlds") - defer span.Finish() - - executeFQDNTemplate := true - - return c.discoverVtctlds(ctx, tags, executeFQDNTemplate) -} - -// discoverVtctlds does the actual work of discovering Vtctld hosts from a -// consul datacenter. executeFQDNTemplate is boolean to allow an optimization -// for DiscoverVtctldAddr (the only function that sets the boolean to false). -func (c *ConsulDiscovery) discoverVtctlds(_ context.Context, tags []string, executeFQDNTemplate bool) ([]*vtadminpb.Vtctld, error) { - opts := c.getQueryOptions() - opts.Datacenter = c.vtctldDatacenter - - entries, _, err := c.client.Health().ServiceMultipleTags(c.vtctldService, tags, c.passingOnly, &opts) - if err != nil { - return nil, err - } - - vtctlds := make([]*vtadminpb.Vtctld, len(entries)) - - for i, entry := range entries { - vtctld := &vtadminpb.Vtctld{ - Cluster: &vtadminpb.Cluster{ - Id: c.cluster.Id, - Name: c.cluster.Name, - }, - Hostname: entry.Node.Node, - } - - if executeFQDNTemplate { - if c.vtctldFQDNTmpl != nil { - vtctld.FQDN, err = textutil.ExecuteTemplate(c.vtctldFQDNTmpl, vtctld) - if err != nil { - return nil, fmt.Errorf("failed to execute vtctld fqdn template for %v: %w", vtctld, err) - } - } - } - - vtctlds[i] = vtctld - } - - return vtctlds, nil -} - -// getQueryOptions returns a shallow copy so we can swap in the vtgateDatacenter. -// If we were to set it directly, we'd need a mutex to guard against concurrent -// vtgate and (soon) vtctld queries. -func (c *ConsulDiscovery) getQueryOptions() consul.QueryOptions { - if c.queryOptions == nil { - return consul.QueryOptions{} - } - - opts := *c.queryOptions - - return opts -} - -// ConsulClient defines an interface for the subset of the consul API used by -// discovery, so we can swap in an implementation for testing. -type ConsulClient interface { - Health() ConsulHealth -} - -// ConsulHealth defines an interface for the subset of the (*consul.Health) struct -// used by discovery, so we can swap in an implementation for testing. -type ConsulHealth interface { - ServiceMultipleTags(service string, tags []string, passingOnly bool, q *consul.QueryOptions) ([]*consul.ServiceEntry, *consul.QueryMeta, error) -} - -// consulClient is our shim wrapper around the upstream consul client. -type consulClient struct { - *consul.Client -} - -func (c *consulClient) Health() ConsulHealth { - return c.Client.Health() -} diff --git a/go/vt/vtadmin/cluster/discovery/discovery_consul_test.go b/go/vt/vtadmin/cluster/discovery/discovery_consul_test.go deleted file mode 100644 index 574cf2835bc..00000000000 --- a/go/vt/vtadmin/cluster/discovery/discovery_consul_test.go +++ /dev/null @@ -1,460 +0,0 @@ -/* -Copyright 2020 The Vitess Authors. - -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 - - http://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. -*/ - -package discovery - -import ( - "context" - "sort" - "testing" - "text/template" - - consul "github.com/hashicorp/consul/api" - "github.com/stretchr/testify/assert" - - vtadminpb "vitess.io/vitess/go/vt/proto/vtadmin" -) - -type fakeConsulClient struct { - health *fakeConsulHealth -} - -func (c *fakeConsulClient) Health() ConsulHealth { return c.health } - -type fakeConsulHealth struct { - entries map[string][]*consul.ServiceEntry -} - -func (health *fakeConsulHealth) ServiceMultipleTags(service string, tags []string, passingOnly bool, q *consul.QueryOptions) ([]*consul.ServiceEntry, *consul.QueryMeta, error) { - if health.entries == nil { - return nil, nil, assert.AnError - } - - sort.Strings(tags) - - serviceEntries, ok := health.entries[service] - if !ok { - return []*consul.ServiceEntry{}, nil, nil - } - - filterByTags := func(etags []string) bool { - sort.Strings(etags) - - for _, tag := range tags { - i := sort.SearchStrings(etags, tag) - if i >= len(etags) || etags[i] != tag { - return false - } - } - - return true - } - - filteredEntries := make([]*consul.ServiceEntry, 0, len(serviceEntries)) - - for _, entry := range serviceEntries { - if filterByTags(append([]string{}, entry.Service.Tags...)) { // we take a copy here to not mutate the original slice - filteredEntries = append(filteredEntries, entry) - } - } - - return filteredEntries, nil, nil -} - -func consulServiceEntry(name string, tags []string, meta map[string]string) *consul.ServiceEntry { - return &consul.ServiceEntry{ - Node: &consul.Node{ - Node: name, - }, - Service: &consul.AgentService{ - Meta: meta, - Tags: tags, - }, - } -} - -func TestConsulDiscoverVTGates(t *testing.T) { - t.Parallel() - - tests := []struct { - name string - disco *ConsulDiscovery - tags []string - entries map[string][]*consul.ServiceEntry - expected []*vtadminpb.VTGate - shouldErr bool - }{ - { - name: "all gates", - disco: &ConsulDiscovery{ - cluster: &vtadminpb.Cluster{ - Id: "cid", - Name: "cluster", - }, - vtgateService: "vtgate", - vtgateCellTag: "cell", - vtgatePoolTag: "pool", - }, - tags: []string{}, - entries: map[string][]*consul.ServiceEntry{ - "vtgate": { - consulServiceEntry("vtgate1", []string{"pool:pool1", "cell:zone1", "extra:tag"}, nil), - consulServiceEntry("vtgate2", []string{"pool:pool1", "cell:zone2"}, nil), - consulServiceEntry("vtgate3", []string{"pool:pool1", "cell:zone3"}, nil), - }, - }, - expected: []*vtadminpb.VTGate{ - { - Cluster: &vtadminpb.Cluster{ - Id: "cid", - Name: "cluster", - }, - Hostname: "vtgate1", - Cell: "zone1", - Pool: "pool1", - }, - { - Cluster: &vtadminpb.Cluster{ - Id: "cid", - Name: "cluster", - }, - Hostname: "vtgate2", - Cell: "zone2", - Pool: "pool1", - }, - { - Cluster: &vtadminpb.Cluster{ - Id: "cid", - Name: "cluster", - }, - Hostname: "vtgate3", - Cell: "zone3", - Pool: "pool1", - }, - }, - shouldErr: false, - }, - { - name: "one cell", - disco: &ConsulDiscovery{ - cluster: &vtadminpb.Cluster{ - Id: "cid", - Name: "cluster", - }, - vtgateService: "vtgate", - vtgateCellTag: "cell", - vtgatePoolTag: "pool", - }, - tags: []string{"cell:zone1"}, - entries: map[string][]*consul.ServiceEntry{ - "vtgate": { - consulServiceEntry("vtgate1", []string{"pool:pool1", "cell:zone1", "extra:tag"}, nil), - consulServiceEntry("vtgate2", []string{"pool:pool1", "cell:zone2"}, nil), - consulServiceEntry("vtgate3", []string{"pool:pool1", "cell:zone3"}, nil), - }, - }, - expected: []*vtadminpb.VTGate{ - { - Cluster: &vtadminpb.Cluster{ - Id: "cid", - Name: "cluster", - }, - Hostname: "vtgate1", - Cell: "zone1", - Pool: "pool1", - }, - }, - shouldErr: false, - }, - { - name: "keyspaces to watch", - disco: &ConsulDiscovery{ - cluster: &vtadminpb.Cluster{ - Id: "cid", - Name: "cluster", - }, - vtgateService: "vtgate", - vtgateCellTag: "cell", - vtgatePoolTag: "pool", - vtgateKeyspacesToWatchTag: "keyspaces", - }, - tags: []string{}, - entries: map[string][]*consul.ServiceEntry{ - "vtgate": { - consulServiceEntry("vtgate1", []string{"pool:pool1", "cell:zone1"}, map[string]string{"keyspaces": "ks1,ks2"}), - }, - }, - expected: []*vtadminpb.VTGate{ - { - Cluster: &vtadminpb.Cluster{ - Id: "cid", - Name: "cluster", - }, - Hostname: "vtgate1", - Cell: "zone1", - Pool: "pool1", - Keyspaces: []string{"ks1", "ks2"}, - }, - }, - shouldErr: false, - }, - { - name: "error", - disco: &ConsulDiscovery{ - cluster: &vtadminpb.Cluster{ - Id: "cid", - Name: "cluster", - }, - vtgateService: "vtgate", - vtgateCellTag: "cell", - vtgatePoolTag: "pool", - vtgateKeyspacesToWatchTag: "keyspaces", - }, - tags: []string{}, - entries: nil, - expected: []*vtadminpb.VTGate{}, - shouldErr: true, - }, - } - - ctx := context.Background() - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - t.Parallel() - - tt.disco.client = &fakeConsulClient{ - health: &fakeConsulHealth{ - entries: tt.entries, - }, - } - - gates, err := tt.disco.DiscoverVTGates(ctx, tt.tags) - if tt.shouldErr { - assert.Error(t, err, assert.AnError) - return - } - - assert.NoError(t, err) - assert.Equal(t, tt.expected, gates) - }) - } -} - -func TestConsulDiscoverVTGate(t *testing.T) { - t.Parallel() - - tests := []struct { - name string - disco *ConsulDiscovery - tags []string - entries map[string][]*consul.ServiceEntry - expected *vtadminpb.VTGate - shouldErr bool - }{ - { - name: "success", - disco: &ConsulDiscovery{ - cluster: &vtadminpb.Cluster{ - Id: "cid", - Name: "cluster", - }, - vtgateService: "vtgate", - vtgateCellTag: "cell", - vtgatePoolTag: "pool", - }, - tags: []string{"cell:zone1"}, - entries: map[string][]*consul.ServiceEntry{ - "vtgate": { - consulServiceEntry("vtgate1", []string{"pool:pool1", "cell:zone1"}, nil), - consulServiceEntry("vtgate2", []string{"pool:pool1", "cell:zone2"}, nil), - consulServiceEntry("vtgate3", []string{"pool:pool1", "cell:zone3"}, nil), - }, - }, - expected: &vtadminpb.VTGate{ - Cluster: &vtadminpb.Cluster{ - Id: "cid", - Name: "cluster", - }, - Hostname: "vtgate1", - Cell: "zone1", - Pool: "pool1", - }, - shouldErr: false, - }, - { - name: "no gates", - disco: &ConsulDiscovery{ - cluster: &vtadminpb.Cluster{ - Id: "cid", - Name: "cluster", - }, - vtgateService: "vtgate", - vtgateCellTag: "cell", - vtgatePoolTag: "pool", - }, - tags: []string{"cell:zone1"}, - entries: map[string][]*consul.ServiceEntry{ - "vtgate": {}, - }, - expected: &vtadminpb.VTGate{ - Cluster: &vtadminpb.Cluster{ - Id: "cid", - Name: "cluster", - }, - Hostname: "vtgate1", - Cell: "zone1", - Pool: "pool1", - }, - shouldErr: true, - }, - { - name: "error", - disco: &ConsulDiscovery{ - cluster: &vtadminpb.Cluster{ - Id: "cid", - Name: "cluster", - }, - vtgateService: "vtgate", - vtgateCellTag: "cell", - vtgatePoolTag: "pool", - }, - tags: []string{"cell:zone1"}, - entries: nil, - expected: nil, - shouldErr: true, - }, - } - - ctx := context.Background() - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - t.Parallel() - - tt.disco.client = &fakeConsulClient{ - health: &fakeConsulHealth{ - entries: tt.entries, - }, - } - - gate, err := tt.disco.DiscoverVTGate(ctx, tt.tags) - if tt.shouldErr { - assert.Error(t, err, assert.AnError) - return - } - - assert.NoError(t, err) - assert.Equal(t, tt.expected, gate) - }) - } -} - -func TestConsulDiscoverVTGateAddr(t *testing.T) { - t.Parallel() - - tests := []struct { - name string - disco *ConsulDiscovery - tags []string - entries map[string][]*consul.ServiceEntry - expected string - shouldErr bool - }{ - { - name: "default template", - disco: &ConsulDiscovery{ - cluster: &vtadminpb.Cluster{ - Id: "cid", - Name: "cluster", - }, - vtgateService: "vtgate", - vtgateCellTag: "cell", - vtgatePoolTag: "pool", - vtgateAddrTmpl: template.Must(template.New("").Parse("{{ .Hostname }}")), - }, - tags: []string{}, - entries: map[string][]*consul.ServiceEntry{ - "vtgate": { - consulServiceEntry("vtgate1", []string{"pool:pool1", "cell:zone1"}, nil), - }, - }, - expected: "vtgate1", - shouldErr: false, - }, - { - name: "custom template", - disco: &ConsulDiscovery{ - cluster: &vtadminpb.Cluster{ - Id: "cid", - Name: "cluster", - }, - vtgateService: "vtgate", - vtgateCellTag: "cell", - vtgatePoolTag: "pool", - vtgateAddrTmpl: template.Must(template.New("").Parse("{{ .Cluster.Name }}-{{ .Pool }}-{{ .Cell }}-{{ .Hostname }}.example.com:15000")), - }, - tags: []string{}, - entries: map[string][]*consul.ServiceEntry{ - "vtgate": { - consulServiceEntry("vtgate1", []string{"pool:pool1", "cell:zone1"}, nil), - }, - }, - expected: "cluster-pool1-zone1-vtgate1.example.com:15000", - shouldErr: false, - }, - { - name: "error", - disco: &ConsulDiscovery{ - cluster: &vtadminpb.Cluster{ - Id: "cid", - Name: "cluster", - }, - vtgateService: "vtgate", - vtgateCellTag: "cell", - vtgatePoolTag: "pool", - vtgateAddrTmpl: template.Must(template.New("").Parse("{{ .Hostname }}")), - }, - tags: []string{}, - entries: nil, - expected: "", - shouldErr: true, - }, - } - - ctx := context.Background() - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - t.Parallel() - - tt.disco.client = &fakeConsulClient{ - health: &fakeConsulHealth{ - entries: tt.entries, - }, - } - - addr, err := tt.disco.DiscoverVTGateAddr(ctx, tt.tags) - if tt.shouldErr { - assert.Error(t, err, assert.AnError) - return - } - - assert.NoError(t, err) - assert.Equal(t, tt.expected, addr) - }) - } -} diff --git a/go/vt/vtadmin/cluster/discovery/discovery_test.go b/go/vt/vtadmin/cluster/discovery/discovery_test.go index 76616d6514c..444e5f4700c 100644 --- a/go/vt/vtadmin/cluster/discovery/discovery_test.go +++ b/go/vt/vtadmin/cluster/discovery/discovery_test.go @@ -32,18 +32,21 @@ func TestNew(t *testing.T) { tests := []struct { name string impl string + args []string err error typ Discovery }{ { name: "success", - impl: "consul", + impl: "dynamic", + args: []string{"--discovery", `{"vtgates": []}`}, err: nil, - typ: &ConsulDiscovery{}, + typ: &DynamicDiscovery{}, }, { name: "unregistered", impl: "unregistered", + args: nil, err: ErrImplementationNotRegistered, typ: nil, }, @@ -53,7 +56,7 @@ func TestNew(t *testing.T) { t.Run(tt.name, func(t *testing.T) { t.Parallel() - disco, err := New(tt.impl, &vtadminpb.Cluster{Id: "testid", Name: "testcluster"}, []string{}) + disco, err := New(tt.impl, &vtadminpb.Cluster{Id: "testid", Name: "testcluster"}, tt.args) if tt.err != nil { assert.Error(t, err, tt.err.Error()) return diff --git a/go/vt/vtadmin/cluster/file_config.go b/go/vt/vtadmin/cluster/file_config.go index 279150afeea..23a21853446 100644 --- a/go/vt/vtadmin/cluster/file_config.go +++ b/go/vt/vtadmin/cluster/file_config.go @@ -37,7 +37,7 @@ import ( // discovery-k8s-some-flag: some-val // clusterID2: // name: clusterName2 -// discovery: consul +// discovery: staticfile type FileConfig struct { Defaults Config Clusters map[string]Config diff --git a/go/vt/vtadmin/cluster/file_config_test.go b/go/vt/vtadmin/cluster/file_config_test.go index 99c1423929a..5ca6cc04d40 100644 --- a/go/vt/vtadmin/cluster/file_config_test.go +++ b/go/vt/vtadmin/cluster/file_config_test.go @@ -36,27 +36,27 @@ func TestFileConfigFromViper(t *testing.T) { { name: "clusters.yaml", data: `defaults: - discovery: consul - discovery-consul-vtctld-datacenter-tmpl: "dev-{{ .Cluster.Name }}" - discovery-consul-vtctld-service-name: vtctld-svc - discovery-consul-vtctld-addr-tmpl: "{{ .Hostname }}.example.com:15000" - discovery-consul-vtgate-datacenter-tmpl: "dev-{{ .Cluster.Name }}" - discovery-consul-vtgate-service-name: vtgate-svc - discovery-consul-vtgate-pool-tag: type - discovery-consul-vtgate-cell-tag: zone - discovery-consul-vtgate-addr-tmpl: "{{ .Hostname }}.example.com:15999" + discovery: staticfile + discovery-staticfile-vtctld-datacenter-tmpl: "dev-{{ .Cluster.Name }}" + discovery-staticfile-vtctld-service-name: vtctld-svc + discovery-staticfile-vtctld-addr-tmpl: "{{ .Hostname }}.example.com:15000" + discovery-staticfile-vtgate-datacenter-tmpl: "dev-{{ .Cluster.Name }}" + discovery-staticfile-vtgate-service-name: vtgate-svc + discovery-staticfile-vtgate-pool-tag: type + discovery-staticfile-vtgate-cell-tag: zone + discovery-staticfile-vtgate-addr-tmpl: "{{ .Hostname }}.example.com:15999" clusters: c1: name: testcluster1 - discovery-consul-vtgate-datacenter-tmpl: "dev-{{ .Cluster.Name }}-test" + discovery-staticfile-vtgate-datacenter-tmpl: "dev-{{ .Cluster.Name }}-test" c2: name: devcluster`, config: FileConfig{ Defaults: Config{ - DiscoveryImpl: "consul", + DiscoveryImpl: "staticfile", DiscoveryFlagsByImpl: map[string]map[string]string{ - "consul": { + "staticfile": { "vtctld-datacenter-tmpl": "dev-{{ .Cluster.Name }}", "vtctld-service-name": "vtctld-svc", "vtctld-addr-tmpl": "{{ .Hostname }}.example.com:15000", @@ -73,7 +73,7 @@ clusters: ID: "c1", Name: "testcluster1", DiscoveryFlagsByImpl: map[string]map[string]string{ - "consul": { + "staticfile": { "vtgate-datacenter-tmpl": "dev-{{ .Cluster.Name }}-test", }, }, @@ -95,20 +95,20 @@ clusters: name: "clusters.json", data: `{ "defaults": { - "discovery": "consul", - "discovery-consul-vtctld-datacenter-tmpl": "dev-{{ .Cluster.Name }}", - "discovery-consul-vtctld-service-name": "vtctld-svc", - "discovery-consul-vtctld-addr-tmpl": "{{ .Hostname }}.example.com:15000", - "discovery-consul-vtgate-datacenter-tmpl": "dev-{{ .Cluster.Name }}", - "discovery-consul-vtgate-service-name": "vtgate-svc", - "discovery-consul-vtgate-pool-tag": "type", - "discovery-consul-vtgate-cell-tag": "zone", - "discovery-consul-vtgate-addr-tmpl": "{{ .Hostname }}.example.com:15999" + "discovery": "staticfile", + "discovery-staticfile-vtctld-datacenter-tmpl": "dev-{{ .Cluster.Name }}", + "discovery-staticfile-vtctld-service-name": "vtctld-svc", + "discovery-staticfile-vtctld-addr-tmpl": "{{ .Hostname }}.example.com:15000", + "discovery-staticfile-vtgate-datacenter-tmpl": "dev-{{ .Cluster.Name }}", + "discovery-staticfile-vtgate-service-name": "vtgate-svc", + "discovery-staticfile-vtgate-pool-tag": "type", + "discovery-staticfile-vtgate-cell-tag": "zone", + "discovery-staticfile-vtgate-addr-tmpl": "{{ .Hostname }}.example.com:15999" }, "clusters": { "c1": { "name": "testcluster1", - "discovery-consul-vtgate-datacenter-tmpl": "dev-{{ .Cluster.Name }}-test" + "discovery-staticfile-vtgate-datacenter-tmpl": "dev-{{ .Cluster.Name }}-test" }, "c2": { "name": "devcluster" @@ -117,9 +117,9 @@ clusters: }`, config: FileConfig{ Defaults: Config{ - DiscoveryImpl: "consul", + DiscoveryImpl: "staticfile", DiscoveryFlagsByImpl: map[string]map[string]string{ - "consul": { + "staticfile": { "vtctld-datacenter-tmpl": "dev-{{ .Cluster.Name }}", "vtctld-service-name": "vtctld-svc", "vtctld-addr-tmpl": "{{ .Hostname }}.example.com:15000", @@ -136,7 +136,7 @@ clusters: ID: "c1", Name: "testcluster1", DiscoveryFlagsByImpl: map[string]map[string]string{ - "consul": { + "staticfile": { "vtgate-datacenter-tmpl": "dev-{{ .Cluster.Name }}-test", }, }, @@ -157,27 +157,27 @@ clusters: { name: "clusters.toml", data: `[defaults] -discovery="consul" -discovery-consul-vtctld-datacenter-tmpl="dev-{{ .Cluster.Name }}" -discovery-consul-vtctld-service-name="vtctld-svc" -discovery-consul-vtctld-addr-tmpl="{{ .Hostname }}.example.com:15000" -discovery-consul-vtgate-datacenter-tmpl="dev-{{ .Cluster.Name }}" -discovery-consul-vtgate-service-name="vtgate-svc" -discovery-consul-vtgate-pool-tag="type" -discovery-consul-vtgate-cell-tag="zone" -discovery-consul-vtgate-addr-tmpl="{{ .Hostname }}.example.com:15999" +discovery="staticfile" +discovery-staticfile-vtctld-datacenter-tmpl="dev-{{ .Cluster.Name }}" +discovery-staticfile-vtctld-service-name="vtctld-svc" +discovery-staticfile-vtctld-addr-tmpl="{{ .Hostname }}.example.com:15000" +discovery-staticfile-vtgate-datacenter-tmpl="dev-{{ .Cluster.Name }}" +discovery-staticfile-vtgate-service-name="vtgate-svc" +discovery-staticfile-vtgate-pool-tag="type" +discovery-staticfile-vtgate-cell-tag="zone" +discovery-staticfile-vtgate-addr-tmpl="{{ .Hostname }}.example.com:15999" [clusters] [clusters.c1] name="testcluster1" -discovery-consul-vtgate-datacenter-tmpl="dev-{{ .Cluster.Name }}-test" +discovery-staticfile-vtgate-datacenter-tmpl="dev-{{ .Cluster.Name }}-test" [clusters.c2] name="devcluster"`, config: FileConfig{ Defaults: Config{ - DiscoveryImpl: "consul", + DiscoveryImpl: "staticfile", DiscoveryFlagsByImpl: map[string]map[string]string{ - "consul": { + "staticfile": { "vtctld-datacenter-tmpl": "dev-{{ .Cluster.Name }}", "vtctld-service-name": "vtctld-svc", "vtctld-addr-tmpl": "{{ .Hostname }}.example.com:15000", @@ -194,7 +194,7 @@ name="devcluster"`, ID: "c1", Name: "testcluster1", DiscoveryFlagsByImpl: map[string]map[string]string{ - "consul": { + "staticfile": { "vtgate-datacenter-tmpl": "dev-{{ .Cluster.Name }}-test", }, }, @@ -249,9 +249,9 @@ func TestCombine(t *testing.T) { name: "default overrides file", fc: FileConfig{ Defaults: Config{ - DiscoveryImpl: "consul", + DiscoveryImpl: "staticfile", DiscoveryFlagsByImpl: map[string]map[string]string{ - "consul": { + "staticfile": { "vtgate-datacenter-tmpl": "dev-{{ .Cluster }}", }, }, @@ -270,7 +270,7 @@ func TestCombine(t *testing.T) { ID: "2", Name: "two", DiscoveryFlagsByImpl: map[string]map[string]string{ - "consul": { + "staticfile": { "vtgate-datacenter-tmpl": "dev-{{ .Cluster }}-test", }, }, @@ -282,7 +282,7 @@ func TestCombine(t *testing.T) { Name: "one", DiscoveryImpl: "zk", DiscoveryFlagsByImpl: map[string]map[string]string{ - "consul": { + "staticfile": { "vtgate-datacenter-tmpl": "dev-{{ .Cluster }}", }, }, @@ -294,7 +294,7 @@ func TestCombine(t *testing.T) { Name: "two", DiscoveryImpl: "zk", DiscoveryFlagsByImpl: map[string]map[string]string{ - "consul": { + "staticfile": { "vtgate-datacenter-tmpl": "dev-{{ .Cluster }}-test", }, }, @@ -307,7 +307,7 @@ func TestCombine(t *testing.T) { name: "mixed", fc: FileConfig{ Defaults: Config{ - DiscoveryImpl: "consul", + DiscoveryImpl: "staticfile", }, Clusters: map[string]Config{ "c1": { @@ -341,7 +341,7 @@ func TestCombine(t *testing.T) { { ID: "c1", Name: "cluster1", - DiscoveryImpl: "consul", + DiscoveryImpl: "staticfile", DiscoveryFlagsByImpl: map[string]map[string]string{ "zk": { "flag": "val", @@ -353,7 +353,7 @@ func TestCombine(t *testing.T) { { ID: "c2", Name: "cluster2", - DiscoveryImpl: "consul", + DiscoveryImpl: "staticfile", DiscoveryFlagsByImpl: map[string]map[string]string{ "zk": { "flag": "val", @@ -365,7 +365,7 @@ func TestCombine(t *testing.T) { { ID: "c3", Name: "cluster3", - DiscoveryImpl: "consul", + DiscoveryImpl: "staticfile", DiscoveryFlagsByImpl: map[string]map[string]string{ "zk": { "flag": "val", diff --git a/go/vt/vtadmin/cluster/flags_test.go b/go/vt/vtadmin/cluster/flags_test.go index 33a3cdf416b..409922d4807 100644 --- a/go/vt/vtadmin/cluster/flags_test.go +++ b/go/vt/vtadmin/cluster/flags_test.go @@ -49,12 +49,12 @@ func TestMergeFlagsByImpl(t *testing.T) { name: "all overrides", base: nil, in: map[string]map[string]string{ - "consul": { + "staticfile": { "flag1": "value1", }, }, expected: map[string]map[string]string{ - "consul": { + "staticfile": { "flag1": "value1", }, }, @@ -62,13 +62,13 @@ func TestMergeFlagsByImpl(t *testing.T) { { name: "all defaults", base: map[string]map[string]string{ - "consul": { + "staticfile": { "flag1": "value1", }, }, in: nil, expected: map[string]map[string]string{ - "consul": { + "staticfile": { "flag1": "value1", }, }, @@ -76,19 +76,19 @@ func TestMergeFlagsByImpl(t *testing.T) { { name: "mixed", base: map[string]map[string]string{ - "consul": { + "staticfile": { "flag1": "value1", "flag2": "value2", }, "other": {}, }, in: map[string]map[string]string{ - "consul": { + "staticfile": { "flag1": "othervalue", }, }, expected: map[string]map[string]string{ - "consul": { + "staticfile": { "flag1": "othervalue", "flag2": "value2", }, diff --git a/go/vt/vtctl/plugin_consultopo.go b/go/vt/vtctl/plugin_consultopo.go deleted file mode 100644 index 53c7e929995..00000000000 --- a/go/vt/vtctl/plugin_consultopo.go +++ /dev/null @@ -1,23 +0,0 @@ -/* -Copyright 2019 The Vitess Authors. - -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 - - http://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. -*/ - -package vtctl - -import ( - // Imports consultopo to register the consul implementation of - // TopoServer. - _ "vitess.io/vitess/go/vt/topo/consultopo" -) diff --git a/go/vt/vtctl/vtctl.go b/go/vt/vtctl/vtctl.go index 2caaaf8b8e0..a37b0f74da3 100644 --- a/go/vt/vtctl/vtctl.go +++ b/go/vt/vtctl/vtctl.go @@ -488,7 +488,7 @@ var commands = []commandGroup{ { name: "Mount", method: commandMount, - params: "[--topo_type=etcd2|consul|zookeeper] [--topo_server=topo_url] [--topo_root=root_topo_node> [--unmount] [--list] [--show] []", + params: "[--topo_type=etcd2|zookeeper] [--topo_server=topo_url] [--topo_root=root_topo_node> [--unmount] [--list] [--show] []", help: "Add/Remove/Display/List external cluster(s) to this vitess cluster", }, }, diff --git a/go/vt/vttest/plugin_consultopo.go b/go/vt/vttest/plugin_consultopo.go deleted file mode 100644 index c5f6d12aa41..00000000000 --- a/go/vt/vttest/plugin_consultopo.go +++ /dev/null @@ -1,23 +0,0 @@ -/* -Copyright 2021 The Vitess Authors. - -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 - - http://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. -*/ - -package vttest - -// This plugin imports consultopo to register the consul implementation of TopoServer. - -import ( - _ "vitess.io/vitess/go/vt/topo/consultopo" -) diff --git a/test/ci_workflow_gen.go b/test/ci_workflow_gen.go index 147457bbb40..be9218cd057 100644 --- a/test/ci_workflow_gen.go +++ b/test/ci_workflow_gen.go @@ -106,7 +106,6 @@ var ( "onlineddl_scheduler", "tabletmanager_throttler_topo", "tabletmanager_tablegc", - "tabletmanager_consul", "vtgate_concurrentdml", "vtgate_godriver", "vtgate_gen4", @@ -115,7 +114,6 @@ var ( "vtgate_schema", "vtgate_tablet_healthcheck_cache", "vtgate_topo", - "vtgate_topo_consul", "vtgate_topo_etcd", "vtgate_transaction", "vtgate_unsharded", @@ -163,8 +161,6 @@ var ( clustersRequiringMakeTools = []string{ "18", "mysql_server_vault", - "vtgate_topo_consul", - "tabletmanager_consul", } clustersRequiringMemoryCheck = []string{ "vtorc", diff --git a/test/config.json b/test/config.json index 20d1a61e38e..3e4a06b4830 100644 --- a/test/config.json +++ b/test/config.json @@ -629,21 +629,6 @@ "Shard": "18", "Tags": [] }, - "tabletmanager_consul": { - "File": "unused.go", - "Packages": [ - "vitess.io/vitess/go/test/endtoend/tabletmanager" - ], - "Args": [ - "--topo-flavor=consul" - ], - "Command": [], - "Manual": false, - "Shard": "tabletmanager_consul", - "Tags": [ - "site_test" - ] - }, "tabletmanager_throttler_topo": { "File": "unused.go", "Packages": [ @@ -1505,19 +1490,6 @@ "Shard": "docker_cluster", "Tags": [] }, - "topo_consul": { - "File": "unused.go", - "Packages": [ - "vitess.io/vitess/go/test/endtoend/topotest/consul" - ], - "Args": [ - "--topo-flavor=consul" - ], - "Command": [], - "Manual": false, - "Shard": "vtgate_topo_consul", - "Tags": [] - }, "topo_etcd2": { "File": "unused.go", "Packages": [ diff --git a/test/templates/cluster_endtoend_test.tpl b/test/templates/cluster_endtoend_test.tpl index 49a3c924709..fb48c55f7ec 100644 --- a/test/templates/cluster_endtoend_test.tpl +++ b/test/templates/cluster_endtoend_test.tpl @@ -156,7 +156,7 @@ jobs: {{if .MakeTools}} - - name: Installing zookeeper and consul + - name: Installing zookeeper if: steps.changes.outputs.end_to_end == 'true' run: | make tools diff --git a/test/templates/cluster_endtoend_test_mysql57.tpl b/test/templates/cluster_endtoend_test_mysql57.tpl index 680c7ac23fa..b7b9bcb43c9 100644 --- a/test/templates/cluster_endtoend_test_mysql57.tpl +++ b/test/templates/cluster_endtoend_test_mysql57.tpl @@ -142,7 +142,7 @@ jobs: {{if .MakeTools}} - - name: Installing zookeeper and consul + - name: Installing zookeeper if: steps.changes.outputs.end_to_end == 'true' run: | make tools diff --git a/tools/dependency_check.sh b/tools/dependency_check.sh index 7d5179c1616..b74b1327462 100755 --- a/tools/dependency_check.sh +++ b/tools/dependency_check.sh @@ -1,13 +1,13 @@ #!/bin/bash # Copyright 2019 The Vitess Authors. -# +# # 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 -# +# # http://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. @@ -17,13 +17,13 @@ source build.env function fail() { - echo "ERROR: $1" - exit 1 + echo "ERROR: $1" + exit 1 } # These binaries are required to 'make test' # mysqld might be in /usr/sbin which will not be in the default PATH PATH="/usr/sbin:$PATH" -for binary in mysqld consul etcd etcdctl zksrv.sh javadoc mvn ant curl wget zip unzip; do - command -v "$binary" > /dev/null || fail "${binary} is not installed in PATH. See https://vitess.io/contributing/build-from-source for install instructions." -done; +for binary in mysqld etcd etcdctl zksrv.sh javadoc mvn ant curl wget zip unzip; do + command -v "$binary" >/dev/null || fail "${binary} is not installed in PATH. See https://vitess.io/contributing/build-from-source for install instructions." +done diff --git a/tools/remove_dependencies.sh b/tools/remove_dependencies.sh index f08bce4bb25..679157b8609 100755 --- a/tools/remove_dependencies.sh +++ b/tools/remove_dependencies.sh @@ -26,7 +26,6 @@ function fail() { } BUILD_JAVA=${BUILD_JAVA:-1} -BUILD_CONSUL=${BUILD_CONSUL:-1} UNAME=$(uname) ARCH=$(uname -m) @@ -90,19 +89,6 @@ uninstall_etcd() { fi } -uninstall_consul() { - echo "Removing consul..." - local dist="$1" - - if [ -f "$dist/consul" ]; then - unlink "$dist/consul" - rm -f "$VTROOT/bin/consul" - fi - if [[ "${dist##*/}" == "consul" ]]; then - rm -rf "$dist" - fi -} - uninstall_all() { echo "## local system details..." echo "## platform: $UNAME target:$ARCH OS: $OSTYPE" @@ -118,10 +104,6 @@ uninstall_all() { # etcd uninstall_etcd "$ETCD_VER" "$VTROOT/dist/etcd" - # consul - if [ "$BUILD_CONSUL" == 1 ]; then - uninstall_consul "$VTROOT/dist/consul" - fi } uninstall_all From d9d836b4aa17d8f5a01f9eb36cfed3e0b30d7013 Mon Sep 17 00:00:00 2001 From: Mohamed Hamza Date: Tue, 3 Feb 2026 12:51:06 -0500 Subject: [PATCH 2/2] go mod tidy Signed-off-by: Mohamed Hamza --- go.mod | 10 ---- go.sum | 143 --------------------------------------------------------- 2 files changed, 153 deletions(-) diff --git a/go.mod b/go.mod index f35ea2b40af..af7bbc96b79 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,6 @@ require ( github.com/Azure/azure-storage-blob-go v0.15.0 github.com/HdrHistogram/hdrhistogram-go v0.9.0 // indirect github.com/aquarapid/vaultlib v0.5.1 - github.com/armon/go-metrics v0.4.1 // indirect github.com/buger/jsonparser v1.1.1 github.com/cespare/xxhash/v2 v2.3.0 github.com/corpix/uarand v0.1.1 // indirect @@ -32,8 +31,6 @@ require ( github.com/gorilla/mux v1.8.1 github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 - github.com/hashicorp/go-immutable-radix v1.3.1 // indirect - github.com/hashicorp/serf v0.10.2 // indirect github.com/icrowley/fake v0.0.0-20180203215853-4178557ae428 github.com/klauspost/compress v1.18.3 github.com/klauspost/pgzip v1.2.6 @@ -145,7 +142,6 @@ require ( github.com/docker/go-units v0.5.0 // indirect github.com/go-ini/ini v1.67.0 // indirect github.com/godbus/dbus/v5 v5.1.0 // indirect - github.com/google/btree v1.1.3 // indirect github.com/google/pprof v0.0.0-20250820193118-f64d9cf942d6 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect @@ -225,13 +221,7 @@ require ( github.com/google/s2a-go v0.1.9 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.7 // indirect github.com/googleapis/gax-go/v2 v2.15.0 // indirect - github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-hclog v1.6.3 // indirect - github.com/hashicorp/go-metrics v0.5.4 // indirect - github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/hashicorp/go-rootcerts v1.0.2 // indirect - github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/lufia/plan9stats v0.0.0-20250827001030-24949be3fa54 // indirect github.com/mattn/go-colorable v0.1.14 // indirect diff --git a/go.sum b/go.sum index 8847654ef08..8ed7c80a86a 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,6 @@ cel.dev/expr v0.24.0 h1:56OvJKSH3hDGL0ml5uSxZmz3/3Pq4tJ+fb1unVLAFcY= cel.dev/expr v0.24.0/go.mod h1:hLPLo1W4QUmuYdA72RBX06QTs6MXw941piREPl3Yfiw= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.123.0 h1:2NAUJwPR47q+E35uaJeYoNhuNEM9kM8SjgRgdeOJUSE= cloud.google.com/go v0.123.0/go.mod h1:xBoMV08QcqUGuPW65Qfm1o9Y4zKZBpGS+7bImXLTAZU= cloud.google.com/go/auth v0.17.0 h1:74yCm7hCj2rUyyAocqnFzsAYXgJhrG26XCFimrc/Kz4= @@ -58,7 +57,6 @@ github.com/DataDog/datadog-agent/pkg/util/scrubber v0.70.2 h1:dM8yjDH0e1DLzh8sDi github.com/DataDog/datadog-agent/pkg/util/scrubber v0.70.2/go.mod h1:3b9n1n6Cs8RGjvvnn4xc4pE4JwtPb2SjMKwUgZ65XPw= github.com/DataDog/datadog-agent/pkg/version v0.70.2 h1:31BJbziYgvaJrUjhv33otDFi2O+Co+E8sWzFMYdE5fU= github.com/DataDog/datadog-agent/pkg/version v0.70.2/go.mod h1:XPERomJsscI4LZk5xVZ8O3fjmIg9gmEq08ixSi5wI3I= -github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/datadog-go/v5 v5.8.2 h1:9IEfH1Mw9AjWwhAMqCAkhbxjuJeMxm2ARX2VdgL+ols= github.com/DataDog/datadog-go/v5 v5.8.2/go.mod h1:K9kcYBlxkcPP8tvvjZZKs/m1edNAUFzBbdpTUKfCsuw= github.com/DataDog/dd-trace-go/v2 v2.3.0 h1:0Y5kx+Wbod0z8moY0vUbKl6OM0oIV4zAynsVmsq+XT8= @@ -95,15 +93,8 @@ github.com/Masterminds/vcs v1.13.0/go.mod h1:N09YCmOQr6RLxC6UNHzuVwAdodYbbnycGHS github.com/Microsoft/go-winio v0.5.0/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/aquarapid/vaultlib v0.5.1 h1:vuLWR6bZzLHybjJBSUYPgZlIp6KZ+SXeHLRRYTuk6d4= github.com/aquarapid/vaultlib v0.5.1/go.mod h1:yT7AlEXtuabkxylOc/+Ulyp18tff1+QjgNLTnFWTlOs= -github.com/armon/go-metrics v0.4.1 h1:hR91U9KYmb6bLBYLQjyM+3j+rcd/UhE+G78SFnF8gJA= -github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= github.com/aws/aws-sdk-go-v2 v1.41.1 h1:ABlyEARCDLN034NhxlRUSZr4l71mh+T5KAeGh6cerhU= github.com/aws/aws-sdk-go-v2 v1.41.1/go.mod h1:MayyLB8y+buD9hZqkCW3kX1AKq07Y5pXxtgB+rRFhz0= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.4 h1:489krEF9xIGkOaaX3CE/Be2uWjiXrkCH6gUX+bZA/BU= @@ -145,8 +136,6 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.41.6/go.mod h1:qgFDZQSD/Kys7nJnVqYlW github.com/aws/smithy-go v1.24.0 h1:LpilSUItNPFr1eY85RYgTIg5eIEPtvFbskaFcmmIUnk= github.com/aws/smithy-go v1.24.0/go.mod h1:LEj2LM3rBRQJxPZTB4KuzZkaZYnZPnvgIhb4pu07mx0= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bitfield/gotestdox v0.2.2 h1:x6RcPAbBbErKLnapz1QeAlf3ospg8efBsedU93CDsnE= @@ -165,8 +154,6 @@ github.com/cihub/seelog v0.0.0-20170130134532-f561c5e57575 h1:kHaBemcxl8o/pQ5VM1 github.com/cihub/seelog v0.0.0-20170130134532-f561c5e57575/go.mod h1:9d6lWj8KzO/fd/NrVaLscBKmPigpZpn5YawRPw+e3Yo= github.com/cilium/ebpf v0.19.0 h1:Ro/rE64RmFBeA9FGjcTc+KmCeY6jXmryu6FfnzPRIao= github.com/cilium/ebpf v0.19.0/go.mod h1:fLCgMo3l8tZmAdM3B2XqdFzXBpwkcSTroaVqN08OWVY= -github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= -github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/clipperhouse/displaywidth v0.6.2 h1:ZDpTkFfpHOKte4RG5O/BOyf3ysnvFswpyYrV7z2uAKo= github.com/clipperhouse/displaywidth v0.6.2/go.mod h1:R+kHuzaYWFkTm7xoMmK1lFydbci4X2CicfbGstSGg0o= @@ -232,7 +219,6 @@ github.com/envoyproxy/go-control-plane/ratelimit v0.1.0/go.mod h1:Wk+tMFAFbCXaJP github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v1.2.1 h1:DEo3O99U8j4hBFwbJfrz9VtgcDfUKS7KJ7spH3d86P8= github.com/envoyproxy/protoc-gen-validate v1.2.1/go.mod h1:d/C80l/jxXLdfEIhX1W2TmLfsJ31lvEjwamM4DxlWXU= -github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= @@ -249,11 +235,7 @@ github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A= github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= github.com/go-jose/go-jose/v4 v4.1.2 h1:TK/7NqRQZfgAh+Td8AlsrvtPoUyiHh0LqVvokh+1vHI= github.com/go-jose/go-jose/v4 v4.1.2/go.mod h1:22cg9HWM1pOlnRiY+9cQYJ9XHmya1bYW8OeDM6Ku6Oo= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= @@ -272,7 +254,6 @@ github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPE github.com/go-viper/mapstructure/v2 v2.5.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -283,28 +264,13 @@ github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+Licev github.com/golang/mock v1.7.0-rc.1 h1:YojYx61/OLFsiv6Rw1Z96LpldJIy31o+UHmwAUMJ6/U= github.com/golang/mock v1.7.0-rc.1/go.mod h1:s42URUywIqd+OcERslBJvOjepvNymP31m3q8d/GkuRs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/snappy v1.0.0 h1:Oy607GVXHs7RtbggtPBnr2RmDArIsAefDwvrdWvRhGs= github.com/golang/snappy v1.0.0/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= -github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/go-containerregistry v0.20.7 h1:24VGNpS0IwrOZ2ms2P1QE3Xa5X9p4phx0aUgzYzHW6I= @@ -337,60 +303,24 @@ github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDa github.com/grpc-ecosystem/go-grpc-middleware v1.4.0/go.mod h1:g5qyo/la0ALbONm6Vbp88Yd8NsDy6rZz+RcrMPxvld8= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= -github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= -github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= -github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= -github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-metrics v0.5.4 h1:8mmPiIJkTPPEbAiV97IxdAGNdRdaWwVap1BU6elejKY= -github.com/hashicorp/go-metrics v0.5.4/go.mod h1:CG5yz4NZ/AI/aQt9Ucm/vdBnbh7fvmv4lxZ350i+QQI= -github.com/hashicorp/go-msgpack v0.5.5 h1:i9R9JSrqIz0QVLz3sz+i3YJdT7TTSLcfLLzJi9aZTuI= -github.com/hashicorp/go-msgpack/v2 v2.1.2 h1:4Ee8FTp834e+ewB71RDrQ0VKpyFdrKOjvYtnQ/ltVj0= -github.com/hashicorp/go-msgpack/v2 v2.1.2/go.mod h1:upybraOAblm4S7rx0+jeNy+CWWhzywQsSRV5033mMu4= -github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= -github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= -github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc= -github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= -github.com/hashicorp/go-sockaddr v1.0.7 h1:G+pTkSO01HpR5qCxg7lxfsFEZaG+C0VssTy/9dbT+Fw= -github.com/hashicorp/go-sockaddr v1.0.7/go.mod h1:FZQbEYa1pxkQ7WLpyXJ6cbjpT8q0YgQaK/JakXqGyWw= -github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= -github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.8.0 h1:KAkNb1HAiZd1ukkxDFGmokVZe1Xy9HG6NUp+bPle2i4= github.com/hashicorp/go-version v1.8.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= -github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= -github.com/hashicorp/memberlist v0.5.2 h1:rJoNPWZ0juJBgqn48gjy59K5H4rNgvUoM1kUD7bXiuI= -github.com/hashicorp/memberlist v0.5.2/go.mod h1:Ri9p/tRShbjYnpNf4FFPXG7wxEGY4Nrcn6E7jrVa//4= -github.com/hashicorp/serf v0.10.2 h1:m5IORhuNSjaxeljg5DeQVDlQyVkhRIjJDimbkCa8aAc= -github.com/hashicorp/serf v0.10.2/go.mod h1:T1CmSGfSeGfnfNy/w0odXQUR1rfECGd2Qdsp84DjOiY= github.com/icrowley/fake v0.0.0-20180203215853-4178557ae428 h1:Mo9W14pwbO9VfRe+ygqZ8dFbPpoIK1HFrG/zjTuQ+nc= github.com/icrowley/fake v0.0.0-20180203215853-4178557ae428/go.mod h1:uhpZMVGznybq1itEKXj6RYw9I71qK4kH+OGMjRC4KEo= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/josharian/native v1.1.0 h1:uuaP0hAbW7Y4l0ZRQ6C9zfb7Mg1mbFKry/xzDAfmtLA= github.com/josharian/native v1.1.0/go.mod h1:7X/raswPFr05uY3HiLlYeyQntB6OO7E/d2Cu7qoaN2w= -github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/jsimonetti/rtnetlink/v2 v2.0.1 h1:xda7qaHDSVOsADNouv7ukSuicKZO7GgVUCXxpaIEIlM= github.com/jsimonetti/rtnetlink/v2 v2.0.1/go.mod h1:7MoNYNbb3UaDHtF8udiJo/RH6VsTKP1pqKLUTVCvToE= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.18.3 h1:9PJRvfbmTabkOX8moIpXPbMMbYN60bWImDDU7L+/6zw= @@ -398,8 +328,6 @@ github.com/klauspost/compress v1.18.3/go.mod h1:R0h/fSBs8DE4ENlcrlib3PsXS61voFxh github.com/klauspost/pgzip v1.2.6 h1:8RXeL5crjEUFnR2/Sn6GJNWtSQ3Dk8pq4CL3jvdDyjU= github.com/klauspost/pgzip v1.2.6/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= @@ -412,26 +340,19 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0 github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lufia/plan9stats v0.0.0-20250827001030-24949be3fa54 h1:mFWunSatvkQQDhpdyuFAYwyAan3hzCuma+Pz8sqvOfg= github.com/lufia/plan9stats v0.0.0-20250827001030-24949be3fa54/go.mod h1:autxFIvghDt3jPTLoqZ9OZ7s9qTGNAWmYCjVFWPX/zg= -github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= github.com/mattn/go-ieproxy v0.0.1/go.mod h1:pYabZ6IHcRpFh7vIaLfK7rdcWgFEb3SFJ6/gNWuh88E= github.com/mattn/go-ieproxy v0.0.12 h1:OZkUFJC3ESNZPQ+6LzC3VJIFSnreeFLQyqvBWtvfL2M= github.com/mattn/go-ieproxy v0.0.12/go.mod h1:Vn+N61199DAnVeTgaF8eoB9PvLO8P3OBnG95ENh7B7c= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.19 h1:v++JhqYnZuu5jSKrk9RbgF5v4CGUjqRfBm05byFGLdw= github.com/mattn/go-runewidth v0.0.19/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mdlayher/netlink v1.7.2 h1:/UtM3ofJap7Vl4QWCPDGXY8d3GIY2UGSDbK+QWmY8/g= github.com/mdlayher/netlink v1.7.2/go.mod h1:xraEF7uJbxLhc5fpHL4cPe221LI2bdttWlU+ZGLfQSw= github.com/mdlayher/socket v0.4.1 h1:eM9y2/jlbs1M615oshPQOHZzj6R6wMT7bX5NPiQvn2U= github.com/mdlayher/socket v0.4.1/go.mod h1:cAqeGjoufqdxWkD7DkpyS+wcefOtmu5OQ8KuoJGIReA= -github.com/miekg/dns v1.1.56 h1:5imZaSeoRNvpM9SzWNhEcP9QliKiz20/dA2QabIGVnE= -github.com/miekg/dns v1.1.56/go.mod h1:cRm6Oo2C8TY9ZS/TqsSrseAcncm74lfK5G+ikN2SWWY= github.com/minio/minio-go v6.0.14+incompatible h1:fnV+GD28LeqdN6vT2XdGKW8Qe/IfjJDswNVuni6km9o= github.com/minio/minio-go v6.0.14+incompatible/go.mod h1:7guKYtitv8dktvNUGrhzmNlA5wrAABTQXCoesZdFQO8= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= @@ -439,15 +360,11 @@ github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrk github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee h1:W5t00kpgFdJifH4BDsTlE89Zl93FEloxaWZfGcifgq8= github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/ncruces/go-strftime v1.0.0 h1:HMFp8mLCTPp341M/ZnA4qaf7ZlsbTc+miZjCLOFAw7w= github.com/ncruces/go-strftime v1.0.0/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= github.com/ngdinhtoan/glide-cleanup v0.2.0/go.mod h1:UQzsmiDOb8YV3nOsCxK/c9zPpCZVNoHScRE3EO9pVMM= @@ -478,8 +395,6 @@ github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+ github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/outcaste-io/ristretto v0.2.3 h1:AK4zt/fJ76kjlYObOeNwh4T3asEuaCmp26pOvUOL9w0= github.com/outcaste-io/ristretto v0.2.3/go.mod h1:W8HywhmtlopSB1jeMg3JtdIhf+DYkLAr0VN/s4+MHac= -github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= -github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc= github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4= @@ -491,7 +406,6 @@ github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi github.com/pires/go-proxyproto v0.9.2 h1:H1UdHn695zUVVmB0lQ354lOWHOy6TZSpzBl3tgN0s1U= github.com/pires/go-proxyproto v0.9.2/go.mod h1:ZKAAyp3cgy5Y5Mo4n9AlScrkCZwUy0g3Jf+slqQVcuU= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -504,30 +418,13 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRI github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= github.com/prometheus/common v0.67.5 h1:pIgK94WWlQt1WLwAC5j2ynLaBRDiinoAb86HZHTUGI4= github.com/prometheus/common v0.67.5/go.mod h1:SjE/0MzDEEAyrdr5Gqc6G+sXI67maCxzaT3A2+HqjUw= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= -github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.17.0 h1:FuLQ+05u4ZI+SS/w9+BWEM2TXiHKsUQ9TADiRH7DuK0= github.com/prometheus/procfs v0.17.0/go.mod h1:oPQLaDAMRbA+u8H5Pbfq+dl3VDAvHxMUOVhe0wYB2zw= github.com/puzpuzpuz/xsync/v3 v3.5.1 h1:GJYJZwO6IdxN/IKbneznS6yPkVC+c3zyY/j19c++5Fg= @@ -543,15 +440,11 @@ github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sagikazarmark/locafero v0.12.0 h1:/NQhBAkUb4+fH1jivKHWusDYFjMOOKU88eegjfxfHb4= github.com/sagikazarmark/locafero v0.12.0/go.mod h1:sZh36u/YSZ918v0Io+U9ogLYQJ9tLLBmM4eneO6WwsI= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/secure-systems-lab/go-securesystemslib v0.9.1 h1:nZZaNz4DiERIQguNy0cL5qTdn9lR8XKHf4RUyG1Sx3g= github.com/secure-systems-lab/go-securesystemslib v0.9.1/go.mod h1:np53YzT0zXGMv6x4iEWc9Z59uR+x+ndLwCLqPYpLXVU= github.com/shirou/gopsutil/v4 v4.25.12 h1:e7PvW/0RmJ8p8vPGJH4jvNkOyLmbkXgXW4m6ZPic6CY= github.com/shirou/gopsutil/v4 v4.25.12/go.mod h1:EivAfP5x2EhLp2ovdpKSozecVXn1TmuG7SMzs/Wh4PU= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= @@ -587,7 +480,6 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= @@ -612,7 +504,6 @@ github.com/tklauser/go-sysconf v0.3.16 h1:frioLaCQSsF5Cy1jgRBrzr6t502KIIwQ0MArYI github.com/tklauser/go-sysconf v0.3.16/go.mod h1:/qNL9xxDhc7tx3HSRsLWNnuzbVfh3e7gh/BmM179nYI= github.com/tklauser/numcpus v0.11.0 h1:nSTwhKH5e1dMNsCdVBukSZrURJRoHbSEQjdEbY+9RXw= github.com/tklauser/numcpus v0.11.0/go.mod h1:z+LwcLq54uWZTX0u/bGobaV34u6V7KNlTZejzM6/3MQ= -github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/uber/jaeger-client-go v2.30.0+incompatible h1:D6wyKGCecFaSRUpo8lCVbaOOb6ThwMmTEbhRwtKR97o= github.com/uber/jaeger-client-go v2.30.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk= github.com/uber/jaeger-lib v2.4.1+incompatible h1:td4jdvLcExb4cBISKIpHuGoVXh+dVKhn2Um6rjCsSsg= @@ -723,7 +614,6 @@ go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -745,16 +635,12 @@ golang.org/x/mod v0.32.0 h1:9F4d3PHLljb6x//jOyokMv3eX+YDeepZSEo3mFJy93c= golang.org/x/mod v0.32.0/go.mod h1:SgipZ/3h2Ci89DlEtEXWUk/HteuRin+HHhN+WbNhguU= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191112182307-2180aed22343/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= @@ -762,35 +648,23 @@ golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o= golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.34.0 h1:hqK/t4AKgbqWkdkcAeI8XLmbK+4m4G5YeQRrmiotGlw= golang.org/x/oauth2 v0.34.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4= golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191112214154-59a1497f0cea/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -798,11 +672,7 @@ golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220627191245-f75cf1eec38b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -866,35 +736,22 @@ google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 h1:F29+wU6Ee6qgu9TddPgooOda google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1/go.mod h1:5KF+wpkbTSbGcR9zteSqZV6fqFOWBl4Yde8En8MryZA= google.golang.org/grpc/examples v0.0.0-20250407062114-b368379ef8f6 h1:ExN12ndbJ608cboPYflpTny6mXSzPrDLh0iTaVrRrds= google.golang.org/grpc/examples v0.0.0-20250407062114-b368379ef8f6/go.mod h1:6ytKWczdvnpnO+m+JiG9NjEDzR1FJfsnmJdG7B8QVZ8= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/DataDog/dd-trace-go.v1 v1.74.8 h1:h96ji92t9eXbPvSWhJ+lrPWetHiQNYlt48JKRO09NFA= gopkg.in/DataDog/dd-trace-go.v1 v1.74.8/go.mod h1:LpHbtHsCZBlm1HWrlVOUQcEXwMWZnU6yMvmtd1GvSDI= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d h1:TxyelI5cVkbREznMhfzycHdkp5cLA7DpE+GKjSslYhM= gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d/go.mod h1:cuepJuh7vyXfUyUwEgHQXw849cJrilpS5NeIjOWESAw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ldap.v2 v2.5.1 h1:wiu0okdNfjlBzg6UWvd1Hn8Y+Ux17/u/4nlk4CQr6tU= gopkg.in/ldap.v2 v2.5.1/go.mod h1:oI0cpe/D7HRtBQl8aTg+ZmzFUAvu4lsv3eLXMLGFxWk= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=