func waitReady()

in cmd/cloudshell_open/deploy.go [213:234]


func waitReady(project, name, region string) error {
	wait := time.Minute * 4
	deadline := time.Now().Add(wait)
	for time.Now().Before(deadline) {
		svc, err := getService(project, name, region)
		if err != nil {
			return fmt.Errorf("failed to query Service for readiness: %w", err)
		}

		for _, cond := range svc.Status.Conditions {
			if cond.Type == "Ready" {
				if cond.Status == "True" {
					return nil
				} else if cond.Status == "False" {
					return fmt.Errorf("reason=%s message=%s", cond.Reason, cond.Message)
				}
			}
		}
		time.Sleep(time.Second * 2)
	}
	return fmt.Errorf("the service did not become ready in %s, check Cloud Console for logs to see why it failed", wait)
}