Merge pull request #132807 from iholder101/feature/ImageVolumeWithDigest

[KEP-5365] Implement Image Volume with Digest

Kubernetes-commit: e14cdadc5a7b3c735782993d7899c9ea5df6e7b0
This commit is contained in:
Kubernetes Publisher
2025-12-17 16:25:17 -08:00
7 changed files with 128 additions and 3 deletions

View File

@@ -0,0 +1,44 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1
// ImageVolumeStatusApplyConfiguration represents a declarative configuration of the ImageVolumeStatus type for use
// with apply.
//
// ImageVolumeStatus represents the image-based volume status.
type ImageVolumeStatusApplyConfiguration struct {
// ImageRef is the digest of the image used for this volume.
// It should have a value that's similar to the pod's status.containerStatuses[i].imageID.
// The ImageRef length should not exceed 256 characters.
ImageRef *string `json:"imageRef,omitempty"`
}
// ImageVolumeStatusApplyConfiguration constructs a declarative configuration of the ImageVolumeStatus type for use with
// apply.
func ImageVolumeStatus() *ImageVolumeStatusApplyConfiguration {
return &ImageVolumeStatusApplyConfiguration{}
}
// WithImageRef sets the ImageRef field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the ImageRef field is set to the value of the last call.
func (b *ImageVolumeStatusApplyConfiguration) WithImageRef(value string) *ImageVolumeStatusApplyConfiguration {
b.ImageRef = &value
return b
}

View File

@@ -37,6 +37,9 @@ type VolumeMountStatusApplyConfiguration struct {
// An IfPossible value in the original VolumeMount must be translated to Disabled or Enabled,
// depending on the mount result.
RecursiveReadOnly *corev1.RecursiveReadOnlyMode `json:"recursiveReadOnly,omitempty"`
// volumeStatus represents volume-type-specific status about the mounted
// volume.
*VolumeStatusApplyConfiguration `json:"volumeStatus,omitempty"`
}
// VolumeMountStatusApplyConfiguration constructs a declarative configuration of the VolumeMountStatus type for use with
@@ -76,3 +79,18 @@ func (b *VolumeMountStatusApplyConfiguration) WithRecursiveReadOnly(value corev1
b.RecursiveReadOnly = &value
return b
}
// WithImage sets the Image field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Image field is set to the value of the last call.
func (b *VolumeMountStatusApplyConfiguration) WithImage(value *ImageVolumeStatusApplyConfiguration) *VolumeMountStatusApplyConfiguration {
b.ensureVolumeStatusApplyConfigurationExists()
b.VolumeStatusApplyConfiguration.Image = value
return b
}
func (b *VolumeMountStatusApplyConfiguration) ensureVolumeStatusApplyConfigurationExists() {
if b.VolumeStatusApplyConfiguration == nil {
b.VolumeStatusApplyConfiguration = &VolumeStatusApplyConfiguration{}
}
}

View File

@@ -0,0 +1,43 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1
// VolumeStatusApplyConfiguration represents a declarative configuration of the VolumeStatus type for use
// with apply.
//
// VolumeStatus represents the status of a mounted volume.
// At most one of its members must be specified.
type VolumeStatusApplyConfiguration struct {
// image represents an OCI object (a container image or artifact) pulled and mounted on the kubelet's host machine.
Image *ImageVolumeStatusApplyConfiguration `json:"image,omitempty"`
}
// VolumeStatusApplyConfiguration constructs a declarative configuration of the VolumeStatus type for use with
// apply.
func VolumeStatus() *VolumeStatusApplyConfiguration {
return &VolumeStatusApplyConfiguration{}
}
// WithImage sets the Image field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Image field is set to the value of the last call.
func (b *VolumeStatusApplyConfiguration) WithImage(value *ImageVolumeStatusApplyConfiguration) *VolumeStatusApplyConfiguration {
b.Image = value
return b
}

View File

@@ -6292,6 +6292,12 @@ var schemaYAML = typed.YAMLObject(`types:
- name: reference
type:
scalar: string
- name: io.k8s.api.core.v1.ImageVolumeStatus
map:
fields:
- name: imageRef
type:
scalar: string
- name: io.k8s.api.core.v1.KeyToPath
map:
fields:
@@ -8952,6 +8958,10 @@ var schemaYAML = typed.YAMLObject(`types:
- name: recursiveReadOnly
type:
scalar: string
- name: volumeStatus
type:
namedType: io.k8s.api.core.v1.VolumeStatus
default: {}
- name: io.k8s.api.core.v1.VolumeNodeAffinity
map:
fields:
@@ -8992,6 +9002,12 @@ var schemaYAML = typed.YAMLObject(`types:
map:
elementType:
namedType: io.k8s.apimachinery.pkg.api.resource.Quantity
- name: io.k8s.api.core.v1.VolumeStatus
map:
fields:
- name: image
type:
namedType: io.k8s.api.core.v1.ImageVolumeStatus
- name: io.k8s.api.core.v1.VsphereVirtualDiskVolumeSource
map:
fields:

View File

@@ -818,6 +818,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
return &applyconfigurationscorev1.HTTPHeaderApplyConfiguration{}
case corev1.SchemeGroupVersion.WithKind("ImageVolumeSource"):
return &applyconfigurationscorev1.ImageVolumeSourceApplyConfiguration{}
case corev1.SchemeGroupVersion.WithKind("ImageVolumeStatus"):
return &applyconfigurationscorev1.ImageVolumeStatusApplyConfiguration{}
case corev1.SchemeGroupVersion.WithKind("ISCSIPersistentVolumeSource"):
return &applyconfigurationscorev1.ISCSIPersistentVolumeSourceApplyConfiguration{}
case corev1.SchemeGroupVersion.WithKind("ISCSIVolumeSource"):
@@ -1078,6 +1080,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
return &applyconfigurationscorev1.VolumeResourceRequirementsApplyConfiguration{}
case corev1.SchemeGroupVersion.WithKind("VolumeSource"):
return &applyconfigurationscorev1.VolumeSourceApplyConfiguration{}
case corev1.SchemeGroupVersion.WithKind("VolumeStatus"):
return &applyconfigurationscorev1.VolumeStatusApplyConfiguration{}
case corev1.SchemeGroupVersion.WithKind("VsphereVirtualDiskVolumeSource"):
return &applyconfigurationscorev1.VsphereVirtualDiskVolumeSourceApplyConfiguration{}
case corev1.SchemeGroupVersion.WithKind("WeightedPodAffinityTerm"):

2
go.mod
View File

@@ -24,7 +24,7 @@ require (
golang.org/x/time v0.9.0
google.golang.org/protobuf v1.36.8
gopkg.in/evanphx/json-patch.v4 v4.13.0
k8s.io/api v0.0.0-20251204222646-382014e64b8e
k8s.io/api v0.0.0-20251218022515-cc3b8d55eb43
k8s.io/apimachinery v0.0.0-20251204222123-56aa7d5cc8bb
k8s.io/klog/v2 v2.130.1
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912

4
go.sum
View File

@@ -123,8 +123,8 @@ gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
k8s.io/api v0.0.0-20251204222646-382014e64b8e h1:pfnI6xGQHUXwuFKumPQjgzDYkBa5RKWJbWfF89vbrS4=
k8s.io/api v0.0.0-20251204222646-382014e64b8e/go.mod h1:OjSG925L2Qod5yd066wDJ6HLaA8lNCJRx5eAtCw5rOM=
k8s.io/api v0.0.0-20251218022515-cc3b8d55eb43 h1:3O08UsEzuxZLokQ1JfOHBklda+NOUKTX+4mEYtaLIzA=
k8s.io/api v0.0.0-20251218022515-cc3b8d55eb43/go.mod h1:OjSG925L2Qod5yd066wDJ6HLaA8lNCJRx5eAtCw5rOM=
k8s.io/apimachinery v0.0.0-20251204222123-56aa7d5cc8bb h1:yb4KUdenOGnO2tWDaMQFR74DE6bnjtSNCE3+InuoO6g=
k8s.io/apimachinery v0.0.0-20251204222123-56aa7d5cc8bb/go.mod h1:jQCgFZFR1F4Ik7hvr2g84RTJSZegBc8yHgFWKn//hns=
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=