Skip to content

Commit

Permalink
Envoy polling will create a log line
Browse files Browse the repository at this point in the history
  • Loading branch information
Lin Meyer authored and jvasallo committed Oct 5, 2020
1 parent 0dcf70f commit cee80fd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,22 +196,25 @@ func waitForEnvoy() context.Context {

func pollEnvoy(ctx context.Context, cancel context.CancelFunc) {
url := fmt.Sprintf("%s/server_info", config.EnvoyAdminAPI)

pollCount := 0
b := backoff.NewExponentialBackOff()
// We wait forever for envoy to start. In practice k8s will kill the pod if we take too long.
b.MaxElapsedTime = config.WaitForEnvoyTimeout

_ = backoff.Retry(func() error {
pollCount++
rsp := typhon.NewRequest(ctx, "GET", url, nil).Send().Response()

info := &ServerInfo{}

err := rsp.Decode(info)
if err != nil {
log(fmt.Sprintf("Polling Envoy (%d), error: %s", pollCount, err))
return err
}

if info.State != "LIVE" {
log(fmt.Sprintf("Polling Envoy (%d), status: Not ready yet", pollCount))
return errors.New("not live yet")
}

Expand Down

0 comments on commit cee80fd

Please sign in to comment.