Skip to content

Commit 741eb29

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

File tree

2 files changed

+179
-39
lines changed

2 files changed

+179
-39
lines changed

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

Lines changed: 162 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,59 @@ 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+
// It should have a value that's similar to the pod's status.containerStatuses[i].imageID.
325+
// If the volume source is not an ImageVolume, this field will be empty.
326+
ImageRef *string `json:"imageRef,omitempty" protobuf:"bytes,5,opt,name=imageRef"`
327+
}
328+
```
329+
330+
Note that the `ImageRef` field is a pointer and should be omitted whenever the volume source is not an ImageVolume.
331+
In addition, during admission, it should be disallowed to populate the `ImageRef` field for non-ImageVolume sources.
332+
333+
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):
334+
```protobuf
335+
// ImageSpec is an internal representation of an image.
336+
message ImageSpec {
337+
// Container's Image field (e.g. imageID or imageDigest). Might not contain the image's digest.
338+
string image = 1;
339+
// Unstructured key-value map holding arbitrary metadata.
340+
// ImageSpec Annotations can be used to help the runtime target specific
341+
// images in multi-arch images.
342+
map<string, string> annotations = 2;
343+
// The container image reference specified by the user (e.g. image[:tag] or digest).
344+
// Only set if available within the RPC context.
345+
string user_specified_image = 18;
346+
// Runtime handler to use for pulling the image.
347+
// If the runtime handler is unknown, the request should be rejected.
348+
// An empty string would select the default runtime handler.
349+
string runtime_handler = 19;
350+
// The digest of the image used for this volume.
351+
string image_ref = 20;
352+
}
353+
```
354+
355+
257356
### Test Plan
258357

259358
<!--
@@ -267,7 +366,9 @@ when drafting this test plan.
267366
[testing-guidelines]: https://git.k8s.io/community/contributors/devel/sig-testing/testing.md
268367
-->
269368

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

@@ -420,8 +521,20 @@ in back-to-back releases.
420521
- Deprecate the flag
421522
-->
422523

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

534+
Upgrade: Feature gate is off by default in Alpha.
535+
536+
Downgrade: The image digest field will be omitted from the pod's status.
537+
425538
<!--
426539
If applicable, how will the component be upgraded and downgraded? Make sure
427540
this is in the test plan.
@@ -436,6 +549,12 @@ enhancement:
436549

437550
### Version Skew Strategy
438551

552+
The CRI would have to support the new `ImageRef` field in the `VolumeMountStatus` struct that had been added to the CRI-API.
553+
If the CRI does not support this field, the kubelet would not be able to populate it in the pod's status,
554+
which means that the image digest would not be available in the pod's status.
555+
556+
This feature affects only kubelet and the CRI, no other components are affected.
557+
439558
<!--
440559
If applicable, how will the component handle version skew with other
441560
components? What are the guarantees? Make sure this is in the test plan.
@@ -491,15 +610,15 @@ well as the [existing list] of feature gates.
491610
[existing list]: https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/
492611
-->
493612

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:
613+
- [X] Feature gate (also fill in values in `kep.yaml`)
614+
- Feature gate name: ImageVolumeWithDigest.
615+
- Components depending on the feature gate: kubelet.
616+
- [X] Other
617+
- Describe the mechanism: Kubelet needs to be restarted when enabling/disabling this feature.
499618
- Will enabling / disabling the feature require downtime of the control
500-
plane?
619+
plane? No.
501620
- Will enabling / disabling the feature require downtime or reprovisioning
502-
of a node?
621+
of a node? Yes.
503622

504623
###### Does enabling the feature change any default behavior?
505624

@@ -508,6 +627,9 @@ Any change of default behavior may be surprising to users or break existing
508627
automations, so be extremely careful here.
509628
-->
510629

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

513635
<!--
@@ -521,8 +643,14 @@ feature.
521643
NOTE: Also set `disable-supported` to `true` or `false` in `kep.yaml`.
522644
-->
523645

646+
The feature gate can be turned off.
647+
Kubelet would be needed to be restarted for the image digest to be removed from the pod's status.
648+
524649
###### What happens if we reenable the feature if it was previously rolled back?
525650

651+
After re-enabling the feature, any new pod that would be created would include the image digest in its status.
652+
Vice-versa for disabling the feature.
653+
526654
###### Are there any tests for feature enablement/disablement?
527655

528656
<!--
@@ -556,6 +684,9 @@ rollout. Similarly, consider large clusters and how enablement/disablement
556684
will rollout across nodes.
557685
-->
558686

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

561692
<!--
@@ -607,9 +738,9 @@ Recall that end users cannot usually observe component logs or access metrics.
607738

608739
- [ ] Events
609740
- Event Reason:
610-
- [ ] API .status
741+
- [X] API .status
611742
- Condition name:
612-
- Other field:
743+
- Other field: pod.status.volumeMounts[i].ImageRef
613744
- [ ] Other (treat as last resort)
614745
- Details:
615746

@@ -656,6 +787,8 @@ implementation difficulties, etc.).
656787
This section must be completed when targeting beta to a release.
657788
-->
658789

790+
This feature depends on the ImageVolume feature, which is implemented in KEP-4639.
791+
659792
###### Does this feature depend on any specific services running in the cluster?
660793

661794
<!--
@@ -685,6 +818,8 @@ For GA, this section is required: approvers should be able to confirm the
685818
previous answers based on experience in the field.
686819
-->
687820

821+
Scalability issues are not expected.
822+
688823
###### Will enabling / using this feature result in any new API calls?
689824

690825
<!--
@@ -700,6 +835,8 @@ Focusing mostly on:
700835
heartbeats, leader election, etc.)
701836
-->
702837

838+
No, just for another field in a cri-api call.
839+
703840
###### Will enabling / using this feature result in introducing new API types?
704841

705842
<!--
@@ -709,6 +846,8 @@ Describe them, providing:
709846
- Supported number of objects per namespace (for namespace-scoped objects)
710847
-->
711848

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

714853
<!--
@@ -717,6 +856,8 @@ Describe them, providing:
717856
- Estimated increase:
718857
-->
719858

859+
No.
860+
720861
###### Will enabling / using this feature result in increasing size or count of the existing API objects?
721862

722863
<!--
@@ -726,6 +867,8 @@ Describe them, providing:
726867
- Estimated amount of new objects: (e.g., new Object X for every existing Pod)
727868
-->
728869

870+
Additional field.
871+
729872
###### Will enabling / using this feature result in increasing time taken by any operations covered by existing SLIs/SLOs?
730873

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

883+
No.
884+
740885
###### Will enabling / using this feature result in non-negligible increase of resource usage (CPU, RAM, disk, IO, ...) in any components?
741886

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

897+
No.
898+
752899
###### Can enabling / using this feature result in resource exhaustion of some node resources (PIDs, sockets, inodes, etc.)?
753900

754901
<!--
@@ -761,6 +908,8 @@ Are there any tests that were run/should be run to understand performance charac
761908
and validate the declared limits?
762909
-->
763910

911+
No.
912+
764913
### Troubleshooting
765914

766915
<!--

0 commit comments

Comments
 (0)