Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scripts: add drtprod wrapper for managing drt clusters #120056

Merged
merged 1 commit into from
Mar 10, 2024

Conversation

dt
Copy link
Member

@dt dt commented Mar 7, 2024

Release note: none.
Epic: none.

@dt dt requested review from itsbilal and herkolategan March 7, 2024 15:47
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@renatolabs
Copy link
Contributor

The commit message could indicate why we need the wrapper instead of exporting the env vars locally; I also find bin (a gitignored directory) an unusual choice for the location, especially since we already have scripts/ for this purpose.

@dt
Copy link
Member Author

dt commented Mar 8, 2024

why we need the wrapper instead of exporting the env vars locally

I think it is likely that someone will forget one of the vars -- and we do have to pass both and maybe more to come -- or accidentally pass it when they do not mean to (e.g. one reason we want a separate project is to prevent destroy --mine getting run here, but if bash history that passes the var is floating around that becomes possible). I'd prefer to have a pre-canned "this is how you mess with the long-lived DRT clusters" the is uniform across engineering, rather than everyone rolling their own aliases/combos of vars.

bin an unusual choice for the location, ... scripts/ for this purpose.

We put roachprod in bin when dev builds it, and this is essentially an alternative version of roachprod for managing drt clusters rather than roachrod clusters. If, instead of configuring via env vars I'd chosen to have a go wrapper around cmd/roachprod that overrode a few package vars and spit out a binary, that would go in bin, not scripts.

I'm fine moving it to scripts though and updating my PATH if that seems preferred.

@renatolabs
Copy link
Contributor

Thanks for explaining.

Re: location, the scripts folder already has a number of scripts that could be described in the same way (wrappers for other binaries that would live in bin if they were Go packages compiled by dev), and I don't see a strong reason for this script in particular to break that convention.

But it's pretty inconsequential so if I'm the only one of this opinion, it's fine.

@dt
Copy link
Member Author

dt commented Mar 8, 2024

I've moved it to scripts/ and added commentary to the file explaining why it exists.

While I'm here, I've also expanded the script slightly to validate arguments match the requirements for DRT (secure mode and static ports), which I think helps show the value of the wrapper.

Release note: none.
Epic: none.
@dt dt changed the title bin/drtprod: add wrapper for managing drt clusters scripts: add drtprod wrapper for managing drt clusters Mar 8, 2024
echo "--secure is required when starting DRT clusters"
exit 1
fi
if [[ "$*" != *"--sql-port 26257"* ]]; then
Copy link
Collaborator

@herkolategan herkolategan Mar 8, 2024

Choose a reason for hiding this comment

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

Thanks for adding this, I added some additional checks in roachprod to prevent using DNS/services on clusters that do not support it. See #120141
Once that is merged the logic here will hopefully not be necessary anymore.

@dt
Copy link
Member Author

dt commented Mar 10, 2024

TFTR!

bors r+

@craig
Copy link
Contributor

craig bot commented Mar 10, 2024

Build succeeded:

@craig craig bot merged commit 41da9ec into cockroachdb:master Mar 10, 2024
15 of 19 checks passed
@dt dt deleted the drtprod branch March 13, 2024 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants