fixup! feat(worker): Map cluster ID in config to upstream address

This commit is contained in:
irenarindos committed 2022-06-09 16:39:20 -04:00
1 parent 3aa7d11419
commit 256498d40f
4 files changed
+20 -46

No files matched your search

+4 -4
View File
@@ -4,7 +4,6 @@ import (
"context"
stderrors "errors"
"fmt"
"github.com/hashicorp/go-uuid"
"net"
"os"
"os/signal"
@@ -33,6 +32,7 @@ import (
"github.com/hashicorp/go-secure-stdlib/mlock"
"github.com/hashicorp/go-secure-stdlib/parseutil"
"github.com/hashicorp/go-secure-stdlib/pluginutil/v2"
"github.com/hashicorp/go-uuid"
"github.com/mitchellh/cli"
"github.com/posener/complete"
"go.uber.org/atomic"
@@ -332,10 +332,10 @@ func (c *Command) Run(args []string) int {
}
}
if c.Config.Worker.HCPBClusterId != "" {
_, err := uuid.ParseUUID(c.Config.Worker.HCPBClusterId)
if c.Config.HCPBClusterId != "" {
_, err := uuid.ParseUUID(c.Config.HCPBClusterId)
if err != nil {
c.UI.Error(fmt.Errorf("Invalid HCPB cluster id %q: %w", c.Config.Worker.HCPBClusterId, err).Error())
c.UI.Error(fmt.Errorf("Invalid HCPB cluster id %q: %w", c.Config.HCPBClusterId, err).Error())
return base.CommandUserError
}
}
+3 -3
View File
@@ -124,6 +124,9 @@ type Config struct {
// Plugin-related options
Plugins Plugins `hcl:"plugins"`
// Internal field for use with HCP deployments. Used if controllers/ initial_upstreams is not set
HCPBClusterId string `hcl:"hcp_boundary_cluster_id"`
}
type Controller struct {
@@ -198,9 +201,6 @@ type Worker struct {
// AuthStoragePath represents the location a worker stores its node credentials, if set
AuthStoragePath string `hcl:"auth_storage_path"`
// Internal field for use with HCP deployments. Will be used if controllers/ initial_upstreams is not set
HCPBClusterId string `hcl:"hcp_boundary_cluster_id"`
}
func (w *Worker) InitNameIfEmpty() (string, error) {