From ed9f2b2730c14e37247a287933a92cc9b5ad7810 Mon Sep 17 00:00:00 2001 From: Irena Rindos Date: Tue, 31 Jan 2023 15:53:11 -0500 Subject: [PATCH] bug(workers): Check initial upstreams for an HCBP environment (#2869) --- internal/daemon/worker/status.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/daemon/worker/status.go b/internal/daemon/worker/status.go index e3dc26e1c..3abc242ac 100644 --- a/internal/daemon/worker/status.go +++ b/internal/daemon/worker/status.go @@ -23,6 +23,8 @@ var firstStatusCheckPostHooks []func(context.Context, *Worker) error var downstreamWorkersFactory func(ctx context.Context, workerId string, ver string) (downstreamers, error) +var checkHCPBUpstreams func(w *Worker) bool + type LastStatusInformation struct { *pbs.StatusResponse StatusTime time.Time @@ -256,7 +258,7 @@ func (w *Worker) sendWorkerStatus(cancelCtx context.Context, sessionManager sess for _, v := range result.CalculatedUpstreams { addrs = append(addrs, v.Address) } - } else if w.conf.RawConfig.HcpbClusterId != "" && len(w.conf.RawConfig.Worker.InitialUpstreams) == 0 { + } else if checkHCPBUpstreams != nil && checkHCPBUpstreams(w) { // This is a worker that is one hop away from managed workers, so attempt to get that list hcpbWorkersCtx, hcpbWorkersCancel := context.WithTimeout(cancelCtx, time.Duration(w.statusCallTimeoutDuration.Load())) defer hcpbWorkersCancel()