Skip to content

Commit 1ad16dc

Browse files
[release-0.1] adding retry for kourier install (#61)
* adding retry for kourier install * increasing retries and delay between retries Co-authored-by: Paul S. Schweigert <[email protected]>
1 parent 68e93c4 commit 1ad16dc

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

pkg/install/install.go

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,19 @@ func Kourier() error {
3333
fmt.Println("Starting Networking layer install...")
3434

3535
kourier := exec.Command("kubectl", "apply", "-f", "https://github.com/knative-sandbox/net-kourier/releases/download/v"+kourierVersion+"/kourier.yaml")
36-
if err := wait.PollImmediate(1*time.Second, 10*time.Second, func() (bool, error) {
37-
return runCommand(kourier) == nil, nil
38-
}); err != nil {
39-
return fmt.Errorf("wait: %w", err)
36+
// retries installing kourier if it fails, see discussion in:
37+
// https://github.com/knative-sandbox/kn-plugin-quickstart/pull/58
38+
for i := 0; i <= 3; i++ {
39+
if err := wait.PollImmediate(1*time.Second, 10*time.Second, func() (bool, error) {
40+
return runCommand(kourier) == nil, nil
41+
}); err != nil {
42+
if i >= 3 {
43+
return fmt.Errorf("wait: %w", err)
44+
}
45+
time.Sleep(10 * time.Second)
46+
} else {
47+
break
48+
}
4049
}
4150

4251
kourierWait := exec.Command("kubectl", "wait", "pod", "--timeout=-1s", "--for=condition=Ready", "-l", "!job-name", "-n", "kourier-system")

0 commit comments

Comments
 (0)