@@ -24,6 +24,7 @@ import (
24
24
"path/filepath"
25
25
"strings"
26
26
"time"
27
+ "strconv"
27
28
28
29
apierrors "k8s.io/apimachinery/pkg/api/errors"
29
30
@@ -205,18 +206,20 @@ func DeployAppToWorkloadClusterAndWaitForDeploymentReady(ctx context.Context, wo
205
206
func DownloadFromAppInWorkloadCluster (ctx context.Context , workloadKubeconfigPath string , appName string , port int , path string ) (string , error ) {
206
207
runArgs := []string {
207
208
// Required by below: container name is runArg zero.
208
- "dummy" , "-i" , "--restart=Never" , "--image=dockerqa/curl:ubuntu-trusty " , "--command" , "--" , "curl" , "--silent" , "--show-error" , fmt .Sprintf ("%s:%d%s" , appName , port , path ),
209
+ "dummy" , "-i" , "--restart=Never" , "--image=gcr.io/cloud-builders/curl " , "--command" , "--" , "curl" , "--silent" , "--show-error" , fmt .Sprintf ("%s:%d%s" , appName , port , path ),
209
210
}
210
211
var result , err = KubectlExec (ctx , "run" , workloadKubeconfigPath , runArgs ... )
211
212
if err != nil {
212
213
return result , err
213
214
}
214
- if result == "" {
215
+ numRetries := 3
216
+ for result == "" && numRetries > 0 {
215
217
// A single retry to accommodate occasional cases where an empty string is returned, ostensibly
216
218
// because the service isn't fully ready. Subsequent requests have always worked.
217
- fmt .Println ("Retrying html download" )
219
+ numRetries --
220
+ fmt .Println ("Retrying html download. Number of retries remaining:" , numRetries )
218
221
time .Sleep (5 * time .Second )
219
- runArgs [0 ] = "dummy2" // Assumed: container name is runArg zero.
222
+ runArgs [0 ] = "dummy" + strconv . Itoa ( numRetries ) // Assumed: container name is runArg zero.
220
223
result , err = KubectlExec (ctx , "run" , workloadKubeconfigPath , runArgs ... )
221
224
}
222
225
return result , err
@@ -232,7 +235,7 @@ func DownloadMetricsFromCAPCManager(ctx context.Context, bootstrapKubeconfigPath
232
235
233
236
// Scrape the metrics from the service
234
237
runArgs = []string {
235
- "-i" , "--restart=Never" , "dummy" , "--image=dockerqa/curl:ubuntu-trusty " , "--command" , "--" , "curl" , "--silent" , "capc-controller-manager-metrics.capc-system:8080/metrics" ,
238
+ "-i" , "--restart=Never" , "dummy" , "--image=gcr.io/cloud-builders/curl " , "--command" , "--" , "curl" , "--silent" , "capc-controller-manager-metrics.capc-system:8080/metrics" ,
236
239
}
237
240
result , err := KubectlExec (ctx , "run" , bootstrapKubeconfigPath , runArgs ... )
238
241
Ω (err ).ShouldNot (HaveOccurred ())
0 commit comments