1 parent
55259029f1
commit
a030c15403
3 files changed
+15
-8
No files matched your search
@@ -335,9 +335,17 @@ func (c *Command) Run(args []string) int {
|
||||
}
|
||||
|
||||
if c.Config.HcpbClusterId != "" {
|
||||
_, err := uuid.ParseUUID(c.Config.HcpbClusterId)
|
||||
if len(c.Config.Worker.InitialUpstreams) > 0 {
|
||||
c.UI.Error(fmt.Errorf("Initial upstreams and HCPB cluster ID are mutually exclusive fields").Error())
|
||||
return base.CommandUserError
|
||||
}
|
||||
clusterId := c.Config.HcpbClusterId
|
||||
if strings.HasPrefix(clusterId, "int-") {
|
||||
clusterId = strings.TrimPrefix(clusterId, "int-")
|
||||
}
|
||||
_, err := uuid.ParseUUID(clusterId)
|
||||
if err != nil {
|
||||
c.UI.Error(fmt.Errorf("Invalid HCP Boundary cluster id %q: %w", c.Config.HcpbClusterId, err).Error())
|
||||
c.UI.Error(fmt.Errorf("Invalid HCP Boundary cluster ID %q: %w", clusterId, err).Error())
|
||||
return base.CommandUserError
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ import (
|
||||
"google.golang.org/protobuf/types/known/structpb"
|
||||
)
|
||||
|
||||
const hcpbUrlSuffix = ".proxy.boundary.hashicorp.cloud:9202"
|
||||
var HandleHcpbClusterId func(s string) string
|
||||
|
||||
// StartControllerConnections starts up the resolver and initiates controller
|
||||
// connection client creation
|
||||
@@ -60,8 +60,8 @@ func (w *Worker) StartControllerConnections() error {
|
||||
}
|
||||
|
||||
if len(initialAddrs) == 0 {
|
||||
if w.conf.RawConfig.HcpbClusterId != "" {
|
||||
clusterAddress := fmt.Sprintf("%s%s", w.conf.RawConfig.HcpbClusterId, hcpbUrlSuffix)
|
||||
if w.conf.RawConfig.HcpbClusterId != "" && HandleHcpbClusterId != nil {
|
||||
clusterAddress := HandleHcpbClusterId(w.conf.RawConfig.HcpbClusterId)
|
||||
initialAddrs = append(initialAddrs, clusterAddress)
|
||||
event.WriteSysEvent(w.baseContext, op, fmt.Sprintf("Setting HCP Boundary cluster address %s as upstream address", clusterAddress))
|
||||
} else {
|
||||
|
||||
@@ -218,9 +218,8 @@ func (w *Worker) sendWorkerStatus(cancelCtx context.Context, sessionManager sess
|
||||
|
||||
if len(w.conf.RawConfig.Worker.InitialUpstreams) > 0 {
|
||||
addrs = append(addrs, w.conf.RawConfig.Worker.InitialUpstreams...)
|
||||
}
|
||||
if len(w.conf.RawConfig.HcpbClusterId) > 0 {
|
||||
clusterAddress := fmt.Sprintf("%s%s", w.conf.RawConfig.HcpbClusterId, hcpbUrlSuffix)
|
||||
} else if HandleHcpbClusterId != nil && len(w.conf.RawConfig.HcpbClusterId) > 0 {
|
||||
clusterAddress := HandleHcpbClusterId(w.conf.RawConfig.HcpbClusterId)
|
||||
addrs = append(addrs, clusterAddress)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user