diff --git a/internal/outpost/ak/api.go b/internal/outpost/ak/api.go index 57757b2e2a..2def064273 100644 --- a/internal/outpost/ak/api.go +++ b/internal/outpost/ak/api.go @@ -77,11 +77,17 @@ func NewAPIController(akURL url.URL, token string) *APIController { // Because we don't know the outpost UUID, we simply do a list and pick the first // The service account this token belongs to should only have access to a single outpost - outposts, _, err := apiClient.OutpostsApi.OutpostsInstancesList(context.Background()).Execute() - if err != nil { + var outposts *api.PaginatedOutpostList + var err error + for { + outposts, _, err = apiClient.OutpostsApi.OutpostsInstancesList(context.Background()).Execute() + + if err == nil { + break + } + log.WithError(err).Error("Failed to fetch outpost configuration, retrying in 3 seconds") time.Sleep(time.Second * 3) - return NewAPIController(akURL, token) } if len(outposts.Results) < 1 { panic("No outposts found with given token, ensure the given token corresponds to an authenitk Outpost")