@@ -168,11 +168,17 @@ func Test_ParseConfigMapToLocalService(t *testing.T) {
168
168
},
169
169
{
170
170
name : "good string data" ,
171
- arg : & corev1.ConfigMap {Data : map [string ]string {"localService" : " registryRepo: ' temp-registry.daocloud.io:5000' \ n filesRepo: 'http://temp-registry.daocloud.io:9000'\n yumRepo:\n - 'http://temp-registry.daocloud.io:9000/kubean/centos-iso/\\ $releasever/os/\\ $basearch'\n - 'http://temp-registry.daocloud.io:9000/centos/\\ $releasever/os/\\ $basearch'\n hostsMap:\n - domain: temp-registry.daocloud.io\n address: 'a.b.c.d'" }},
171
+ arg : & corev1.ConfigMap {Data : map [string ]string {"localService" : " imageRepo: \n kubeImageRepo: \" temp-registry.daocloud.io:5000/registry.k8s.io \" \ n gcrImageRepo: \" temp-registry.daocloud.io:5000/gcr.io \" \n githubImageRepo: \" a \" \n dockerImageRepo: \" b \" \n quayImageRepo: \" c \" \n filesRepo: 'http://temp-registry.daocloud.io:9000'\n yumRepo:\n - 'http://temp-registry.daocloud.io:9000/kubean/centos-iso/\\ $releasever/os/\\ $basearch'\n - 'http://temp-registry.daocloud.io:9000/centos/\\ $releasever/os/\\ $basearch'\n hostsMap:\n - domain: temp-registry.daocloud.io\n address: 'a.b.c.d'\n " }},
172
172
want : & manifestv1alpha1.LocalService {
173
- RegistryRepo : "temp-registry.daocloud.io:5000" ,
174
- FilesRepo : "http://temp-registry.daocloud.io:9000" ,
175
- YumRepo : []string {"http://temp-registry.daocloud.io:9000/kubean/centos-iso/\\ $releasever/os/\\ $basearch" , "http://temp-registry.daocloud.io:9000/centos/\\ $releasever/os/\\ $basearch" },
173
+ ImageRepo : map [manifestv1alpha1.ImageRepoType ]string {
174
+ "kubeImageRepo" : "temp-registry.daocloud.io:5000/registry.k8s.io" ,
175
+ "gcrImageRepo" : "temp-registry.daocloud.io:5000/gcr.io" ,
176
+ "githubImageRepo" : "a" ,
177
+ "dockerImageRepo" : "b" ,
178
+ "quayImageRepo" : "c" ,
179
+ },
180
+ FilesRepo : "http://temp-registry.daocloud.io:9000" ,
181
+ YumRepo : []string {"http://temp-registry.daocloud.io:9000/kubean/centos-iso/\\ $releasever/os/\\ $basearch" , "http://temp-registry.daocloud.io:9000/centos/\\ $releasever/os/\\ $basearch" },
176
182
HostsMap : []* manifestv1alpha1.HostsMap {
177
183
{Domain : "temp-registry.daocloud.io" , Address : "a.b.c.d" },
178
184
},
@@ -308,17 +314,23 @@ func Test_UpdateGlobalLocalService1(t *testing.T) {
308
314
Name : LocalServiceConfigMap ,
309
315
Namespace : "default" ,
310
316
},
311
- Data : map [string ]string {"localService" : " registryRepo: ' temp-registry.daocloud.io:5000' \n filesRepo: 'http://temp-registry.daocloud.io:9000'\n yumRepo:\n - 'http://temp-registry.daocloud.io:9000/kubean/centos-iso/\\ $releasever/os/\\ $basearch'\n - 'http://temp-registry.daocloud.io:9000/centos/\\ $releasever/os/\\ $basearch'\n hostsMap: \n - domain: temp-registry.daocloud.io\n address: 'a.b.c.d'" },
317
+ Data : map [string ]string {"localService" : " imageRepo: \n kubeImageRepo: \" temp-registry.daocloud.io:5000/registry.k8s.io \" \n gcrImageRepo: \" temp-registry.daocloud.io:5000/gcr.io \" \n githubImageRepo: \" a \" \n dockerImageRepo: \" b \" \n quayImageRepo: \" c \" \n filesRepo: 'http://temp-registry.daocloud.io:9000'\n yumRepo:\n - 'http://temp-registry.daocloud.io:9000/kubean/centos-iso/\\ $releasever/os/\\ $basearch'\n - 'http://temp-registry.daocloud.io:9000/centos/\\ $releasever/os/\\ $basearch'\n hostsMap: \n - domain: temp-registry.daocloud.io\n address: 'a.b.c.d'" },
312
318
}
313
319
controller .ClientSet .CoreV1 ().ConfigMaps ("default" ).Create (context .Background (), configMap , metav1.CreateOptions {})
314
320
controller .Create (context .Background (), global )
315
321
controller .InfoManifestClientSet .KubeanV1alpha1 ().Manifests ().Create (context .Background (), global , metav1.CreateOptions {})
316
322
controller .UpdateGlobalLocalService ()
317
323
},
318
324
want : manifestv1alpha1.LocalService {
319
- RegistryRepo : "temp-registry.daocloud.io:5000" ,
320
- FilesRepo : "http://temp-registry.daocloud.io:9000" ,
321
- YumRepo : []string {"http://temp-registry.daocloud.io:9000/kubean/centos-iso/\\ $releasever/os/\\ $basearch" , "http://temp-registry.daocloud.io:9000/centos/\\ $releasever/os/\\ $basearch" },
325
+ ImageRepo : map [manifestv1alpha1.ImageRepoType ]string {
326
+ "kubeImageRepo" : "temp-registry.daocloud.io:5000/registry.k8s.io" ,
327
+ "gcrImageRepo" : "temp-registry.daocloud.io:5000/gcr.io" ,
328
+ "githubImageRepo" : "a" ,
329
+ "dockerImageRepo" : "b" ,
330
+ "quayImageRepo" : "c" ,
331
+ },
332
+ FilesRepo : "http://temp-registry.daocloud.io:9000" ,
333
+ YumRepo : []string {"http://temp-registry.daocloud.io:9000/kubean/centos-iso/\\ $releasever/os/\\ $basearch" , "http://temp-registry.daocloud.io:9000/centos/\\ $releasever/os/\\ $basearch" },
322
334
HostsMap : []* manifestv1alpha1.HostsMap {
323
335
{
324
336
Domain : "temp-registry.daocloud.io" ,
@@ -348,17 +360,23 @@ func Test_UpdateGlobalLocalService1(t *testing.T) {
348
360
Name : LocalServiceConfigMap ,
349
361
Namespace : "default" ,
350
362
},
351
- Data : map [string ]string {"localService" : " registryRepo: ' temp-registry.daocloud.io:5000' \n filesRepo: 'http://temp-registry.daocloud.io:9000'\n yumRepo:\n - 'http://temp-registry.daocloud.io:9000/kubean/centos-iso/\\ $releasever/os/\\ $basearch'\n - 'http://temp-registry.daocloud.io:9000/centos/\\ $releasever/os/\\ $basearch'\n hostsMap: \n - domain: temp-registry.daocloud.io\n address: 'a.b.c.d1'" },
363
+ Data : map [string ]string {"localService" : " imageRepo: \n kubeImageRepo: \" temp-registry.daocloud.io:5000/registry.k8s.io \" \n gcrImageRepo: \" temp-registry.daocloud.io:5000/gcr.io \" \n githubImageRepo: \" a \" \n dockerImageRepo: \" b \" \n quayImageRepo: \" c \" \n filesRepo: 'http://temp-registry.daocloud.io:9000'\n yumRepo:\n - 'http://temp-registry.daocloud.io:9000/kubean/centos-iso/\\ $releasever/os/\\ $basearch'\n - 'http://temp-registry.daocloud.io:9000/centos/\\ $releasever/os/\\ $basearch'\n hostsMap: \n - domain: temp-registry.daocloud.io\n address: 'a.b.c.d1'" },
352
364
}
353
365
controller .ClientSet .CoreV1 ().ConfigMaps ("default" ).Update (context .Background (), configMap , metav1.UpdateOptions {})
354
366
controller .Create (context .Background (), global )
355
367
controller .InfoManifestClientSet .KubeanV1alpha1 ().Manifests ().Create (context .Background (), global , metav1.CreateOptions {})
356
368
controller .UpdateGlobalLocalService ()
357
369
},
358
370
want : manifestv1alpha1.LocalService {
359
- RegistryRepo : "temp-registry.daocloud.io:5000" ,
360
- FilesRepo : "http://temp-registry.daocloud.io:9000" ,
361
- YumRepo : []string {"http://temp-registry.daocloud.io:9000/kubean/centos-iso/\\ $releasever/os/\\ $basearch" , "http://temp-registry.daocloud.io:9000/centos/\\ $releasever/os/\\ $basearch" },
371
+ ImageRepo : map [manifestv1alpha1.ImageRepoType ]string {
372
+ "kubeImageRepo" : "temp-registry.daocloud.io:5000/registry.k8s.io" ,
373
+ "gcrImageRepo" : "temp-registry.daocloud.io:5000/gcr.io" ,
374
+ "githubImageRepo" : "a" ,
375
+ "dockerImageRepo" : "b" ,
376
+ "quayImageRepo" : "c" ,
377
+ },
378
+ FilesRepo : "http://temp-registry.daocloud.io:9000" ,
379
+ YumRepo : []string {"http://temp-registry.daocloud.io:9000/kubean/centos-iso/\\ $releasever/os/\\ $basearch" , "http://temp-registry.daocloud.io:9000/centos/\\ $releasever/os/\\ $basearch" },
362
380
HostsMap : []* manifestv1alpha1.HostsMap {
363
381
{
364
382
Domain : "temp-registry.daocloud.io" ,
@@ -429,15 +447,18 @@ func Test_UpdateLocalAvailableImage(t *testing.T) {
429
447
Labels : map [string ]string {OriginLabel : "v2" },
430
448
},
431
449
Spec : manifestv1alpha1.Spec {
432
- LocalService : manifestv1alpha1.LocalService {RegistryRepo : "abc.io" },
450
+ LocalService : manifestv1alpha1.LocalService {ImageRepo : map [manifestv1alpha1.ImageRepoType ]string {
451
+ "dockerImageRepo" : "abc.io" ,
452
+ "githubImageRepo" : "ghcr.io" ,
453
+ }},
433
454
KubeanVersion : "123456" ,
434
455
},
435
456
}
436
457
controller .Update (context .Background (), global )
437
458
controller .InfoManifestClientSet .KubeanV1alpha1 ().Manifests ().Update (context .Background (), global , metav1.UpdateOptions {})
438
459
controller .UpdateLocalAvailableImage ()
439
460
},
440
- want : "abc .io/kubean-io/spray-job:123456" ,
461
+ want : "ghcr .io/kubean-io/spray-job:123456" ,
441
462
},
442
463
}
443
464
0 commit comments