cli: enhance the cockroach connect command#60854
cli: enhance the cockroach connect command#60854craig[bot] merged 14 commits intocockroachdb:masterfrom
cockroach connect command#60854Conversation
5e3dc4e to
652c6de
Compare
itsbilal
left a comment
There was a problem hiding this comment.
Reviewed 5 of 5 files at r1, 5 of 5 files at r2.
Reviewable status:complete! 1 of 0 LGTMs obtained (waiting on @aaron-crl)
aaron-crl
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! 1 of 0 LGTMs obtained (waiting on @knz)
pkg/base/config.go, line 172 at r2 (raw file):
// InitToken is a shared initialization token for generating TLS certificates // across multiple nodes. InitToken string
Looks like this might clobber the InitToken in the Config struct. Is that ok?
|
pkg/base/config.go, line 172 at r2 (raw file): Previously, aaron-crl wrote…
That got moved to |
aaron-crl
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! 2 of 0 LGTMs obtained (waiting on @itsbilal)
pkg/base/config.go, line 172 at r2 (raw file):
Previously, itsbilal (Bilal Akhtar) wrote…
That got moved to
startCtxas it is probably a more appropriate place for it anyway.
Thanks! I missed that.
f451304 to
ffce3a9
Compare
cockroach connect command
aaron-crl
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! 1 of 0 LGTMs obtained (and 1 stale) (waiting on @itsbilal)
67e94ac to
c6c8909
Compare
…ands This PR ensures that the `connect` command recognizes the same networking configuration flags as `start`. It also makes the `start` command recognize the `--init-token` flag (although it currently does nothing yet). Release justification: bug fixes and low-risk updates to new functionality Release note: None
Release justification: bug fixes and low-risk updates to new functionality Release note: None
Release justification: bug fixes and low-risk updates to new functionality Release note: None
Prior to this commit, the cert generation code improperly passed the
value of the `--listen-addr` directly as SAN into the generated
certificates, and failed to populate the CN. This caused multiple
problems:
- the node certs were outright invalid: they require CN=node.
Also the UI cert require CN to be set to the advertised hostname.
Fixing this required extending the interfaces with a commonName
argument.
- all the certs had broken SANs: the addresses in the command line are
hostname + portnumber, but SANs must contain only hostnames. Fixing
this required splitting host/port again inside the init function.
- the SAN fields were invalid if the `--listen-addr` was left to its
default, which is an empty string.
To fix this requires opting into the semi-complicated dance
around configured / actual addresses, specifically the
sequence of the following 3 calls:
- `baseCfg.ValidateAddrs` - populates defaults, resolves numeric port
numbers.
- `server.ListenAndUpdateAddrs` - performs the `net.Listen` calls
and then back-propagates the actual listen address into the
Addr fields, then populates the `Advertise` addresses from
that if no advertise address was initially populated.
- use the resulting advertised addr to configure the SAN field for
each service.
Release justification: bug fixes and low-risk updates to new functionality
Release note: None
Release justification: low risk, high benefit changes to existing functionality Release note (cli change): The new `cockroach connect` command now recognizes `--single-node` to prepare a TLS configuration suitable for e.g. a subsequent `start-single-node` command. Additionally, the command checks that either `--single-node` is specified, or both `--init-token` and `--num-expected-peers`.
Release justification: low risk, high benefit changes to existing functionality Release note: None
Release justification: low risk, high benefit changes to existing functionality Release note: None
Release justification: low risk, high benefit changes to existing functionality Release note: None
This makes them look nicer in logging. Release justification: bug fixes and low-risk updates to new functionality Release note: None
This commit adds `context.Context` arguments in the right places and invokes logging to describe progress. Release justification: low risk, high benefit changes to existing functionality Release note: None
Release justification: bug fixes and low-risk updates to new functionality Release note: None
Release justification: non-production code changes Release note: None
Release justification: bug fixes and low-risk updates to new functionality Release note: None
…mmand Release justification: non-production code changes Release note: None
c6c8909 to
ac625de
Compare
|
TFYR! I even added a (preliminary) unit test using TCL that exercises the new bors r=aaron-crl,itsbilal |
|
Build succeeded: |
Puts pieces together for #60632.
See individual commits for details.
Release justification: low risk, high benefit changes to existing functionality