Skip to content

Commit 876e051

Browse files
committed
Fill up KEP
Signed-off-by: Itamar Holder <iholder@redhat.com>
1 parent c6b912b commit 876e051

File tree

2 files changed

+170
-30
lines changed

2 files changed

+170
-30
lines changed

keps/sig-node/5365-ImageVolume-with-image-digest/README.md

Lines changed: 157 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ If none of those approvers are still appropriate, then changes to that list
5858
should be approved by the remaining approvers and/or the owning SIG (or
5959
SIG Architecture for cross-cutting KEPs).
6060
-->
61-
# KEP-NNNN: Your short, descriptive title
61+
# KEP-5365: ImageVolume with an image digest
6262

6363
<!--
6464
This is the title of your KEP. Keep it short, simple, and descriptive. A good
@@ -86,15 +86,19 @@ tags, and then generate with `hack/update-toc.sh`.
8686
- [User Stories (Optional)](#user-stories-optional)
8787
- [Story 1](#story-1)
8888
- [Story 2](#story-2)
89+
- [Story 3](#story-3)
8990
- [Notes/Constraints/Caveats (Optional)](#notesconstraintscaveats-optional)
9091
- [Risks and Mitigations](#risks-and-mitigations)
9192
- [Design Details](#design-details)
93+
- [API Changes](#api-changes)
9294
- [Test Plan](#test-plan)
9395
- [Prerequisite testing updates](#prerequisite-testing-updates)
9496
- [Unit tests](#unit-tests)
9597
- [Integration tests](#integration-tests)
9698
- [e2e tests](#e2e-tests)
9799
- [Graduation Criteria](#graduation-criteria)
100+
- [Alpha](#alpha)
101+
- [Beta](#beta)
98102
- [Upgrade / Downgrade Strategy](#upgrade--downgrade-strategy)
99103
- [Version Skew Strategy](#version-skew-strategy)
100104
- [Production Readiness Review Questionnaire](#production-readiness-review-questionnaire)
@@ -128,9 +132,9 @@ checklist items _must_ be updated for the enhancement to be released.
128132

129133
Items marked with (R) are required *prior to targeting to a milestone / release*.
130134

131-
- [ ] (R) Enhancement issue in release milestone, which links to KEP dir in [kubernetes/enhancements] (not the initial KEP PR)
135+
- [X] (R) Enhancement issue in release milestone, which links to KEP dir in [kubernetes/enhancements] (not the initial KEP PR)
132136
- [ ] (R) KEP approvers have approved the KEP status as `implementable`
133-
- [ ] (R) Design details are appropriately documented
137+
- [X] (R) Design details are appropriately documented
134138
- [ ] (R) Test plan is in place, giving consideration to SIG Architecture and SIG Testing input (including test refactors)
135139
- [ ] e2e Tests for all Beta API Operations (endpoints)
136140
- [ ] (R) Ensure GA e2e tests meet requirements for [Conformance Tests](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/conformance-tests.md)
@@ -173,6 +177,16 @@ updates.
173177
[documentation style guide]: https://github.com/kubernetes/community/blob/master/contributors/guide/style-guide.md
174178
-->
175179

180+
The ImageVolume feature, implemented in [KEP-4639](https://github.com/kubernetes/enhancements/issues/4639),
181+
introduces a new way to define volumes for pods using a container image as the source.
182+
The image can be specified by its name and tag, or by its digest, alongside a pull policy,
183+
just like a container image is being specified in a pod spec.
184+
185+
However, a difference between ImageVolume and a "standard" container image is that the image digest for container
186+
images is advertised in the pod's status as part of the `containerStatuses` field.
187+
As opposed to that, the digest of the image used for an ImageVolume is not advertised in the pod's status.
188+
This KEP aims to close this gap, by adding a new field to the pod's status that will contain the digest of the image.
189+
176190
## Motivation
177191

178192
<!--
@@ -184,20 +198,41 @@ demonstrate the interest in a KEP within the wider Kubernetes community.
184198
[experience reports]: https://github.com/golang/go/wiki/ExperienceReports
185199
-->
186200

201+
A container image digest is a unique identifier for a specific version of a container image.
202+
It is a hash of the image's content, which serves as a unique fingerprint for that image,
203+
ensuring that it is the exact version that originally used by the container.
204+
This is unlike a tag, which can be reused or changed over time.
205+
206+
Just like container digests are advertised in the pod's status for containers,
207+
the same should be done for ImageVolumes with very similar use-cases,
208+
like reporting the image used through monitoring or debug tools,
209+
supporting git-ops workflows that rely on the image digest,
210+
and more (see Goals section below).
211+
212+
A special use-case for this KEP is using live-migration in Kubevirt.
213+
Kubevirt runs VMs inside pods, and supports to move a VM instance between nodes.
214+
Behind the scenes, this is done by creating a similar pod (with the same images), then transferring the VM state.
215+
An image digest would ensure that the same image is used on both nodes, which is crucial for live-migrations to succeed.
216+
187217
### Goals
188218

189219
<!--
190220
List the specific goals of the KEP. What is it trying to achieve? How will we
191221
know that this has succeeded?
192222
-->
193223

224+
* Add a new field to the pod's status that will contain the digest of the image used for ImageVolumes.
225+
194226
### Non-Goals
195227

196228
<!--
197229
What is out of scope for this KEP? Listing non-goals helps to focus discussion
198230
and make progress.
199231
-->
200232

233+
* This KEP does not aim to change the way ImageVolumes are defined in the pod spec.
234+
The image digest will be added to the pod's status, but the pod spec will remain unchanged.
235+
201236
## Proposal
202237

203238
<!--
@@ -220,8 +255,19 @@ bogged down.
220255

221256
#### Story 1
222257

258+
As a user, I want to monitor which images are used by my pods, so I can ensure that the correct versions are running.
259+
This is important for ensuring the images are updated, not containing CVEs, etc.
260+
223261
#### Story 2
224262

263+
As a user, I want to use git-ops workflows that rely on the image digest,
264+
so I can ensure that the correct versions are running.
265+
266+
#### Story 3
267+
268+
As a user, I want to use live-migration in Kubevirt relying on ImageVolumes,
269+
so I can move my VM instances between nodes without downtime.
270+
225271
### Notes/Constraints/Caveats (Optional)
226272

227273
<!--
@@ -254,6 +300,58 @@ required) or even code snippets. If there's any ambiguity about HOW your
254300
proposal will be implemented, this is the place to discuss them.
255301
-->
256302

303+
### API Changes
304+
305+
This KEP proposes to add an `ImageRef` to the `VolumeMountStatus` [struct](https://github.com/kubernetes/kubernetes/blob/70540c9f43e2fb7604924a120799206c27cbbd28/staging/src/k8s.io/api/core/v1/types.go#L3450-L3465)
306+
(which is part of the pod's status):
307+
```go
308+
// VolumeMountStatus shows status of volume mounts.
309+
type VolumeMountStatus struct {
310+
// Name corresponds to the name of the original VolumeMount.
311+
Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
312+
// MountPath corresponds to the original VolumeMount.
313+
MountPath string `json:"mountPath" protobuf:"bytes,2,opt,name=mountPath"`
314+
// ReadOnly corresponds to the original VolumeMount.
315+
// +optional
316+
ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,3,opt,name=readOnly"`
317+
// RecursiveReadOnly must be set to Disabled, Enabled, or unspecified (for non-readonly mounts).
318+
// An IfPossible value in the original VolumeMount must be translated to Disabled or Enabled,
319+
// depending on the mount result.
320+
// +featureGate=RecursiveReadOnlyMounts
321+
// +optional
322+
RecursiveReadOnly *RecursiveReadOnlyMode `json:"recursiveReadOnly,omitempty" protobuf:"bytes,4,opt,name=recursiveReadOnly,casttype=RecursiveReadOnlyMode"`
323+
// ImageRef is the digest of the image used for this volume.
324+
// If the volume source is not an ImageVolume, this field will be empty.
325+
ImageRef *string `json:"imageRef,omitempty" protobuf:"bytes,5,opt,name=imageRef"`
326+
}
327+
```
328+
329+
Note that the `ImageRef` field is a pointer and should be omitted whenever the volume source is not an ImageVolume.
330+
In addition, during admission, it should be disallowed to populate the `ImageRef` field for non-ImageVolume sources.
331+
332+
In addition, the KEP proposes to add an `ImageRef` field to the `ImageSpec` cri-api [struct](https://github.com/kubernetes/kubernetes/blob/cc466aa355f9e47709a108dd6774ad4aa716a984/staging/src/k8s.io/cri-api/pkg/apis/runtime/v1/api.proto#L833-L848):
333+
```protobuf
334+
// ImageSpec is an internal representation of an image.
335+
message ImageSpec {
336+
// Container's Image field (e.g. imageID or imageDigest). Might not contain the image's digest.
337+
string image = 1;
338+
// Unstructured key-value map holding arbitrary metadata.
339+
// ImageSpec Annotations can be used to help the runtime target specific
340+
// images in multi-arch images.
341+
map<string, string> annotations = 2;
342+
// The container image reference specified by the user (e.g. image[:tag] or digest).
343+
// Only set if available within the RPC context.
344+
string user_specified_image = 18;
345+
// Runtime handler to use for pulling the image.
346+
// If the runtime handler is unknown, the request should be rejected.
347+
// An empty string would select the default runtime handler.
348+
string runtime_handler = 19;
349+
// The digest of the image used for this volume.
350+
string image_ref = 20;
351+
}
352+
```
353+
354+
257355
### Test Plan
258356

259357
<!--
@@ -267,7 +365,9 @@ when drafting this test plan.
267365
[testing-guidelines]: https://git.k8s.io/community/contributors/devel/sig-testing/testing.md
268366
-->
269367

270-
[ ] I/we understand the owners of the involved components may require updates to
368+
Since we're proposing a CRI-API change, we'll need to test this feature with both containerd and CRI-O runtimes.
369+
370+
[X] I/we understand the owners of the involved components may require updates to
271371
existing tests to make this code solid enough prior to committing the changes necessary
272372
to implement this enhancement.
273373

@@ -420,8 +520,20 @@ in back-to-back releases.
420520
- Deprecate the flag
421521
-->
422522

523+
#### Alpha
524+
525+
- Feature implemented behind a feature flag
526+
- Initial e2e tests completed and enabled
527+
528+
#### Beta
529+
- Feature is supported by both containerd and CRI-O runtimes
530+
423531
### Upgrade / Downgrade Strategy
424532

533+
Upgrade: Feature gate is off by default in Alpha.
534+
535+
Downgrade: The image digest field will be omitted from the pod's status.
536+
425537
<!--
426538
If applicable, how will the component be upgraded and downgraded? Make sure
427539
this is in the test plan.
@@ -436,6 +548,8 @@ enhancement:
436548

437549
### Version Skew Strategy
438550

551+
Standard n-2 skew.
552+
439553
<!--
440554
If applicable, how will the component handle version skew with other
441555
components? What are the guarantees? Make sure this is in the test plan.
@@ -491,15 +605,15 @@ well as the [existing list] of feature gates.
491605
[existing list]: https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/
492606
-->
493607

494-
- [ ] Feature gate (also fill in values in `kep.yaml`)
495-
- Feature gate name:
496-
- Components depending on the feature gate:
497-
- [ ] Other
498-
- Describe the mechanism:
608+
- [X] Feature gate (also fill in values in `kep.yaml`)
609+
- Feature gate name: ImageVolumeWithDigest.
610+
- Components depending on the feature gate: kubelet.
611+
- [X] Other
612+
- Describe the mechanism: Kubelet needs to be restarted when enabling/disabling this feature.
499613
- Will enabling / disabling the feature require downtime of the control
500-
plane?
614+
plane? No.
501615
- Will enabling / disabling the feature require downtime or reprovisioning
502-
of a node?
616+
of a node? Yes.
503617

504618
###### Does enabling the feature change any default behavior?
505619

@@ -508,6 +622,9 @@ Any change of default behavior may be surprising to users or break existing
508622
automations, so be extremely careful here.
509623
-->
510624

625+
By default, the image ID should be added to the pod's status when the feature is enabled and an ImageVolume is used.
626+
This should not break any existing flows / behaviors.
627+
511628
###### Can the feature be disabled once it has been enabled (i.e. can we roll back the enablement)?
512629

513630
<!--
@@ -521,8 +638,14 @@ feature.
521638
NOTE: Also set `disable-supported` to `true` or `false` in `kep.yaml`.
522639
-->
523640

641+
The feature gate can be turned off.
642+
Kubelet would be needed to be restarted for the image digest to be removed from the pod's status.
643+
524644
###### What happens if we reenable the feature if it was previously rolled back?
525645

646+
After re-enabling the feature, any new pod that would be created would include the image digest in its status.
647+
Vice-versa for disabling the feature.
648+
526649
###### Are there any tests for feature enablement/disablement?
527650

528651
<!--
@@ -556,6 +679,9 @@ rollout. Similarly, consider large clusters and how enablement/disablement
556679
will rollout across nodes.
557680
-->
558681

682+
The worst case scenario is that some pods would have the image digest in their status, while others would not.
683+
This is not expected to cause any issues or break existing behavior.
684+
559685
###### What specific metrics should inform a rollback?
560686

561687
<!--
@@ -607,9 +733,9 @@ Recall that end users cannot usually observe component logs or access metrics.
607733

608734
- [ ] Events
609735
- Event Reason:
610-
- [ ] API .status
736+
- [X] API .status
611737
- Condition name:
612-
- Other field:
738+
- Other field: pod.status.volumeMounts[i].ImageRef
613739
- [ ] Other (treat as last resort)
614740
- Details:
615741

@@ -656,6 +782,8 @@ implementation difficulties, etc.).
656782
This section must be completed when targeting beta to a release.
657783
-->
658784

785+
This feature depends on the ImageVolume feature, which is implemented in KEP-4639.
786+
659787
###### Does this feature depend on any specific services running in the cluster?
660788

661789
<!--
@@ -685,6 +813,8 @@ For GA, this section is required: approvers should be able to confirm the
685813
previous answers based on experience in the field.
686814
-->
687815

816+
Scalability issues are not expected.
817+
688818
###### Will enabling / using this feature result in any new API calls?
689819

690820
<!--
@@ -700,6 +830,8 @@ Focusing mostly on:
700830
heartbeats, leader election, etc.)
701831
-->
702832

833+
No, just for another field in a cri-api call.
834+
703835
###### Will enabling / using this feature result in introducing new API types?
704836

705837
<!--
@@ -709,6 +841,8 @@ Describe them, providing:
709841
- Supported number of objects per namespace (for namespace-scoped objects)
710842
-->
711843

844+
Yes, a new image digest field will be added to the `VolumeMountStatus` struct in the pod's status.
845+
712846
###### Will enabling / using this feature result in any new calls to the cloud provider?
713847

714848
<!--
@@ -717,6 +851,8 @@ Describe them, providing:
717851
- Estimated increase:
718852
-->
719853

854+
No.
855+
720856
###### Will enabling / using this feature result in increasing size or count of the existing API objects?
721857

722858
<!--
@@ -726,6 +862,8 @@ Describe them, providing:
726862
- Estimated amount of new objects: (e.g., new Object X for every existing Pod)
727863
-->
728864

865+
Additional field.
866+
729867
###### Will enabling / using this feature result in increasing time taken by any operations covered by existing SLIs/SLOs?
730868

731869
<!--
@@ -737,6 +875,8 @@ Think about adding additional work or introducing new steps in between
737875
[existing SLIs/SLOs]: https://git.k8s.io/community/sig-scalability/slos/slos.md#kubernetes-slisslos
738876
-->
739877

878+
No.
879+
740880
###### Will enabling / using this feature result in non-negligible increase of resource usage (CPU, RAM, disk, IO, ...) in any components?
741881

742882
<!--
@@ -749,6 +889,8 @@ This through this both in small and large cases, again with respect to the
749889
[supported limits]: https://git.k8s.io/community//sig-scalability/configs-and-limits/thresholds.md
750890
-->
751891

892+
No.
893+
752894
###### Can enabling / using this feature result in resource exhaustion of some node resources (PIDs, sockets, inodes, etc.)?
753895

754896
<!--
@@ -761,6 +903,8 @@ Are there any tests that were run/should be run to understand performance charac
761903
and validate the declared limits?
762904
-->
763905

906+
No.
907+
764908
### Troubleshooting
765909

766910
<!--

0 commit comments

Comments
 (0)