Skip to content

Commit 010544f

Browse files
committed
evaluate kops-version-marker after the build is complete instead of init
1 parent 9982e0f commit 010544f

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

tests/e2e/kubetest2-kops/deployer/common.go

-10
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,12 @@ import (
2020
"errors"
2121
"fmt"
2222
"os"
23-
"path"
2423
"path/filepath"
2524
"strings"
2625
"time"
2726

2827
"k8s.io/klog/v2"
2928
"k8s.io/kops/tests/e2e/kubetest2-kops/gce"
30-
"k8s.io/kops/tests/e2e/pkg/kops"
3129
"k8s.io/kops/tests/e2e/pkg/target"
3230
"k8s.io/kops/tests/e2e/pkg/util"
3331
"sigs.k8s.io/kubetest2/pkg/boskos"
@@ -51,14 +49,6 @@ func (d *deployer) initialize() error {
5149
return fmt.Errorf("init failed to check up flags: %v", err)
5250
}
5351
}
54-
if d.KopsVersionMarker != "" {
55-
d.KopsBinaryPath = path.Join(d.commonOptions.RunDir(), "kops")
56-
baseURL, err := kops.DownloadKops(d.KopsVersionMarker, d.KopsBinaryPath)
57-
if err != nil {
58-
return fmt.Errorf("init failed to download kops from url: %v", err)
59-
}
60-
d.KopsBaseURL = baseURL
61-
}
6252

6353
switch d.CloudProvider {
6454
case "aws":

tests/e2e/kubetest2-kops/deployer/up.go

+12
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"errors"
2121
"fmt"
2222
osexec "os/exec"
23+
"path"
2324
"strings"
2425
"time"
2526

@@ -41,6 +42,17 @@ func (d *deployer) Up() error {
4142
return err
4243
}
4344

45+
// kops is fetched when --up is called instead of init to support a scenario where k/k is being built
46+
// and a kops build is not ready yet
47+
if d.KopsVersionMarker != "" {
48+
d.KopsBinaryPath = path.Join(d.commonOptions.RunDir(), "kops")
49+
baseURL, err := kops.DownloadKops(d.KopsVersionMarker, d.KopsBinaryPath)
50+
if err != nil {
51+
return fmt.Errorf("init failed to download kops from url: %v", err)
52+
}
53+
d.KopsBaseURL = baseURL
54+
}
55+
4456
if d.terraform == nil {
4557
klog.Info("Cleaning up any leaked resources from previous cluster")
4658
// Intentionally ignore errors:

0 commit comments

Comments
 (0)