feat(cli): allow specifying name of provisioner daemon (#11077)

- Adds a --name argument to provisionerd start
- Plumbs through name to integrated and external provisioners
- Defaults to hostname if not specified for external, hostname-N for integrated
- Adds cliutil.Hostname
This commit is contained in:
Cian Johnston
2023-12-07 16:59:13 +00:00
committed by GitHub
parent 8aea6040c8
commit 1e349f0d50
16 changed files with 170 additions and 22 deletions
+2 -5
View File
@@ -7,7 +7,6 @@ import (
"fmt"
"net/http"
"net/url"
"os"
"reflect"
"regexp"
"strings"
@@ -27,6 +26,7 @@ import (
"cdr.dev/slog"
"github.com/coder/coder/v2/buildinfo"
"github.com/coder/coder/v2/cli/cliutil"
"github.com/coder/coder/v2/coderd"
"github.com/coder/coder/v2/coderd/httpapi"
"github.com/coder/coder/v2/coderd/httpmw"
@@ -206,10 +206,7 @@ func New(ctx context.Context, opts *Options) (*Server, error) {
// Register the workspace proxy with the primary coderd instance and start a
// goroutine to periodically re-register.
replicaID := uuid.New()
osHostname, err := os.Hostname()
if err != nil {
return nil, xerrors.Errorf("get OS hostname: %w", err)
}
osHostname := cliutil.Hostname()
regResp, registerDone, err := client.RegisterWorkspaceProxyLoop(ctx, wsproxysdk.RegisterWorkspaceProxyLoopOpts{
Logger: opts.Logger,
Request: wsproxysdk.RegisterWorkspaceProxyRequest{