@@ -63,6 +63,9 @@ type RunInput struct {
63
63
KubernetesVersion string
64
64
// ConformanceImage is an optional field to specify an exact conformance image
65
65
ConformanceImage string
66
+ // KubeTestRepoListPath is optional file for specifying custom image repositories
67
+ // https://github.com/kubernetes/kubernetes/blob/master/test/images/README.md#testing-the-new-image
68
+ KubeTestRepoListPath string
66
69
}
67
70
68
71
// Run executes kube-test given an artifact directory, and sets settings
@@ -118,6 +121,14 @@ func Run(ctx context.Context, input RunInput) error {
118
121
return err
119
122
}
120
123
124
+ var testRepoListVolumeArgs []string
125
+ if input .KubeTestRepoListPath != "" {
126
+ testRepoListVolumeArgs , err = buildKubeTestRepoListArgs (kubetestConfigDir , input .ClusterProxy .GetKubeconfigPath ())
127
+ if err != nil {
128
+ return err
129
+ }
130
+ }
131
+
121
132
e2eVars := map [string ]string {
122
133
"kubeconfig" : "/tmp/kubeconfig" ,
123
134
"provider" : "skeleton" ,
@@ -142,7 +153,11 @@ func Run(ctx context.Context, input RunInput) error {
142
153
}
143
154
userArg := user .Uid + ":" + user .Gid
144
155
networkArg := "--network=kind"
145
- e2eCmd := exec .Command ("docker" , "run" , "--user" , userArg , kubeConfigVolumeMount , outputVolumeMount , viperVolumeMount , "-t" , networkArg , input .ConformanceImage )
156
+ e2eCmd := exec .Command ("docker" , "run" , "--user" , userArg , kubeConfigVolumeMount , outputVolumeMount , viperVolumeMount , "-t" , networkArg )
157
+ if len (testRepoListVolumeArgs ) > 0 {
158
+ e2eCmd .Args = append (e2eCmd .Args , testRepoListVolumeArgs ... )
159
+ }
160
+ e2eCmd .Args = append (e2eCmd .Args , input .ConformanceImage )
146
161
e2eCmd .Args = append (e2eCmd .Args , "/usr/local/bin/ginkgo" )
147
162
e2eCmd .Args = append (e2eCmd .Args , ginkgoArgs ... )
148
163
e2eCmd .Args = append (e2eCmd .Args , "/usr/local/bin/e2e.test" )
@@ -220,6 +235,11 @@ func volumeArg(src, dest string) string {
220
235
return volumeArg
221
236
}
222
237
238
+ func envArg (key , value string ) string {
239
+ envArg := "-e" + key + "=" + value
240
+ return envArg
241
+ }
242
+
223
243
func versionToConformanceImage (kubernetesVersion string ) string {
224
244
k8sVersion := strings .ReplaceAll (kubernetesVersion , "+" , "_" )
225
245
if isUsingCIArtifactsVersion (kubernetesVersion ) {
@@ -238,3 +258,16 @@ func buildArgs(kv map[string]string, flagMarker string) []string {
238
258
}
239
259
return args
240
260
}
261
+
262
+ func buildKubeTestRepoListArgs (kubeTestRepoListPath , kubetestConfigDir string ) ([]string , error ) {
263
+ args := make ([]string , 2 )
264
+
265
+ tmpKubeTestRepoListPath := path .Join (kubetestConfigDir , "repo_list.yaml" )
266
+ if err := copyFile (kubeTestRepoListPath , tmpKubeTestRepoListPath ); err != nil {
267
+ return nil , err
268
+ }
269
+ dest := "/tmp/repo_list.yaml"
270
+ args [0 ] = envArg ("KUBE_TEST_REPO_LIST" , dest )
271
+ args [1 ] = volumeArg (tmpKubeTestRepoListPath , dest )
272
+ return args , nil
273
+ }
0 commit comments