diff --git a/internal/daemon/worker/status.go b/internal/daemon/worker/status.go index cc55a762e1..64453f99a7 100644 --- a/internal/daemon/worker/status.go +++ b/internal/daemon/worker/status.go @@ -16,6 +16,7 @@ import ( pb "github.com/hashicorp/boundary/internal/gen/controller/servers" pbs "github.com/hashicorp/boundary/internal/gen/controller/servers/services" "github.com/hashicorp/boundary/internal/server" + "github.com/hashicorp/boundary/sdk/pbs/plugin" "github.com/hashicorp/boundary/version" "github.com/hashicorp/go-secure-stdlib/parseutil" "github.com/hashicorp/go-secure-stdlib/strutil" @@ -197,25 +198,31 @@ func (w *Worker) sendWorkerStatus(cancelCtx context.Context, sessionManager sess event.WriteError(cancelCtx, op, errors.New("worker name and keyId are both empty; at least one is needed to identify a worker"), event.WithInfoMsg("error making status request to controller")) } - // If the local storage state is unknown, and we have recording storage set, get the state from the recording storage - // and set it on the worker. This is done once to ensure that the worker has the correct state for the first status - // call. - if w.localStorageState.Load() == server.UnknownLocalStorageState && w.RecordingStorage != nil { - w.localStorageState.Store(w.RecordingStorage.GetLocalStorageState(cancelCtx)) + + var storageBucketCredentialStates map[string]*plugin.StorageBucketCredentialState + if w.RecordingStorage != nil { + storageBucketCredentialStates = w.RecordingStorage.GetStorageBucketCredentialStates() + // If the local storage state is unknown, and we have recording storage set, get the state from the recording storage + // and set it on the worker. This is done once to ensure that the worker has the correct state for the first status + // call. + if w.localStorageState.Load() == server.UnknownLocalStorageState { + w.localStorageState.Store(w.RecordingStorage.GetLocalStorageState(cancelCtx)) + } } versionInfo := version.Get() connectionState := w.downstreamConnManager.Connected() result, err := client.Status(statusCtx, &pbs.StatusRequest{ Jobs: activeJobs, WorkerStatus: &pb.ServerWorkerStatus{ - Name: w.conf.RawConfig.Worker.Name, - Description: w.conf.RawConfig.Worker.Description, - Address: w.conf.RawConfig.Worker.PublicAddr, - Tags: tags, - KeyId: keyId, - ReleaseVersion: versionInfo.FullVersionNumber(false), - OperationalState: w.operationalState.Load().(server.OperationalState).String(), - LocalStorageState: w.localStorageState.Load().(server.LocalStorageState).String(), + Name: w.conf.RawConfig.Worker.Name, + Description: w.conf.RawConfig.Worker.Description, + Address: w.conf.RawConfig.Worker.PublicAddr, + Tags: tags, + KeyId: keyId, + ReleaseVersion: versionInfo.FullVersionNumber(false), + OperationalState: w.operationalState.Load().(server.OperationalState).String(), + LocalStorageState: w.localStorageState.Load().(server.LocalStorageState).String(), + StorageBucketCredentialStates: storageBucketCredentialStates, }, ConnectedWorkerKeyIdentifiers: connectionState.AllKeyIds(), ConnectedUnmappedWorkerKeyIdentifiers: connectionState.UnmappedKeyIds(),