@@ -26,7 +26,7 @@ const (
26
26
etcdBackup = "{\" apiVersion\" :\" apiextensions.k8s.io/v1beta1\" ,\" kind\" :\" CustomResourceDefinition\" ,\" metadata\" :{\" name\" :\" etcdbackups.etcd.database.coreos.com\" },\" spec\" :{\" group\" :\" etcd.database.coreos.com\" ,\" names\" :{\" kind\" :\" EtcdBackup\" ,\" listKind\" :\" EtcdBackupList\" ,\" plural\" :\" etcdbackups\" ,\" singular\" :\" etcdbackup\" },\" scope\" :\" Namespaced\" ,\" version\" :\" v1beta2\" }}"
27
27
etcdCluster = "{\" apiVersion\" :\" apiextensions.k8s.io/v1beta1\" ,\" kind\" :\" CustomResourceDefinition\" ,\" metadata\" :{\" name\" :\" etcdclusters.etcd.database.coreos.com\" },\" spec\" :{\" group\" :\" etcd.database.coreos.com\" ,\" names\" :{\" kind\" :\" EtcdCluster\" ,\" listKind\" :\" EtcdClusterList\" ,\" plural\" :\" etcdclusters\" ,\" shortNames\" :[\" etcdclus\" ,\" etcd\" ],\" singular\" :\" etcdcluster\" },\" scope\" :\" Namespaced\" ,\" version\" :\" v1beta2\" }}"
28
28
etcdRestore = "{\" apiVersion\" :\" apiextensions.k8s.io/v1beta1\" ,\" kind\" :\" CustomResourceDefinition\" ,\" metadata\" :{\" name\" :\" etcdrestores.etcd.database.coreos.com\" },\" spec\" :{\" group\" :\" etcd.database.coreos.com\" ,\" names\" :{\" kind\" :\" EtcdRestore\" ,\" listKind\" :\" EtcdRestoreList\" ,\" plural\" :\" etcdrestores\" ,\" singular\" :\" etcdrestore\" },\" scope\" :\" Namespaced\" ,\" version\" :\" v1beta2\" }}"
29
- copyImage = "bundle -image"
29
+ opmImage = "opm -image"
30
30
bundlePath = "bundle-path"
31
31
)
32
32
@@ -179,9 +179,9 @@ func TestConfigMapUnpacker(t *testing.T) {
179
179
RestartPolicy : corev1 .RestartPolicyOnFailure ,
180
180
Containers : []corev1.Container {
181
181
{
182
- Name : pathHash ,
183
- Image : bundlePath ,
184
- Command : []string {"/injected/ opm" , "alpha" , "bundle" , "extract" , "-n" , "ns-a" , "-c" , pathHash },
182
+ Name : "extract" ,
183
+ Image : opmImage ,
184
+ Command : []string {"opm" , "alpha" , "bundle" , "extract" , "-m" , "/bundle/ " , "-n" , "ns-a" , "-c" , pathHash },
185
185
Env : []corev1.EnvVar {
186
186
{
187
187
Name : configmap .EnvContainerImage ,
@@ -190,28 +190,49 @@ func TestConfigMapUnpacker(t *testing.T) {
190
190
},
191
191
VolumeMounts : []corev1.VolumeMount {
192
192
{
193
- Name : "copydir " ,
194
- MountPath : "/injected " ,
193
+ Name : "bundle " ,
194
+ MountPath : "/bundle " ,
195
195
},
196
196
},
197
197
},
198
198
},
199
199
InitContainers : []corev1.Container {
200
200
{
201
- Name : "copy-binary" ,
202
- Image : copyImage ,
203
- Command : []string {"/bin/cp" , "/bin/opm" , "/copy-dest" },
201
+ Name : "tools" ,
202
+ Image : "busybox" ,
203
+ Command : []string {"/bin/cp" , "-Rv" , "/bin/cp" , "/tools/cp" },
204
+ VolumeMounts : []corev1.VolumeMount {
205
+ {
206
+ Name : "tools" ,
207
+ MountPath : "/tools" ,
208
+ },
209
+ },
210
+ },
211
+ {
212
+ Name : "pull" ,
213
+ Image : bundlePath ,
214
+ Command : []string {"/tools/cp" , "-Rv" , "/manifests" , "/metadata" , "/bundle" },
204
215
VolumeMounts : []corev1.VolumeMount {
205
216
{
206
- Name : "copydir" ,
207
- MountPath : "/copy-dest" ,
217
+ Name : "bundle" ,
218
+ MountPath : "/bundle" ,
219
+ },
220
+ {
221
+ Name : "tools" ,
222
+ MountPath : "/tools" ,
208
223
},
209
224
},
210
225
},
211
226
},
212
227
Volumes : []corev1.Volume {
213
228
{
214
- Name : "copydir" ,
229
+ Name : "bundle" ,
230
+ VolumeSource : corev1.VolumeSource {
231
+ EmptyDir : & corev1.EmptyDirVolumeSource {},
232
+ },
233
+ },
234
+ {
235
+ Name : "tools" ,
215
236
VolumeSource : corev1.VolumeSource {
216
237
EmptyDir : & corev1.EmptyDirVolumeSource {},
217
238
},
@@ -314,9 +335,9 @@ func TestConfigMapUnpacker(t *testing.T) {
314
335
RestartPolicy : corev1 .RestartPolicyOnFailure ,
315
336
Containers : []corev1.Container {
316
337
{
317
- Name : pathHash ,
318
- Image : bundlePath ,
319
- Command : []string {"/injected/ opm" , "alpha" , "bundle" , "extract" , "-n" , "ns-a" , "-c" , pathHash },
338
+ Name : "extract" ,
339
+ Image : opmImage ,
340
+ Command : []string {"opm" , "alpha" , "bundle" , "extract" , "-m" , "/bundle/ " , "-n" , "ns-a" , "-c" , pathHash },
320
341
Env : []corev1.EnvVar {
321
342
{
322
343
Name : configmap .EnvContainerImage ,
@@ -325,28 +346,49 @@ func TestConfigMapUnpacker(t *testing.T) {
325
346
},
326
347
VolumeMounts : []corev1.VolumeMount {
327
348
{
328
- Name : "copydir " ,
329
- MountPath : "/injected " ,
349
+ Name : "bundle " ,
350
+ MountPath : "/bundle " ,
330
351
},
331
352
},
332
353
},
333
354
},
334
355
InitContainers : []corev1.Container {
335
356
{
336
- Name : "copy-binary " ,
337
- Image : copyImage ,
338
- Command : []string {"/bin/cp" , "/bin/opm " , "/copy-dest " },
357
+ Name : "tools " ,
358
+ Image : "busybox" ,
359
+ Command : []string {"/bin/cp" , "-Rv" , " /bin/cp " , "/tools/cp " },
339
360
VolumeMounts : []corev1.VolumeMount {
340
361
{
341
- Name : "copydir" ,
342
- MountPath : "/copy-dest" ,
362
+ Name : "tools" ,
363
+ MountPath : "/tools" ,
364
+ },
365
+ },
366
+ },
367
+ {
368
+ Name : "pull" ,
369
+ Image : bundlePath ,
370
+ Command : []string {"/tools/cp" , "-Rv" , "/manifests" , "/metadata" , "/bundle" },
371
+ VolumeMounts : []corev1.VolumeMount {
372
+ {
373
+ Name : "bundle" ,
374
+ MountPath : "/bundle" ,
375
+ },
376
+ {
377
+ Name : "tools" ,
378
+ MountPath : "/tools" ,
343
379
},
344
380
},
345
381
},
346
382
},
347
383
Volumes : []corev1.Volume {
348
384
{
349
- Name : "copydir" ,
385
+ Name : "bundle" ,
386
+ VolumeSource : corev1.VolumeSource {
387
+ EmptyDir : & corev1.EmptyDirVolumeSource {},
388
+ },
389
+ },
390
+ {
391
+ Name : "tools" ,
350
392
VolumeSource : corev1.VolumeSource {
351
393
EmptyDir : & corev1.EmptyDirVolumeSource {},
352
394
},
@@ -488,9 +530,9 @@ func TestConfigMapUnpacker(t *testing.T) {
488
530
RestartPolicy : corev1 .RestartPolicyOnFailure ,
489
531
Containers : []corev1.Container {
490
532
{
491
- Name : pathHash ,
492
- Image : bundlePath ,
493
- Command : []string {"/injected/ opm" , "alpha" , "bundle" , "extract" , "-n" , "ns-a" , "-c" , pathHash },
533
+ Name : "extract" ,
534
+ Image : opmImage ,
535
+ Command : []string {"opm" , "alpha" , "bundle" , "extract" , "-m" , "/bundle/ " , "-n" , "ns-a" , "-c" , pathHash },
494
536
Env : []corev1.EnvVar {
495
537
{
496
538
Name : configmap .EnvContainerImage ,
@@ -499,28 +541,49 @@ func TestConfigMapUnpacker(t *testing.T) {
499
541
},
500
542
VolumeMounts : []corev1.VolumeMount {
501
543
{
502
- Name : "copydir " ,
503
- MountPath : "/injected " ,
544
+ Name : "bundle " ,
545
+ MountPath : "/bundle " ,
504
546
},
505
547
},
506
548
},
507
549
},
508
550
InitContainers : []corev1.Container {
509
551
{
510
- Name : "copy-binary" ,
511
- Image : copyImage ,
512
- Command : []string {"/bin/cp" , "/bin/opm" , "/copy-dest" },
552
+ Name : "tools" ,
553
+ Image : "busybox" ,
554
+ Command : []string {"/bin/cp" , "-Rv" , "/bin/cp" , "/tools/cp" },
555
+ VolumeMounts : []corev1.VolumeMount {
556
+ {
557
+ Name : "tools" ,
558
+ MountPath : "/tools" ,
559
+ },
560
+ },
561
+ },
562
+ {
563
+ Name : "pull" ,
564
+ Image : bundlePath ,
565
+ Command : []string {"/tools/cp" , "-Rv" , "/manifests" , "/metadata" , "/bundle" },
513
566
VolumeMounts : []corev1.VolumeMount {
514
567
{
515
- Name : "copydir" ,
516
- MountPath : "/copy-dest" ,
568
+ Name : "bundle" ,
569
+ MountPath : "/bundle" ,
570
+ },
571
+ {
572
+ Name : "tools" ,
573
+ MountPath : "/tools" ,
517
574
},
518
575
},
519
576
},
520
577
},
521
578
Volumes : []corev1.Volume {
522
579
{
523
- Name : "copydir" ,
580
+ Name : "bundle" ,
581
+ VolumeSource : corev1.VolumeSource {
582
+ EmptyDir : & corev1.EmptyDirVolumeSource {},
583
+ },
584
+ },
585
+ {
586
+ Name : "tools" ,
524
587
VolumeSource : corev1.VolumeSource {
525
588
EmptyDir : & corev1.EmptyDirVolumeSource {},
526
589
},
@@ -641,7 +704,7 @@ func TestConfigMapUnpacker(t *testing.T) {
641
704
WithJobLister (jobLister ),
642
705
WithRoleLister (roleLister ),
643
706
WithRoleBindingLister (rbLister ),
644
- WithCopyImage ( copyImage ),
707
+ WithOPMImage ( opmImage ),
645
708
WithNow (now ),
646
709
)
647
710
require .NoError (t , err )
0 commit comments