Skip to content

Commit cf69b47

Browse files
committed
Fill up KEP
Signed-off-by: Itamar Holder <iholder@redhat.com>
1 parent 6d7f826 commit cf69b47

File tree

2 files changed

+169
-30
lines changed

2 files changed

+169
-30
lines changed

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

Lines changed: 156 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,57 @@ 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 so it would be omitted whenever the volume source is not an ImageVolume.
330+
331+
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):
332+
```protobuf
333+
// ImageSpec is an internal representation of an image.
334+
message ImageSpec {
335+
// Container's Image field (e.g. imageID or imageDigest). Might not contain the image's digest.
336+
string image = 1;
337+
// Unstructured key-value map holding arbitrary metadata.
338+
// ImageSpec Annotations can be used to help the runtime target specific
339+
// images in multi-arch images.
340+
map<string, string> annotations = 2;
341+
// The container image reference specified by the user (e.g. image[:tag] or digest).
342+
// Only set if available within the RPC context.
343+
string user_specified_image = 18;
344+
// Runtime handler to use for pulling the image.
345+
// If the runtime handler is unknown, the request should be rejected.
346+
// An empty string would select the default runtime handler.
347+
string runtime_handler = 19;
348+
// The digest of the image used for this volume.
349+
string image_ref = 20;
350+
}
351+
```
352+
353+
257354
### Test Plan
258355

259356
<!--
@@ -267,7 +364,9 @@ when drafting this test plan.
267364
[testing-guidelines]: https://git.k8s.io/community/contributors/devel/sig-testing/testing.md
268365
-->
269366

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

@@ -420,8 +519,20 @@ in back-to-back releases.
420519
- Deprecate the flag
421520
-->
422521

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

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

437548
### Version Skew Strategy
438549

550+
Standard n-2 skew.
551+
439552
<!--
440553
If applicable, how will the component handle version skew with other
441554
components? What are the guarantees? Make sure this is in the test plan.
@@ -491,15 +604,15 @@ well as the [existing list] of feature gates.
491604
[existing list]: https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/
492605
-->
493606

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:
607+
- [X] Feature gate (also fill in values in `kep.yaml`)
608+
- Feature gate name: ImageVolumeWithDigest.
609+
- Components depending on the feature gate: kubelet.
610+
- [X] Other
611+
- Describe the mechanism: Kubelet needs to be restarted when enabling/disabling this feature.
499612
- Will enabling / disabling the feature require downtime of the control
500-
plane?
613+
plane? No.
501614
- Will enabling / disabling the feature require downtime or reprovisioning
502-
of a node?
615+
of a node? Yes.
503616

504617
###### Does enabling the feature change any default behavior?
505618

@@ -508,6 +621,9 @@ Any change of default behavior may be surprising to users or break existing
508621
automations, so be extremely careful here.
509622
-->
510623

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

513629
<!--
@@ -521,8 +637,14 @@ feature.
521637
NOTE: Also set `disable-supported` to `true` or `false` in `kep.yaml`.
522638
-->
523639

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

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

528650
<!--
@@ -556,6 +678,9 @@ rollout. Similarly, consider large clusters and how enablement/disablement
556678
will rollout across nodes.
557679
-->
558680

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

561686
<!--
@@ -607,9 +732,9 @@ Recall that end users cannot usually observe component logs or access metrics.
607732

608733
- [ ] Events
609734
- Event Reason:
610-
- [ ] API .status
735+
- [X] API .status
611736
- Condition name:
612-
- Other field:
737+
- Other field: pod.status.volumeMounts[i].ImageRef
613738
- [ ] Other (treat as last resort)
614739
- Details:
615740

@@ -656,6 +781,8 @@ implementation difficulties, etc.).
656781
This section must be completed when targeting beta to a release.
657782
-->
658783

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

661788
<!--
@@ -685,6 +812,8 @@ For GA, this section is required: approvers should be able to confirm the
685812
previous answers based on experience in the field.
686813
-->
687814

815+
Scalability issues are not expected.
816+
688817
###### Will enabling / using this feature result in any new API calls?
689818

690819
<!--
@@ -700,6 +829,8 @@ Focusing mostly on:
700829
heartbeats, leader election, etc.)
701830
-->
702831

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

705836
<!--
@@ -709,6 +840,8 @@ Describe them, providing:
709840
- Supported number of objects per namespace (for namespace-scoped objects)
710841
-->
711842

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

714847
<!--
@@ -717,6 +850,8 @@ Describe them, providing:
717850
- Estimated increase:
718851
-->
719852

853+
No.
854+
720855
###### Will enabling / using this feature result in increasing size or count of the existing API objects?
721856

722857
<!--
@@ -726,6 +861,8 @@ Describe them, providing:
726861
- Estimated amount of new objects: (e.g., new Object X for every existing Pod)
727862
-->
728863

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

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

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

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

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

754895
<!--
@@ -761,6 +902,8 @@ Are there any tests that were run/should be run to understand performance charac
761902
and validate the declared limits?
762903
-->
763904

905+
No.
906+
764907
### Troubleshooting
765908

766909
<!--

0 commit comments

Comments
 (0)