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