-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
cli: Support cluster name flags in all non-sql client commands #48000
Conversation
Thank you for contributing to CockroachDB. Please ensure you have followed the guidelines for creating a PR. My owl senses detect your PR is good for review. Please keep an eye out for any test failures in CI. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan. |
Thanks Alex! Happy to hear from you :-) The functionality was intending to have clients call GRPCUnvalidatedDial which disables both cluster ID and name check. I am surprised this didn't work / wasn't tested. I'll review your PR shortly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I understand what's going on and actually yes this was intended to work the way you fix it. Sorry this part of the functionality slipped under the radar.
Reviewed 2 of 2 files at r1.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @a-robinson)
pkg/cli/flags.go, line 625 at r1 (raw file):
VarFlag(f, urlParser{cmd, &cliCtx, true /* strictSSL */}, cliflags.URL) VarFlag(f, clusterNameSetter{&baseCfg.ClusterName}, cliflags.ClusterName) BoolFlag(f, &baseCfg.DisableClusterNameVerification, cliflags.DisableClusterNameVerification, false)
try this:
BoolFlag(f, &baseCfg.DisableClusterNameVerification, cliflags.DisableClusterNameVerification, baseCfg.DisableClusterNameVerification)
Then initialize baseCfg.DisableClusterNameVerification
in context.go
.
Fully agreed. Feel free to issue the backport PRs (but I can also do it if you prefer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @a-robinson)
pkg/cli/flags.go, line 625 at r1 (raw file):
Previously, knz (kena) wrote…
try this:
BoolFlag(f, &baseCfg.DisableClusterNameVerification, cliflags.DisableClusterNameVerification, baseCfg.DisableClusterNameVerification)Then initialize
baseCfg.DisableClusterNameVerification
incontext.go
.
oh actually the default is already set in baseCfg.InitiDefaults()
so no need to change anything in context.go. But still change the last argument to BoolFlag
, we don't want defaults expressed in multiple places.
Unless I'm missing something, the cluster-name functionality is pretty broken without the ability to use all the various client commands on clusters that have a name. I was trying out some new features today and couldn't figure out any supported way to do basic operations on a node that was using a cluster-name. It seemed easy enough to fix, so here we are. I'm not at all tied to to including both the --cluster-name and --disable-cluster-name-verification flags, but at first glance it seemed useful to include both. I didn't include any error cases in the tcl test because I didn't want to have to figure out the correct tcl for dealing with the fact that the commands hang in a seemingly infinite retry loop when the cluster-name is missing/incorrect. Fixes cockroachdb#40437 Release note (cli change): Client commands such as init and quit now support the --cluster-name and --disable-cluster-name-verification flags in order to support running them on clusters that have been configured to use a cluster name. Previously it was impossible to run such commands against nodes configured with the --cluster-name flag.
4eb5a68
to
be8966d
Compare
Thank you for updating your pull request. My owl senses detect your PR is good for review. Please keep an eye out for any test failures in CI. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @knz)
pkg/cli/flags.go, line 625 at r1 (raw file):
Previously, knz (kena) wrote…
oh actually the default is already set in
baseCfg.InitiDefaults()
so no need to change anything in context.go. But still change the last argument toBoolFlag
, we don't want defaults expressed in multiple places.
No problem, done. I changed the existing start
/start-single-node
flag to use it as well.
#48016 and #48017, although I had to make them manually since |
bors r+ |
Build succeeded |
Unless I'm missing something, the cluster-name functionality is pretty
broken without the ability to use all the various client commands on
clusters that have a name. I was trying out some new features today and
couldn't figure out any supported way to do basic operations on a node
that was using a cluster-name. It seemed easy enough to fix, so here we
are.
I'm not at all tied to to including both the --cluster-name and
--disable-cluster-name-verification flags, but at first glance it seemed
useful to include both.
I didn't include any error cases in the tcl test because I didn't want
to have to figure out the correct tcl for dealing with the fact that the
commands hang in a seemingly infinite retry loop when the cluster-name
is missing/incorrect.
Fixes #40437
Release note (cli change): Client commands such as init and quit now
support the --cluster-name and --disable-cluster-name-verification flags
in order to support running them on clusters that have been configured
to use a cluster name. Previously it was impossible to run such
commands against nodes configured with the --cluster-name flag.
Hi @knz!
This seems like a strong cherry-pick candidate for a 20.1.x patch release (and maybe even a 19.2.x release) since the
--cluster-name
flag is a basically a trap for anyone trying to use it without this fix, but I'd also wager that it's not considered particularly urgent for 20.1.0 given that @rolandcrosby's ticket has gone unfixed since last September.