Skip to content

Commit

Permalink
roachprod: revert AdminUIPort back to DefaultAdminUIPort
Browse files Browse the repository at this point in the history
The change cockroachdb#114097 removed default port assumptions for SQLPort and AdminUIPort,
and instead finds open ports to assign. However, Prometheus scraping relies on
this hardcoded AdminUIPort as it can't discover the port itself.

This change temporarily reverts AdminUIPort back to the hardcoded port.

Release note: none
Epic: none
Informs: cockroachdb#117125
  • Loading branch information
DarrylWong committed Mar 7, 2024
1 parent e04fa2a commit 13f0b5c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions pkg/cmd/roachprod/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,8 @@ environment variables to the cockroach process.
install.EnvOption(nodeEnv),
install.NumRacksOption(numRacks),
}
// TODO(DarrylWong): remove once #117125 is addressed.
startOpts.AdminUIPort = 0

startOpts.Target = install.StartSharedProcessForVirtualCluster
if externalProcessNodes != "" {
Expand Down
8 changes: 6 additions & 2 deletions pkg/roachprod/install/cockroach.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,13 +344,17 @@ func (c *SyncedCluster) Start(ctx context.Context, l *logger.Logger, startOpts S
if startOpts.Target == StartRoutingProxy {
return fmt.Errorf("start SQL proxy not implemented")
}

// Local clusters do not support specifying ports. An error is returned if we
// detect that they were set.
if c.IsLocal() && (startOpts.SQLPort != 0 || startOpts.AdminUIPort != 0) {
if c.IsLocal() {
// We don't need to return an error if the ports are the default values
// specified in DefaultStartOps, as these have not been specified explicitly
// by the user.
if startOpts.SQLPort != config.DefaultSQLPort || startOpts.AdminUIPort != config.DefaultAdminUIPort {
if startOpts.SQLPort != 0 && startOpts.SQLPort != config.DefaultSQLPort {
return fmt.Errorf("local clusters do not support specifying ports")
}
if startOpts.AdminUIPort != 0 && startOpts.AdminUIPort != config.DefaultAdminUIPort {
return fmt.Errorf("local clusters do not support specifying ports")
}
startOpts.SQLPort = 0
Expand Down
3 changes: 2 additions & 1 deletion pkg/roachprod/roachprod.go
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,8 @@ func DefaultStartOpts() install.StartOpts {
InitTarget: 1,
SQLPort: 0,
VirtualClusterName: install.SystemInterfaceName,
AdminUIPort: 0,
// TODO(DarrylWong): revert back to 0 once #117125 is addressed.
AdminUIPort: config.DefaultAdminUIPort,
}
}

Expand Down

0 comments on commit 13f0b5c

Please sign in to comment.