Skip to content

Upgrade github.com/hashicorp/consul/api to v2#20351

Open
chimanjain wants to merge 1 commit into
vitessio:mainfrom
chimanjain:upgrade-consul-v2
Open

Upgrade github.com/hashicorp/consul/api to v2#20351
chimanjain wants to merge 1 commit into
vitessio:mainfrom
chimanjain:upgrade-consul-v2

Conversation

@chimanjain

@chimanjain chimanjain commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Description

  • Upgrade github.com/hashicorp/consul/api to v2.

Checklist

  • "Backport to:" labels have been added if this change should be back-ported to release branches
  • If this change is to be back-ported to previous releases, a justification is included in the PR description
  • Tests were added or are not required
  • Did the new or modified tests pass consistently locally and on CI?
  • Documentation was added or is not required

Signed-off-by: Chiman Jain <chimanjain15@gmail.com>
Copilot AI review requested due to automatic review settings June 18, 2026 05:29
@github-actions github-actions Bot added this to the v25.0.0 milestone Jun 18, 2026
@vitess-bot vitess-bot Bot added NeedsWebsiteDocsUpdate What it says NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsIssue A linked issue is missing for this Pull Request NeedsBackportReason If backport labels have been applied to a PR, a justification is required labels Jun 18, 2026
@vitess-bot

vitess-bot Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Review Checklist

Hello reviewers! 👋 Please follow this checklist when reviewing this Pull Request.

General

  • Ensure that the Pull Request has a descriptive title.
  • Ensure there is a link to an issue (except for internal cleanup and flaky test fixes), new features should have an RFC that documents use cases and test cases.

Tests

  • Bug fixes should have at least one unit or end-to-end test, enhancement and new features should have a sufficient number of tests.

Documentation

  • Apply the release notes (needs details) label if users need to know about this change.
  • New features should be documented.
  • There should be some code comments as to why things are implemented the way they are.
  • There should be a comment at the top of each new or modified test to explain what the test does.

New flags

  • Is this flag really necessary?
  • Flag names must be clear and intuitive, use dashes (-), and have a clear help text.

If a workflow is added or modified:

  • Each item in Jobs should be named in order to mark it as required.
  • If the workflow needs to be marked as required, the maintainer team must be notified.

Backward compatibility

  • Protobuf changes should be wire-compatible.
  • Changes to _vt tables and RPCs need to be backward compatible.
  • RPC changes should be compatible with vitess-operator
  • If a flag is removed, then it should also be removed from vitess-operator and arewefastyet, if used there.
  • vtctl command output order should be stable and awk-able.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Human review recommended

This is a major-version dependency upgrade, and I can’t validate API/behavior compatibility without CI or build/test evidence in this review context.

Pull request overview

Upgrades Vitess’s Consul client dependency to the new Go module major version (github.com/hashicorp/consul/api/v2) and updates internal import paths accordingly so the code continues to build against the v2 module path.

Changes:

  • Switched all Consul API imports from github.com/hashicorp/consul/api to github.com/hashicorp/consul/api/v2.
  • Updated go.mod to require github.com/hashicorp/consul/api/v2 v2.0.0.
  • Updated go.sum to reflect the new Consul API and SDK v2 checksums.
File summaries
File Description
go/vt/vtadmin/cluster/discovery/discovery_consul.go Updates Consul API import to the v2 module path for vtadmin discovery.
go/vt/vtadmin/cluster/discovery/discovery_consul_test.go Updates Consul API import to the v2 module path for discovery tests.
go/vt/topo/consultopo/watch.go Updates Consul API import to the v2 module path for topo watch functionality.
go/vt/topo/consultopo/server.go Updates Consul API import to the v2 module path for the Consul-backed topo server.
go/vt/topo/consultopo/server_flaky_test.go Updates Consul API import to the v2 module path for consultopo tests.
go/vt/topo/consultopo/lock.go Updates Consul API import to the v2 module path for consul-based locking.
go/vt/topo/consultopo/file.go Updates Consul API import to the v2 module path for consultopo file operations.
go/vt/topo/consultopo/election.go Updates Consul API import to the v2 module path for consul-based leader election.
go/cmd/vttestserver/cli/main_test.go Updates Consul API import to the v2 module path for vttestserver CLI tests.
go.mod Bumps the Consul API dependency to github.com/hashicorp/consul/api/v2 v2.0.0.
go.sum Updates dependency checksums for Consul API v2 (and related Consul SDK v2).

Copilot's findings

  • Files reviewed: 10/11 changed files
  • Comments generated: 0

Note

Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.

@timvaillancourt timvaillancourt added Component: General Changes throughout the code base and removed NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsWebsiteDocsUpdate What it says NeedsBackportReason If backport labels have been applied to a PR, a justification is required NeedsIssue A linked issue is missing for this Pull Request labels Jun 18, 2026
@codecov

codecov Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.44%. Comparing base (70c7a72) to head (271703d).
⚠️ Report is 343 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (70c7a72) and HEAD (271703d). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (70c7a72) HEAD (271703d)
1 0
Additional details and impacted files
@@             Coverage Diff             @@
##             main   #20351       +/-   ##
===========================================
- Coverage   69.67%   64.44%    -5.23%     
===========================================
  Files        1614       14     -1600     
  Lines      216793      917   -215876     
===========================================
- Hits       151044      591   -150453     
+ Misses      65749      326    -65423     
Flag Coverage Δ
partial 64.44% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@timvaillancourt

Copy link
Copy Markdown
Contributor

Thanks for tackling this @chimanjain! 🎉

I checked our e2e coverage and we do exercise a real consul server in tests (via topo_consul, tabletmanager_consul, and the backup tests) — though CONSUL_VER in build.env is pinned to 1.11.4 from back in 2022.

Honestly, CI passing on a 4-year-old server is a nice signal that the v2 client still talks to older servers fine, so that's reassuring backward-compat coverage on its own 👍

That said, while we're in here let's also bump CONSUL_VER to 1.22.7 (latest 1.x) in this same PR so we exercise the v2 client against a modern server too. The bump needs:

  1. Updating CONSUL_VER in build.env
  2. Updating the 4 x sha256 lines in bootstrap.sh install_consul()
  3. Re-uploading the binaries to the Vitess resources mirror — ping a maintainer for help with this part

Thanks again! 🙏

@chimanjain

Copy link
Copy Markdown
Contributor Author

thanks @timvaillancourt for the review and pointing out the outdated consul versions. Can the maintainers please Re-upload the binaries to the Vitess resources mirror and share the sha. I can update it in the PR or if it needs more work in the backend, we can address in another PR. Please share your thoughts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: General Changes throughout the code base Component: Topology Component: VTAdmin VTadmin interface Type: Dependencies Dependency updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants