@@ -336,7 +336,7 @@ metadata:
336
336
spec :
337
337
volumes :
338
338
- name : oci-volume
339
- oci :
339
+ image :
340
340
reference : " example.com/my-image:latest"
341
341
pullPolicy : IfNotPresent
342
342
containers :
@@ -357,24 +357,22 @@ by:
357
357
type VolumeSource struct {
358
358
// …
359
359
360
- // oci represents a OCI object pulled and mounted on kubelet's host machine
361
- // +featureGate=OCIVolume
362
- // +optional
363
- OCI *OCIVolumeSource ` json:"oci,omitempty" protobuf:"bytes,30,opt,name=oci"
360
+ // image …
361
+ Image *ImageVolumeSource ` json:"image,omitempty" protobuf:"bytes,30,opt,name=image"
364
362
}
365
363
```
366
364
367
- And add the corresponding ` OCIVolumeSource ` type:
365
+ And add the corresponding ` ImageVolumeSource ` type:
368
366
369
367
``` go
370
- // OCIVolumeSource represents a OCI volume resource.
371
- type OCIVolumeSource struct {
372
- // Required: Image or artifact reference to be used
368
+ // ImageVolumeSource represents a image volume resource.
369
+ type ImageVolumeSource struct {
370
+ // Required: Image or artifact reference to be used.
371
+ // …
373
372
Reference string ` json:"reference" protobuf:"bytes,1,opt,name=reference"`
374
373
375
- // Policy for pulling OCI objects
376
- // Defaults to IfNotPresent
377
- // +optional
374
+ // Policy for pulling OCI objects.
375
+ // …
378
376
PullPolicy PullPolicy ` json:"pullPolicy,omitempty" protobuf:"bytes,2,opt,name=pullPolicy,casttype=PullPolicy"`
379
377
}
380
378
```
@@ -392,15 +390,15 @@ if source.OCI != nil {
392
390
allErrs = append (allErrs, field.Forbidden (fldPath.Child (" oci" ), " may not specify more than 1 volume type" ))
393
391
} else {
394
392
numVolumes++
395
- allErrs = append (allErrs, validateOCIVolumeSource (source.OCI , fldPath.Child (" oci" ))...)
393
+ allErrs = append (allErrs, validateImageVolumeSource (source.OCI , fldPath.Child (" oci" ))...)
396
394
}
397
395
}
398
396
399
397
// …
400
398
```
401
399
402
400
``` go
403
- func validateOCIVolumeSource (oci *core .OCIVolumeSource , fldPath *field .Path ) field .ErrorList {
401
+ func validateImageVolumeSource (oci *core .ImageVolumeSource , fldPath *field .Path ) field .ErrorList {
404
402
allErrs := field.ErrorList {}
405
403
if len (oci.Reference ) == 0 {
406
404
allErrs = append (allErrs, field.Required (fldPath.Child (" reference" ), " " ))
@@ -413,13 +411,13 @@ func validateOCIVolumeSource(oci *core.OCIVolumeSource, fldPath *field.Path) fie
413
411
``` go
414
412
// …
415
413
416
- // Disallow subPath/subPathExpr for OCI volumes
414
+ // Disallow subPath/subPathExpr for image volumes
417
415
if v , ok := volumes[mnt.Name ]; ok && v.OCI != nil {
418
416
if mnt.SubPath != " " {
419
- allErrs = append (allErrs, field.Invalid (idxPath.Child (" subPath" ), mnt.SubPath , " not allowed in OCI volume sources" ))
417
+ allErrs = append (allErrs, field.Invalid (idxPath.Child (" subPath" ), mnt.SubPath , " not allowed in image volume sources" ))
420
418
}
421
419
if mnt.SubPathExpr != " " {
422
- allErrs = append (allErrs, field.Invalid (idxPath.Child (" subPathExpr" ), mnt.SubPathExpr , " not allowed in OCI volume sources" ))
420
+ allErrs = append (allErrs, field.Invalid (idxPath.Child (" subPathExpr" ), mnt.SubPathExpr , " not allowed in image volume sources" ))
423
421
}
424
422
}
425
423
@@ -510,7 +508,7 @@ message Mount {
510
508
// …
511
509
512
510
// Mount an image reference (image ID, with or without digest), which is a
513
- // special use case for OCI volume mounts. If this field is set, then
511
+ // special use case for image volume mounts. If this field is set, then
514
512
// host_path should be unset. All OCI mounts are per feature definition
515
513
// readonly. The kubelet does an PullImage RPC and evaluates the returned
516
514
// PullImageResponse.image_ref value, which is then set to the
@@ -932,7 +930,7 @@ well as the [existing list] of feature gates.
932
930
-->
933
931
934
932
- [x] Feature gate (also fill in values in ` kep.yaml ` )
935
- - Feature gate name: OCIVolume
933
+ - Feature gate name: ImageVolume
936
934
- Components depending on the feature gate:
937
935
- kube-apiserver (API validation)
938
936
- kubelet (volume mount)
0 commit comments