@@ -31,6 +31,7 @@ import (
31
31
"github.com/onsi/ginkgo/v2"
32
32
"github.com/pkg/errors"
33
33
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
34
+ "k8s.io/apimachinery/pkg/util/rand"
34
35
"k8s.io/client-go/discovery"
35
36
"k8s.io/client-go/tools/clientcmd"
36
37
"sigs.k8s.io/yaml"
@@ -73,6 +74,8 @@ type RunInput struct {
73
74
// KubeTestRepoListPath is optional file for specifying custom image repositories
74
75
// https://github.com/kubernetes/kubernetes/blob/master/test/images/README.md#testing-the-new-image
75
76
KubeTestRepoListPath string
77
+ // ClusterName is the name of the cluster to run the test at
78
+ ClusterName string
76
79
}
77
80
78
81
// Run executes kube-test given an artifact directory, and sets settings
@@ -82,6 +85,12 @@ func Run(ctx context.Context, input RunInput) error {
82
85
if input .ClusterProxy == nil {
83
86
return errors .New ("ClusterProxy must be provided" )
84
87
}
88
+ // If input.ClusterName is not set use a random string to allow parallel execution
89
+ // of kubetest on different clusters.
90
+ if input .ClusterName == "" {
91
+ input .ClusterName = rand .String (10 )
92
+ }
93
+
85
94
if input .GinkgoNodes == 0 {
86
95
input .GinkgoNodes = DefaultGinkgoNodes
87
96
}
@@ -103,7 +112,7 @@ func Run(ctx context.Context, input RunInput) error {
103
112
input .KubernetesVersion = discoveredVersion
104
113
}
105
114
input .ArtifactsDirectory = framework .ResolveArtifactsDirectory (input .ArtifactsDirectory )
106
- reportDir := path .Join (input .ArtifactsDirectory , "kubetest" )
115
+ reportDir := path .Join (input .ArtifactsDirectory , "kubetest" , input . ClusterName )
107
116
outputDir := path .Join (reportDir , "e2e-output" )
108
117
kubetestConfigDir := path .Join (reportDir , "config" )
109
118
if err := os .MkdirAll (outputDir , 0o750 ); err != nil {
@@ -133,7 +142,7 @@ func Run(ctx context.Context, input RunInput) error {
133
142
"report-dir" : "/output" ,
134
143
"e2e-output-dir" : "/output/e2e-output" ,
135
144
"dump-logs-on-failure" : "false" ,
136
- "report-prefix" : "kubetest." ,
145
+ "report-prefix" : fmt . Sprintf ( "kubetest.%s." , input . ClusterName ) ,
137
146
"num-nodes" : strconv .FormatInt (int64 (input .NumberOfNodes ), 10 ),
138
147
}
139
148
ginkgoArgs := buildArgs (ginkgoVars , "-" )
0 commit comments