@@ -16,6 +16,7 @@ import (
16
16
. "github.com/onsi/gomega"
17
17
corev1 "k8s.io/api/core/v1"
18
18
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
19
+ "k8s.io/apimachinery/pkg/runtime"
19
20
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
20
21
clusterctlv1 "sigs.k8s.io/cluster-api/cmd/clusterctl/api/v1alpha3"
21
22
"sigs.k8s.io/cluster-api/cmd/clusterctl/client/config"
@@ -88,13 +89,10 @@ func pivoting(ctx context.Context, inputGetter func() PivotingInput) {
88
89
}
89
90
90
91
By ("Fetch manifest for bootstrap cluster before pivot" )
91
- kconfigPathBootstrap := input .BootstrapClusterProxy .GetKubeconfigPath ()
92
- os .Setenv ("KUBECONFIG_BOOTSTRAP" , kconfigPathBootstrap )
93
- path := filepath .Join (os .Getenv ("CAPM3PATH" ), "scripts" )
94
- cmd := exec .Command ("./fetch_manifests.sh" ) // #nosec G204:gosec
95
- cmd .Dir = path
96
- _ = cmd .Run ()
97
-
92
+ err = FetchManifests (input .BootstrapClusterProxy , "/tmp/manifests/" )
93
+ if err != nil {
94
+ fmt .Printf ("Error fetching manifests for bootstrap cluster before pivot: %v\n " , err )
95
+ }
98
96
By ("Fetch target cluster kubeconfig for target cluster log collection" )
99
97
kconfigPathWorkload := input .TargetCluster .GetKubeconfigPath ()
100
98
os .Setenv ("KUBECONFIG_WORKLOAD" , kconfigPathWorkload )
@@ -103,7 +101,7 @@ func pivoting(ctx context.Context, inputGetter func() PivotingInput) {
103
101
// target log collection. There is possibility to handle the kubeconfig in better way.
104
102
// KubeconfigPathTemp will be used by project-infra target log collection only incase of failed e2e test
105
103
kubeconfigPathTemp := "/tmp/kubeconfig-test1.yaml"
106
- cmd = exec .Command ("cp" , kconfigPathWorkload , kubeconfigPathTemp ) // #nosec G204:gosec
104
+ cmd : = exec .Command ("cp" , kconfigPathWorkload , kubeconfigPathTemp ) // #nosec G204:gosec
107
105
stdoutStderr , er := cmd .CombinedOutput ()
108
106
Logf ("%s\n " , stdoutStderr )
109
107
Expect (er ).ToNot (HaveOccurred (), "Cannot fetch target cluster kubeconfig" )
@@ -436,10 +434,11 @@ func rePivoting(ctx context.Context, inputGetter func() RePivotingInput) {
436
434
}
437
435
438
436
By ("Fetch manifest for workload cluster after pivot" )
439
- path := filepath .Join (os .Getenv ("CAPM3PATH" ), "scripts" )
440
- cmd := exec .Command ("./fetch_manifests.sh" ) // #nosec G204:gosec
441
- cmd .Dir = path
442
- _ = cmd .Run ()
437
+ workloadClusterProxy := framework .NewClusterProxy ("workload-cluster-after-pivot" , os .Getenv ("KUBECONFIG" ), runtime .NewScheme ())
438
+ err = FetchManifests (workloadClusterProxy , "/tmp/manifests/" )
439
+ if err != nil {
440
+ fmt .Printf ("Error fetching manifests for workload cluster after pivot: %v\n " , err )
441
+ }
443
442
os .Unsetenv ("KUBECONFIG_WORKLOAD" )
444
443
445
444
By ("Remove Ironic deployment from target cluster" )
@@ -563,10 +562,10 @@ func rePivoting(ctx context.Context, inputGetter func() RePivotingInput) {
563
562
})
564
563
565
564
By ("Fetch manifest for bootstrap cluster after re-pivot" )
566
- path = filepath . Join ( os . Getenv ( "CAPM3PATH" ) , "scripts " )
567
- cmd = exec . Command ( "./fetch_manifests.sh" ) // #nosec G204:gosec
568
- cmd . Dir = path
569
- _ = cmd . Run ()
565
+ err = FetchManifests ( input . BootstrapClusterProxy , "/tmp/manifests/ " )
566
+ if err != nil {
567
+ fmt . Printf ( "Error fetching manifests for bootstrap cluster before pivot: %v \n " , err )
568
+ }
570
569
os .Unsetenv ("KUBECONFIG_BOOTSTRAP" )
571
570
572
571
By ("RE-PIVOTING TEST PASSED!" )
0 commit comments