From 485ae13a5886240de3aad457e44dd5152a78e42e Mon Sep 17 00:00:00 2001 From: Sascha Grunert Date: Mon, 24 Jun 2024 10:34:43 +0200 Subject: [PATCH] Add ImageVolumeSource API Adding the required Kubernetes API so that the kubelet can start using it. This patch also adds the corresponding alpha feature gate as outlined in KEP 4639. Signed-off-by: Sascha Grunert Kubernetes-commit: f7ca3131e0922563a561134b4ed9eed8d2bdd2c4 --- .../core/v1/imagevolumesource.go | 52 +++++++++++++++++++ applyconfigurations/core/v1/volume.go | 8 +++ applyconfigurations/core/v1/volumesource.go | 9 ++++ applyconfigurations/internal/internal.go | 12 +++++ applyconfigurations/utils.go | 2 + 5 files changed, 83 insertions(+) create mode 100644 applyconfigurations/core/v1/imagevolumesource.go diff --git a/applyconfigurations/core/v1/imagevolumesource.go b/applyconfigurations/core/v1/imagevolumesource.go new file mode 100644 index 00000000..340f1504 --- /dev/null +++ b/applyconfigurations/core/v1/imagevolumesource.go @@ -0,0 +1,52 @@ +/* +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 + +import ( + v1 "k8s.io/api/core/v1" +) + +// ImageVolumeSourceApplyConfiguration represents a declarative configuration of the ImageVolumeSource type for use +// with apply. +type ImageVolumeSourceApplyConfiguration struct { + Reference *string `json:"reference,omitempty"` + PullPolicy *v1.PullPolicy `json:"pullPolicy,omitempty"` +} + +// ImageVolumeSourceApplyConfiguration constructs a declarative configuration of the ImageVolumeSource type for use with +// apply. +func ImageVolumeSource() *ImageVolumeSourceApplyConfiguration { + return &ImageVolumeSourceApplyConfiguration{} +} + +// WithReference sets the Reference 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 Reference field is set to the value of the last call. +func (b *ImageVolumeSourceApplyConfiguration) WithReference(value string) *ImageVolumeSourceApplyConfiguration { + b.Reference = &value + return b +} + +// WithPullPolicy sets the PullPolicy 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 PullPolicy field is set to the value of the last call. +func (b *ImageVolumeSourceApplyConfiguration) WithPullPolicy(value v1.PullPolicy) *ImageVolumeSourceApplyConfiguration { + b.PullPolicy = &value + return b +} diff --git a/applyconfigurations/core/v1/volume.go b/applyconfigurations/core/v1/volume.go index 25de1fac..9a48f834 100644 --- a/applyconfigurations/core/v1/volume.go +++ b/applyconfigurations/core/v1/volume.go @@ -270,3 +270,11 @@ func (b *VolumeApplyConfiguration) WithEphemeral(value *EphemeralVolumeSourceApp b.Ephemeral = 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 *VolumeApplyConfiguration) WithImage(value *ImageVolumeSourceApplyConfiguration) *VolumeApplyConfiguration { + b.Image = value + return b +} diff --git a/applyconfigurations/core/v1/volumesource.go b/applyconfigurations/core/v1/volumesource.go index 59fc805a..aeead953 100644 --- a/applyconfigurations/core/v1/volumesource.go +++ b/applyconfigurations/core/v1/volumesource.go @@ -50,6 +50,7 @@ type VolumeSourceApplyConfiguration struct { StorageOS *StorageOSVolumeSourceApplyConfiguration `json:"storageos,omitempty"` CSI *CSIVolumeSourceApplyConfiguration `json:"csi,omitempty"` Ephemeral *EphemeralVolumeSourceApplyConfiguration `json:"ephemeral,omitempty"` + Image *ImageVolumeSourceApplyConfiguration `json:"image,omitempty"` } // VolumeSourceApplyConfiguration constructs a declarative configuration of the VolumeSource type for use with @@ -289,3 +290,11 @@ func (b *VolumeSourceApplyConfiguration) WithEphemeral(value *EphemeralVolumeSou b.Ephemeral = 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 *VolumeSourceApplyConfiguration) WithImage(value *ImageVolumeSourceApplyConfiguration) *VolumeSourceApplyConfiguration { + b.Image = value + return b +} diff --git a/applyconfigurations/internal/internal.go b/applyconfigurations/internal/internal.go index ebaa3a15..21adbdc4 100644 --- a/applyconfigurations/internal/internal.go +++ b/applyconfigurations/internal/internal.go @@ -5762,6 +5762,15 @@ var schemaYAML = typed.YAMLObject(`types: type: scalar: string default: "" +- name: io.k8s.api.core.v1.ImageVolumeSource + map: + fields: + - name: pullPolicy + type: + scalar: string + - name: reference + type: + scalar: string - name: io.k8s.api.core.v1.KeyToPath map: fields: @@ -8209,6 +8218,9 @@ var schemaYAML = typed.YAMLObject(`types: - name: hostPath type: namedType: io.k8s.api.core.v1.HostPathVolumeSource + - name: image + type: + namedType: io.k8s.api.core.v1.ImageVolumeSource - name: iscsi type: namedType: io.k8s.api.core.v1.ISCSIVolumeSource diff --git a/applyconfigurations/utils.go b/applyconfigurations/utils.go index 7633e84f..a086500f 100644 --- a/applyconfigurations/utils.go +++ b/applyconfigurations/utils.go @@ -754,6 +754,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &applyconfigurationscorev1.HTTPGetActionApplyConfiguration{} case corev1.SchemeGroupVersion.WithKind("HTTPHeader"): return &applyconfigurationscorev1.HTTPHeaderApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ImageVolumeSource"): + return &applyconfigurationscorev1.ImageVolumeSourceApplyConfiguration{} case corev1.SchemeGroupVersion.WithKind("ISCSIPersistentVolumeSource"): return &applyconfigurationscorev1.ISCSIPersistentVolumeSourceApplyConfiguration{} case corev1.SchemeGroupVersion.WithKind("ISCSIVolumeSource"):