@@ -5378,19 +5378,14 @@ func TestValidateVolumes(t *testing.T) {
5378
5378
},
5379
5379
},
5380
5380
},
5381
- opts: PodValidationOptions{AllowImageVolumeSource: true },
5381
+ opts: PodValidationOptions{},
5382
5382
}, {
5383
- name: "feature disabled ",
5383
+ name: "no volume source ",
5384
5384
vol: core.Volume{
5385
- Name: "image-volume",
5386
- VolumeSource: core.VolumeSource{
5387
- Image: &core.ImageVolumeSource{
5388
- Reference: "quay.io/my/artifact:v1",
5389
- PullPolicy: "IfNotPresent",
5390
- },
5391
- },
5385
+ Name: "volume",
5386
+ VolumeSource: core.VolumeSource{},
5392
5387
},
5393
- opts: PodValidationOptions{AllowImageVolumeSource: false },
5388
+ opts: PodValidationOptions{},
5394
5389
errs: []verr{{
5395
5390
etype: field.ErrorTypeRequired,
5396
5391
field: "field[0]",
@@ -5407,7 +5402,7 @@ func TestValidateVolumes(t *testing.T) {
5407
5402
},
5408
5403
},
5409
5404
},
5410
- opts: PodValidationOptions{AllowImageVolumeSource: true },
5405
+ opts: PodValidationOptions{},
5411
5406
errs: []verr{{
5412
5407
etype: field.ErrorTypeRequired,
5413
5408
field: "name",
@@ -5423,7 +5418,7 @@ func TestValidateVolumes(t *testing.T) {
5423
5418
},
5424
5419
},
5425
5420
},
5426
- opts: PodValidationOptions{AllowImageVolumeSource: true, ResourceIsPod: true},
5421
+ opts: PodValidationOptions{ResourceIsPod: true},
5427
5422
errs: []verr{{
5428
5423
etype: field.ErrorTypeRequired,
5429
5424
field: "image.reference",
@@ -5439,7 +5434,7 @@ func TestValidateVolumes(t *testing.T) {
5439
5434
},
5440
5435
},
5441
5436
},
5442
- opts: PodValidationOptions{AllowImageVolumeSource: true, ResourceIsPod: false},
5437
+ opts: PodValidationOptions{ResourceIsPod: false},
5443
5438
}, {
5444
5439
name: "image volume with wrong pullPolicy",
5445
5440
vol: core.Volume{
@@ -5451,7 +5446,7 @@ func TestValidateVolumes(t *testing.T) {
5451
5446
},
5452
5447
},
5453
5448
},
5454
- opts: PodValidationOptions{AllowImageVolumeSource: true },
5449
+ opts: PodValidationOptions{},
5455
5450
errs: []verr{{
5456
5451
etype: field.ErrorTypeNotSupported,
5457
5452
field: "image.pullPolicy",
@@ -7066,7 +7061,7 @@ func TestValidateVolumeMounts(t *testing.T) {
7066
7061
}}}},
7067
7062
{Name: "image-volume", VolumeSource: core.VolumeSource{Image: &core.ImageVolumeSource{Reference: "quay.io/my/artifact:v1", PullPolicy: "IfNotPresent"}}},
7068
7063
}
7069
- opts := PodValidationOptions{AllowImageVolumeSource: true }
7064
+ opts := PodValidationOptions{}
7070
7065
vols, v1err := ValidateVolumes(volumes, nil, field.NewPath("field"), opts)
7071
7066
if len(v1err) > 0 {
7072
7067
t.Errorf("Invalid test volume - expected success %v", v1err)
0 commit comments