Skip to content

Commit 23105e9

Browse files
committed
Update API
Signed-off-by: Sascha Grunert <[email protected]>
1 parent 11ea92b commit 23105e9

File tree

2 files changed

+18
-20
lines changed

2 files changed

+18
-20
lines changed

keps/sig-node/4639-oci-volume-source/README.md

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ metadata:
336336
spec:
337337
volumes:
338338
- name: oci-volume
339-
oci:
339+
image:
340340
reference: "example.com/my-image:latest"
341341
pullPolicy: IfNotPresent
342342
containers:
@@ -357,24 +357,22 @@ by:
357357
type VolumeSource struct {
358358
// …
359359
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"
364362
}
365363
```
366364

367-
And add the corresponding `OCIVolumeSource` type:
365+
And add the corresponding `ImageVolumeSource` type:
368366

369367
```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+
//
373372
Reference string `json:"reference" protobuf:"bytes,1,opt,name=reference"`
374373

375-
// Policy for pulling OCI objects
376-
// Defaults to IfNotPresent
377-
// +optional
374+
// Policy for pulling OCI objects.
375+
//
378376
PullPolicy PullPolicy `json:"pullPolicy,omitempty" protobuf:"bytes,2,opt,name=pullPolicy,casttype=PullPolicy"`
379377
}
380378
```
@@ -392,15 +390,15 @@ if source.OCI != nil {
392390
allErrs = append(allErrs, field.Forbidden(fldPath.Child("oci"), "may not specify more than 1 volume type"))
393391
} else {
394392
numVolumes++
395-
allErrs = append(allErrs, validateOCIVolumeSource(source.OCI, fldPath.Child("oci"))...)
393+
allErrs = append(allErrs, validateImageVolumeSource(source.OCI, fldPath.Child("oci"))...)
396394
}
397395
}
398396

399397
//
400398
```
401399

402400
```go
403-
func validateOCIVolumeSource(oci *core.OCIVolumeSource, fldPath *field.Path) field.ErrorList {
401+
func validateImageVolumeSource(oci *core.ImageVolumeSource, fldPath *field.Path) field.ErrorList {
404402
allErrs := field.ErrorList{}
405403
if len(oci.Reference) == 0 {
406404
allErrs = append(allErrs, field.Required(fldPath.Child("reference"), ""))
@@ -413,13 +411,13 @@ func validateOCIVolumeSource(oci *core.OCIVolumeSource, fldPath *field.Path) fie
413411
```go
414412
//
415413

416-
// Disallow subPath/subPathExpr for OCI volumes
414+
// Disallow subPath/subPathExpr for image volumes
417415
if v, ok := volumes[mnt.Name]; ok && v.OCI != nil {
418416
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"))
420418
}
421419
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"))
423421
}
424422
}
425423

@@ -510,7 +508,7 @@ message Mount {
510508
// …
511509
512510
// 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
514512
// host_path should be unset. All OCI mounts are per feature definition
515513
// readonly. The kubelet does an PullImage RPC and evaluates the returned
516514
// PullImageResponse.image_ref value, which is then set to the
@@ -932,7 +930,7 @@ well as the [existing list] of feature gates.
932930
-->
933931

934932
- [x] Feature gate (also fill in values in `kep.yaml`)
935-
- Feature gate name: OCIVolume
933+
- Feature gate name: ImageVolume
936934
- Components depending on the feature gate:
937935
- kube-apiserver (API validation)
938936
- kubelet (volume mount)

keps/sig-node/4639-oci-volume-source/kep.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ milestone:
5757
# The following PRR answers are required at alpha release
5858
# List the feature gate name and the components for which it must be enabled
5959
feature-gates:
60-
- name: OCIVolume
60+
- name: ImageVolume
6161
components:
6262
- kube-apiserver
6363
- kubelet

0 commit comments

Comments
 (0)