From 370797542fb20b934fbdd9f919eac37c26c140af Mon Sep 17 00:00:00 2001 From: Rohit Kumar Date: Thu, 2 Jul 2026 16:18:29 +0530 Subject: [PATCH 1/2] Remove the deprecated image field Signed-off-by: Rohit Kumar --- api/compute/v1alpha1/machine_types.go | 6 --- api/compute/v1alpha1/util.go | 4 -- api/compute/v1alpha1/zz_generated.deepcopy.go | 5 --- api/storage/v1alpha1/volume_types.go | 6 --- api/storage/v1alpha1/zz_generated.deepcopy.go | 5 --- broker/machinebroker/server/machine_create.go | 1 - broker/volumebroker/server/volume.go | 1 - broker/volumebroker/server/volume_create.go | 8 +--- .../volumebroker/server/volume_create_test.go | 1 - .../compute/v1alpha1/machinespec.go | 21 ---------- .../storage/v1alpha1/volumespec.go | 21 ---------- client-go/openapi/api_violations.report | 1 - client-go/openapi/zz_generated.openapi.go | 26 ------------- config/samples/compute_v1alpha1_machine.yaml | 1 - .../bases/loadbalancer-public/machine1.yaml | 6 ++- .../bases/loadbalancer-public/machine2.yaml | 6 ++- .../machine.yaml | 6 ++- .../volume.yaml | 4 +- .../e2e/bases/network-peering/machine1.yaml | 4 +- .../e2e/bases/network-peering/machine2.yaml | 4 +- .../e2e/bases/network-policy/machine1.yaml | 4 +- .../e2e/bases/network-policy/machine2.yaml | 4 +- .../samples/e2e/loadbalancer-public/README.md | 6 ++- .../README.md | 4 +- .../README.md | 6 ++- config/samples/e2e/network-peering/README.md | 6 ++- config/samples/e2e/network-policy/README.md | 6 ++- config/samples/storage_v1alpha1_volume.yaml | 7 ++-- ...v1alpha1_volume_restore_from_snapshot.yaml | 14 +++++++ docs/usage/compute/machine.md | 8 ++-- gen/swagger.json | 30 +++++++-------- ...ompute.ironcore.dev__v1alpha1_openapi.json | 38 ++++++++----------- ...torage.ironcore.dev__v1alpha1_openapi.json | 12 ------ internal/apis/compute/machine_types.go | 4 -- internal/apis/compute/util.go | 4 -- .../v1alpha1/zz_generated.conversion.go | 4 -- internal/apis/compute/validation/machine.go | 7 ---- .../apis/compute/validation/machine_test.go | 10 ----- .../apis/compute/zz_generated.deepcopy.go | 5 --- .../v1alpha1/zz_generated.conversion.go | 4 -- internal/apis/storage/validation/volume.go | 13 ------- .../apis/storage/validation/volume_test.go | 18 +-------- internal/apis/storage/volume_types.go | 5 --- .../apis/storage/zz_generated.deepcopy.go | 5 --- .../compute/machineclass_controller_test.go | 1 - .../compute/machine/storage/tableconvertor.go | 5 --- .../storage/volume/storage/tableconvertor.go | 5 --- iri/apis/volume/v1alpha1/api.pb.go | 11 +----- iri/apis/volume/v1alpha1/api.proto | 1 - irictl-volume/tableconverters/volume.go | 1 - .../controllers/machine_controller.go | 4 -- .../controllers/volume_controller.go | 1 - .../controllers/volume_controller_test.go | 4 -- 53 files changed, 99 insertions(+), 295 deletions(-) create mode 100644 config/samples/storage_v1alpha1_volume_restore_from_snapshot.yaml diff --git a/api/compute/v1alpha1/machine_types.go b/api/compute/v1alpha1/machine_types.go index 6f85b134a..1871aea80 100644 --- a/api/compute/v1alpha1/machine_types.go +++ b/api/compute/v1alpha1/machine_types.go @@ -23,12 +23,6 @@ type MachineSpec struct { // Power is the desired machine power state. // Defaults to PowerOn. Power Power `json:"power,omitempty"` - // Deprecated: Use LocalDisk to provide a bootable disk - // Image is the optional URL providing the operating system image of the machine. - // +optional - Image string `json:"image,omitempty"` - // ImagePullSecretRef is an optional secret for pulling the image of a machine. - ImagePullSecretRef *corev1.LocalObjectReference `json:"imagePullSecret,omitempty"` // NetworkInterfaces define a list of network interfaces present on the machine // +optional // +patchMergeKey=name diff --git a/api/compute/v1alpha1/util.go b/api/compute/v1alpha1/util.go index 9d66c2c5d..60ab64519 100644 --- a/api/compute/v1alpha1/util.go +++ b/api/compute/v1alpha1/util.go @@ -68,10 +68,6 @@ func MachineVolumeNames(machine *Machine) []string { func MachineSecretNames(machine *Machine) []string { var names []string - if imagePullSecretRef := machine.Spec.ImagePullSecretRef; imagePullSecretRef != nil { - names = append(names, imagePullSecretRef.Name) - } - if ignitionRef := machine.Spec.IgnitionRef; ignitionRef != nil { names = append(names, ignitionRef.Name) } diff --git a/api/compute/v1alpha1/zz_generated.deepcopy.go b/api/compute/v1alpha1/zz_generated.deepcopy.go index 95e79d7df..5808efb15 100644 --- a/api/compute/v1alpha1/zz_generated.deepcopy.go +++ b/api/compute/v1alpha1/zz_generated.deepcopy.go @@ -514,11 +514,6 @@ func (in *MachineSpec) DeepCopyInto(out *MachineSpec) { *out = new(v1.LocalObjectReference) **out = **in } - if in.ImagePullSecretRef != nil { - in, out := &in.ImagePullSecretRef, &out.ImagePullSecretRef - *out = new(v1.LocalObjectReference) - **out = **in - } if in.NetworkInterfaces != nil { in, out := &in.NetworkInterfaces, &out.NetworkInterfaces *out = make([]NetworkInterface, len(*in)) diff --git a/api/storage/v1alpha1/volume_types.go b/api/storage/v1alpha1/volume_types.go index 03168752d..72fffd76b 100644 --- a/api/storage/v1alpha1/volume_types.go +++ b/api/storage/v1alpha1/volume_types.go @@ -31,11 +31,6 @@ type VolumeSpec struct { ClaimRef *commonv1alpha1.LocalUIDReference `json:"claimRef,omitempty"` // Resources is a description of the volume's resources and capacity. Resources corev1alpha1.ResourceList `json:"resources,omitempty"` - // Image is an optional image to bootstrap the volume with. - // To be deprecated - Image string `json:"image,omitempty"` - // ImagePullSecretRef is an optional secret for pulling the image of a volume. - ImagePullSecretRef *corev1.LocalObjectReference `json:"imagePullSecretRef,omitempty"` // Unclaimable marks the volume as unclaimable. Unclaimable bool `json:"unclaimable,omitempty"` // Tolerations define tolerations the Volume has. Only any VolumePool whose taints @@ -58,7 +53,6 @@ type VolumeDataSource struct { type OSDataSource struct { // Image is an optional image to bootstrap the volume with. Image string `json:"image,omitempty"` - // Architecture defines the architecture of the OS which should be used Architecture *string `json:"architecture,omitempty"` } diff --git a/api/storage/v1alpha1/zz_generated.deepcopy.go b/api/storage/v1alpha1/zz_generated.deepcopy.go index f43120767..eca6998cd 100644 --- a/api/storage/v1alpha1/zz_generated.deepcopy.go +++ b/api/storage/v1alpha1/zz_generated.deepcopy.go @@ -887,11 +887,6 @@ func (in *VolumeSpec) DeepCopyInto(out *VolumeSpec) { (*out)[key] = val.DeepCopy() } } - if in.ImagePullSecretRef != nil { - in, out := &in.ImagePullSecretRef, &out.ImagePullSecretRef - *out = new(v1.LocalObjectReference) - **out = **in - } if in.Tolerations != nil { in, out := &in.Tolerations, &out.Tolerations *out = make([]commonv1alpha1.Toleration, len(*in)) diff --git a/broker/machinebroker/server/machine_create.go b/broker/machinebroker/server/machine_create.go index 7585eb109..5023a5b9d 100644 --- a/broker/machinebroker/server/machine_create.go +++ b/broker/machinebroker/server/machine_create.go @@ -211,7 +211,6 @@ func (s *Server) createIronCoreMachine( MachinePoolSelector: s.cluster.MachinePoolSelector(), MachinePoolRef: s.ironcoreMachinePoolRef(), Power: cfg.Power, - ImagePullSecretRef: nil, // TODO: Specify as soon as available. NetworkInterfaces: ironcoreMachineNics, Volumes: ironcoreMachineVolumes, IgnitionRef: ignitionRef, diff --git a/broker/volumebroker/server/volume.go b/broker/volumebroker/server/volume.go index 763d4a9e2..7d68c31ed 100644 --- a/broker/volumebroker/server/volume.go +++ b/broker/volumebroker/server/volume.go @@ -42,7 +42,6 @@ func (s *Server) convertAggregateIronCoreVolume(volume *AggregateIronCoreVolume) return &iri.Volume{ Metadata: metadata, Spec: &iri.VolumeSpec{ - Image: volume.Volume.Spec.Image, Class: volume.Volume.Spec.VolumeClassRef.Name, Resources: resources, Encryption: s.convertIronCoreVolumeEncryption(volume), diff --git a/broker/volumebroker/server/volume_create.go b/broker/volumebroker/server/volume_create.go index b43826522..1d758a05b 100644 --- a/broker/volumebroker/server/volume_create.go +++ b/broker/volumebroker/server/volume_create.go @@ -68,16 +68,13 @@ func (s *Server) getIronCoreVolumeConfig(_ context.Context, volume *iri.Volume) ) labels[volumepoolletv1alpha1.VolumeUIDLabel] = volume.GetMetadata().GetLabels()[volumepoolletv1alpha1.VolumeUIDLabel] - var image string var volumeSnapshotRef *corev1.LocalObjectReference var osImageDataSource *storagev1alpha1.OSDataSource - image = volume.Spec.Image // TODO: Remove this once volume.Spec.Image is deprecated if dataSource := volume.Spec.VolumeDataSource; dataSource != nil { switch { case dataSource.SnapshotDataSource != nil: volumeSnapshotRef = &corev1.LocalObjectReference{Name: dataSource.SnapshotDataSource.SnapshotId} - image = "" // TODO: Remove this once volume.Spec.Image is deprecated case dataSource.ImageDataSource != nil: var architecture *string if dataSource.ImageDataSource.Architecture != "" { @@ -88,7 +85,6 @@ func (s *Server) getIronCoreVolumeConfig(_ context.Context, volume *iri.Volume) Image: dataSource.ImageDataSource.Image, Architecture: architecture, } - image = dataSource.ImageDataSource.Image } } @@ -107,9 +103,7 @@ func (s *Server) getIronCoreVolumeConfig(_ context.Context, volume *iri.Volume) Resources: corev1alpha1.ResourceList{ corev1alpha1.ResourceStorage: *resource.NewQuantity(volume.Spec.Resources.StorageBytes, resource.DecimalSI), }, - Image: image, // TODO: Remove this once volume.Spec.Image is deprecated - ImagePullSecretRef: nil, // TODO: Fill if necessary - Encryption: encryption, + Encryption: encryption, DataSource: storagev1alpha1.VolumeDataSource{ VolumeSnapshotRef: volumeSnapshotRef, OSImage: osImageDataSource, diff --git a/broker/volumebroker/server/volume_create_test.go b/broker/volumebroker/server/volume_create_test.go index 33d95c018..fb79d67d7 100644 --- a/broker/volumebroker/server/volume_create_test.go +++ b/broker/volumebroker/server/volume_create_test.go @@ -112,7 +112,6 @@ var _ = Describe("CreateVolume", func() { Image: "test-image", Architecture: ptr.To("amd64"), }), - HaveField("Spec.Image", "test-image"), HaveField("Spec.Resources", HaveLen(1)), )) }) diff --git a/client-go/applyconfigurations/compute/v1alpha1/machinespec.go b/client-go/applyconfigurations/compute/v1alpha1/machinespec.go index db10bc18a..c5822cd7a 100644 --- a/client-go/applyconfigurations/compute/v1alpha1/machinespec.go +++ b/client-go/applyconfigurations/compute/v1alpha1/machinespec.go @@ -26,11 +26,6 @@ type MachineSpecApplyConfiguration struct { // Power is the desired machine power state. // Defaults to PowerOn. Power *computev1alpha1.Power `json:"power,omitempty"` - // Deprecated: Use LocalDisk to provide a bootable disk - // Image is the optional URL providing the operating system image of the machine. - Image *string `json:"image,omitempty"` - // ImagePullSecretRef is an optional secret for pulling the image of a machine. - ImagePullSecretRef *v1.LocalObjectReference `json:"imagePullSecret,omitempty"` // NetworkInterfaces define a list of network interfaces present on the machine NetworkInterfaces []NetworkInterfaceApplyConfiguration `json:"networkInterfaces,omitempty"` // Volumes are volumes attached to this machine. @@ -91,22 +86,6 @@ func (b *MachineSpecApplyConfiguration) WithPower(value computev1alpha1.Power) * 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 *MachineSpecApplyConfiguration) WithImage(value string) *MachineSpecApplyConfiguration { - b.Image = &value - return b -} - -// WithImagePullSecretRef sets the ImagePullSecretRef 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 ImagePullSecretRef field is set to the value of the last call. -func (b *MachineSpecApplyConfiguration) WithImagePullSecretRef(value v1.LocalObjectReference) *MachineSpecApplyConfiguration { - b.ImagePullSecretRef = &value - return b -} - // WithNetworkInterfaces adds the given value to the NetworkInterfaces field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the NetworkInterfaces field. diff --git a/client-go/applyconfigurations/storage/v1alpha1/volumespec.go b/client-go/applyconfigurations/storage/v1alpha1/volumespec.go index 26a9bfe00..1d8d10f52 100644 --- a/client-go/applyconfigurations/storage/v1alpha1/volumespec.go +++ b/client-go/applyconfigurations/storage/v1alpha1/volumespec.go @@ -28,11 +28,6 @@ type VolumeSpecApplyConfiguration struct { ClaimRef *commonv1alpha1.LocalUIDReference `json:"claimRef,omitempty"` // Resources is a description of the volume's resources and capacity. Resources *corev1alpha1.ResourceList `json:"resources,omitempty"` - // Image is an optional image to bootstrap the volume with. - // To be deprecated - Image *string `json:"image,omitempty"` - // ImagePullSecretRef is an optional secret for pulling the image of a volume. - ImagePullSecretRef *v1.LocalObjectReference `json:"imagePullSecretRef,omitempty"` // Unclaimable marks the volume as unclaimable. Unclaimable *bool `json:"unclaimable,omitempty"` // Tolerations define tolerations the Volume has. Only any VolumePool whose taints @@ -96,22 +91,6 @@ func (b *VolumeSpecApplyConfiguration) WithResources(value corev1alpha1.Resource 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 *VolumeSpecApplyConfiguration) WithImage(value string) *VolumeSpecApplyConfiguration { - b.Image = &value - return b -} - -// WithImagePullSecretRef sets the ImagePullSecretRef 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 ImagePullSecretRef field is set to the value of the last call. -func (b *VolumeSpecApplyConfiguration) WithImagePullSecretRef(value v1.LocalObjectReference) *VolumeSpecApplyConfiguration { - b.ImagePullSecretRef = &value - return b -} - // WithUnclaimable sets the Unclaimable 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 Unclaimable field is set to the value of the last call. diff --git a/client-go/openapi/api_violations.report b/client-go/openapi/api_violations.report index ef96966c9..758348e99 100644 --- a/client-go/openapi/api_violations.report +++ b/client-go/openapi/api_violations.report @@ -46,7 +46,6 @@ API rule violation: list_type_missing,github.com/ironcore-dev/ironcore/api/stora API rule violation: list_type_missing,github.com/ironcore-dev/ironcore/api/storage/v1alpha1,VolumePoolStatus,Conditions API rule violation: list_type_missing,github.com/ironcore-dev/ironcore/api/storage/v1alpha1,VolumeSpec,Tolerations API rule violation: list_type_missing,github.com/ironcore-dev/ironcore/api/storage/v1alpha1,VolumeStatus,Conditions -API rule violation: names_match,github.com/ironcore-dev/ironcore/api/compute/v1alpha1,MachineSpec,ImagePullSecretRef API rule violation: names_match,github.com/ironcore-dev/ironcore/api/networking/v1alpha1,LoadBalancerSpec,IPs API rule violation: names_match,github.com/ironcore-dev/ironcore/api/networking/v1alpha1,LoadBalancerStatus,IPs API rule violation: names_match,github.com/ironcore-dev/ironcore/api/networking/v1alpha1,NATGatewayStatus,IPs diff --git a/client-go/openapi/zz_generated.openapi.go b/client-go/openapi/zz_generated.openapi.go index fd12f8359..a03ecc0e3 100644 --- a/client-go/openapi/zz_generated.openapi.go +++ b/client-go/openapi/zz_generated.openapi.go @@ -1558,19 +1558,6 @@ func schema_ironcore_api_compute_v1alpha1_MachineSpec(ref common.ReferenceCallba Format: "", }, }, - "image": { - SchemaProps: spec.SchemaProps{ - Description: "Deprecated: Use LocalDisk to provide a bootable disk Image is the optional URL providing the operating system image of the machine.", - Type: []string{"string"}, - Format: "", - }, - }, - "imagePullSecret": { - SchemaProps: spec.SchemaProps{ - Description: "ImagePullSecretRef is an optional secret for pulling the image of a machine.", - Ref: ref(v1.LocalObjectReference{}.OpenAPIModelName()), - }, - }, "networkInterfaces": { VendorExtensible: spec.VendorExtensible{ Extensions: spec.Extensions{ @@ -6249,19 +6236,6 @@ func schema_ironcore_api_storage_v1alpha1_VolumeSpec(ref common.ReferenceCallbac }, }, }, - "image": { - SchemaProps: spec.SchemaProps{ - Description: "Image is an optional image to bootstrap the volume with. To be deprecated", - Type: []string{"string"}, - Format: "", - }, - }, - "imagePullSecretRef": { - SchemaProps: spec.SchemaProps{ - Description: "ImagePullSecretRef is an optional secret for pulling the image of a volume.", - Ref: ref(v1.LocalObjectReference{}.OpenAPIModelName()), - }, - }, "unclaimable": { SchemaProps: spec.SchemaProps{ Description: "Unclaimable marks the volume as unclaimable.", diff --git a/config/samples/compute_v1alpha1_machine.yaml b/config/samples/compute_v1alpha1_machine.yaml index 86c897009..9a0fc7a5a 100644 --- a/config/samples/compute_v1alpha1_machine.yaml +++ b/config/samples/compute_v1alpha1_machine.yaml @@ -7,7 +7,6 @@ spec: name: machineclass-sample # machinePoolRef: # name: default - image: my-image volumes: - name: rootdisk # first disk is root disk # priority: 0 # optional diff --git a/config/samples/e2e/bases/loadbalancer-public/machine1.yaml b/config/samples/e2e/bases/loadbalancer-public/machine1.yaml index 07ea78f2f..3c3a3477e 100644 --- a/config/samples/e2e/bases/loadbalancer-public/machine1.yaml +++ b/config/samples/e2e/bases/loadbalancer-public/machine1.yaml @@ -35,6 +35,8 @@ spec: spec: volumeClassRef: name: volumeclass-sample - image: gardenlinux:rootfs-image resources: - storage: 10Gi \ No newline at end of file + storage: 10Gi + dataSource: + osImage: + image: gardenlinux:rootfs-image diff --git a/config/samples/e2e/bases/loadbalancer-public/machine2.yaml b/config/samples/e2e/bases/loadbalancer-public/machine2.yaml index 978953496..664baa3f2 100644 --- a/config/samples/e2e/bases/loadbalancer-public/machine2.yaml +++ b/config/samples/e2e/bases/loadbalancer-public/machine2.yaml @@ -35,6 +35,8 @@ spec: spec: volumeClassRef: name: volumeclass-sample - image: gardenlinux:rootfs-image resources: - storage: 10Gi \ No newline at end of file + storage: 10Gi + dataSource: + osImage: + image: gardenlinux:rootfs-image diff --git a/config/samples/e2e/bases/machine-with-ephemeral-resources/machine.yaml b/config/samples/e2e/bases/machine-with-ephemeral-resources/machine.yaml index 4e4914b3d..2cdd90508 100644 --- a/config/samples/e2e/bases/machine-with-ephemeral-resources/machine.yaml +++ b/config/samples/e2e/bases/machine-with-ephemeral-resources/machine.yaml @@ -32,6 +32,8 @@ spec: spec: volumeClassRef: name: volumeclass-sample - image: gardenlinux:rootfs-image resources: - storage: 10Gi \ No newline at end of file + storage: 10Gi + dataSource: + osImage: + image: gardenlinux:rootfs-image diff --git a/config/samples/e2e/bases/machine-with-nonephemeral-resources/volume.yaml b/config/samples/e2e/bases/machine-with-nonephemeral-resources/volume.yaml index fc08d2dcc..4a436efd1 100644 --- a/config/samples/e2e/bases/machine-with-nonephemeral-resources/volume.yaml +++ b/config/samples/e2e/bases/machine-with-nonephemeral-resources/volume.yaml @@ -5,6 +5,8 @@ metadata: spec: volumeClassRef: name: volumeclass-sample - image: gardenlinux:rootfs-image resources: storage: 10Gi + dataSource: + osImage: + image: gardenlinux:rootfs-image diff --git a/config/samples/e2e/bases/network-peering/machine1.yaml b/config/samples/e2e/bases/network-peering/machine1.yaml index 753292d72..d37adef12 100644 --- a/config/samples/e2e/bases/network-peering/machine1.yaml +++ b/config/samples/e2e/bases/network-peering/machine1.yaml @@ -32,7 +32,9 @@ spec: spec: volumeClassRef: name: volumeclass-sample - image: gardenlinux:rootfs-image resources: storage: 10Gi + dataSource: + osImage: + image: gardenlinux:rootfs-image diff --git a/config/samples/e2e/bases/network-peering/machine2.yaml b/config/samples/e2e/bases/network-peering/machine2.yaml index b0e3adb63..38b9c437b 100644 --- a/config/samples/e2e/bases/network-peering/machine2.yaml +++ b/config/samples/e2e/bases/network-peering/machine2.yaml @@ -32,7 +32,9 @@ spec: spec: volumeClassRef: name: volumeclass-sample - image: gardenlinux:rootfs-image resources: storage: 10Gi + dataSource: + osImage: + image: gardenlinux:rootfs-image diff --git a/config/samples/e2e/bases/network-policy/machine1.yaml b/config/samples/e2e/bases/network-policy/machine1.yaml index 92e72c110..a7e512a3b 100644 --- a/config/samples/e2e/bases/network-policy/machine1.yaml +++ b/config/samples/e2e/bases/network-policy/machine1.yaml @@ -35,7 +35,9 @@ spec: spec: volumeClassRef: name: volumeclass-sample - image: gardenlinux:rootfs-image resources: storage: 10Gi + dataSource: + osImage: + image: gardenlinux:rootfs-image diff --git a/config/samples/e2e/bases/network-policy/machine2.yaml b/config/samples/e2e/bases/network-policy/machine2.yaml index b8c78f202..4d4f06aa2 100644 --- a/config/samples/e2e/bases/network-policy/machine2.yaml +++ b/config/samples/e2e/bases/network-policy/machine2.yaml @@ -35,7 +35,9 @@ spec: spec: volumeClassRef: name: volumeclass-sample - image: gardenlinux:rootfs-image resources: storage: 10Gi + dataSource: + osImage: + image: gardenlinux:rootfs-image diff --git a/config/samples/e2e/loadbalancer-public/README.md b/config/samples/e2e/loadbalancer-public/README.md index 09773da5a..86ee1e68e 100644 --- a/config/samples/e2e/loadbalancer-public/README.md +++ b/config/samples/e2e/loadbalancer-public/README.md @@ -38,9 +38,11 @@ spec: name: new-volumeClass volumePoolRef: name: new-volumePool - image: gardenlinux:rootfs-dev-20231025 resources: storage: 15Gi + dataSource: + osImage: + image: gardenlinux:rootfs-dev-20231025 ``` 5. Update the `kustomization.yaml` with below content @@ -49,4 +51,4 @@ patches: - path: patch-machine.yaml ``` -6. Run (`kubectl apply -k ./`) \ No newline at end of file +6. Run (`kubectl apply -k ./`) diff --git a/config/samples/e2e/machine-with-ephemeral-resources/README.md b/config/samples/e2e/machine-with-ephemeral-resources/README.md index 99b6ea112..823ae1b5e 100644 --- a/config/samples/e2e/machine-with-ephemeral-resources/README.md +++ b/config/samples/e2e/machine-with-ephemeral-resources/README.md @@ -36,9 +36,11 @@ spec: name: new-volumeClass volumePoolRef: name: new-volumePool - image: gardenlinux:rootfs-dev-20231025 resources: storage: 15Gi + dataSource: + osImage: + image: gardenlinux:rootfs-dev-20231025 ``` 5. Update the `kustomization.yaml` with below content diff --git a/config/samples/e2e/machine-with-non-ephemeral-resources/README.md b/config/samples/e2e/machine-with-non-ephemeral-resources/README.md index 85463e53f..70150a62c 100644 --- a/config/samples/e2e/machine-with-non-ephemeral-resources/README.md +++ b/config/samples/e2e/machine-with-non-ephemeral-resources/README.md @@ -39,9 +39,11 @@ metadata: spec: volumeClassRef: name: new-volumeClass - image: new-image:rootfs volumePoolRef: name: new-volumePool + dataSource: + osImage: + image: gardenlinux:rootfs-dev-20231025 ``` 6. Update the `kustomization.yaml` with below content ``` @@ -49,4 +51,4 @@ patches: - path: patch-machine.yaml - path: patch-volume.yaml ``` -7. Run (`kubectl apply -k ./`) \ No newline at end of file +7. Run (`kubectl apply -k ./`) diff --git a/config/samples/e2e/network-peering/README.md b/config/samples/e2e/network-peering/README.md index edee32d82..3bee2857a 100644 --- a/config/samples/e2e/network-peering/README.md +++ b/config/samples/e2e/network-peering/README.md @@ -36,9 +36,11 @@ spec: name: new-volumeClass volumePoolRef: name: new-volumePool - image: gardenlinux:rootfs-dev-20231025 resources: storage: 15Gi + dataSource: + osImage: + image: gardenlinux:rootfs-dev-20231025 ``` 5. Update the `kustomization.yaml` with below content @@ -47,4 +49,4 @@ patches: - path: patch-machine.yaml ``` -6. Run (`kubectl apply -k ./`) \ No newline at end of file +6. Run (`kubectl apply -k ./`) diff --git a/config/samples/e2e/network-policy/README.md b/config/samples/e2e/network-policy/README.md index ca30b2637..e24a3c157 100644 --- a/config/samples/e2e/network-policy/README.md +++ b/config/samples/e2e/network-policy/README.md @@ -38,9 +38,11 @@ spec: name: new-volumeClass volumePoolRef: name: new-volumePool - image: gardenlinux:rootfs-dev-20231025 resources: storage: 15Gi + dataSource: + osImage: + image: gardenlinux:rootfs-dev-20231025 ``` 5. Update the `kustomization.yaml` with below content @@ -49,4 +51,4 @@ patches: - path: patch-machine.yaml ``` -6. Run (`kubectl apply -k ./`) \ No newline at end of file +6. Run (`kubectl apply -k ./`) diff --git a/config/samples/storage_v1alpha1_volume.yaml b/config/samples/storage_v1alpha1_volume.yaml index 929be7463..c6f81cb21 100644 --- a/config/samples/storage_v1alpha1_volume.yaml +++ b/config/samples/storage_v1alpha1_volume.yaml @@ -9,7 +9,6 @@ spec: # name: volumepool-sample resources: storage: 100Gi -# volumeSnapshotRef: -# name: volume-snapshot-sample -# osImage: -# name: ghcr.io/ironcore-dev/gardenlinux:latest + # dataSource: + # osImage: + # image: gardenlinux:rootfs-image diff --git a/config/samples/storage_v1alpha1_volume_restore_from_snapshot.yaml b/config/samples/storage_v1alpha1_volume_restore_from_snapshot.yaml new file mode 100644 index 000000000..dc9623150 --- /dev/null +++ b/config/samples/storage_v1alpha1_volume_restore_from_snapshot.yaml @@ -0,0 +1,14 @@ +apiVersion: storage.ironcore.dev/v1alpha1 +kind: Volume +metadata: + name: restored-volume +spec: + volumeClassRef: + name: volumeclass-sample + # volumePoolRef: + # name: volumepool-sample + resources: + storage: 100Gi + dataSource: + volumeSnapshotRef: + name: volume-snapshot-sample diff --git a/docs/usage/compute/machine.md b/docs/usage/compute/machine.md index e502cb46f..18887fb47 100644 --- a/docs/usage/compute/machine.md +++ b/docs/usage/compute/machine.md @@ -15,7 +15,6 @@ metadata: spec: machineClassRef: name: machineclass-sample - image: my-image volumes: - name: rootdisk # first disk is the root disk volumeRef: @@ -33,7 +32,6 @@ spec: - machineClassRef (`string`): machineClassRef is a reference to the machine class/flavor of the machine. - machinePoolRef (`string`): machinePoolRef defines the machine pool to run the machine in. If empty, a scheduler will figure out an appropriate pool to run the machine in. -- image (`string`): image is the optional URL providing the operating system image of the machine. - volumes (`list`): volumes are list volumes(storage) attached to this machine. - networkInterfaces (`list`): networkInterfaces define a list of network interfaces present on the machine - ignitionRef (`string`): ignitionRef is a reference to a `secret` containing the ignition YAML for the machine to boot up. If a key is empty, `DefaultIgnitionKey` will be used as a fallback. (`Note`: Refer to Sample Ignition for creating ignition secret) @@ -68,6 +66,6 @@ The `MachineScheduler` controller continuously watches for `Machines` without an A Machine can be in the following states: 1. **Pending**: A Machine is in a Pending state when the Machine has been accepted by the system, but not yet completely started. This includes time before being bound to a MachinePool, as well as time spent setting up the Machine on that MachinePool. 2. **Running**: A Machine in Running state when the machine is running on a MachinePool. -2. **Shutdown**: A Machine is in a Shutdown state. -3. **Terminating**: A Machine is Terminating. -2. **Terminated**: A Machine is in the Terminated state when the machine has been permanently stopped and cannot be started. \ No newline at end of file +3. **Shutdown**: A Machine is in a Shutdown state. +4. **Terminating**: A Machine is Terminating. +5. **Terminated**: A Machine is in the Terminated state when the machine has been permanently stopped and cannot be started. diff --git a/gen/swagger.json b/gen/swagger.json index d05807ee9..afb9b097c 100644 --- a/gen/swagger.json +++ b/gen/swagger.json @@ -71372,6 +71372,16 @@ } } }, + "com.github.ironcore-dev.ironcore.api.compute.v1alpha1.MachineGuestConfig": { + "description": "MachineGuestConfig contains guest OS level configuration for the machine.", + "type": "object", + "properties": { + "hostname": { + "description": "Hostname is the desired hostname of the machine.", + "type": "string" + } + } + }, "com.github.ironcore-dev.ironcore.api.compute.v1alpha1.MachineList": { "description": "MachineList contains a list of Machine", "type": "object", @@ -71617,18 +71627,14 @@ "x-kubernetes-patch-merge-key": "name", "x-kubernetes-patch-strategy": "merge,retainKeys" }, + "guestConfig": { + "description": "GuestConfig contains guest OS level configuration for the machine.", + "$ref": "#/definitions/com.github.ironcore-dev.ironcore.api.compute.v1alpha1.MachineGuestConfig" + }, "ignitionRef": { "description": "IgnitionRef is a reference to a secret containing the ignition YAML for the machine to boot up. If key is empty, DefaultIgnitionKey will be used as fallback.", "$ref": "#/definitions/com.github.ironcore-dev.ironcore.api.common.v1alpha1.SecretKeySelector" }, - "image": { - "description": "Deprecated: Use LocalDisk to provide a bootable disk Image is the optional URL providing the operating system image of the machine.", - "type": "string" - }, - "imagePullSecret": { - "description": "ImagePullSecretRef is an optional secret for pulling the image of a machine.", - "$ref": "#/definitions/io.k8s.api.core.v1.LocalObjectReference" - }, "machineClassRef": { "description": "MachineClassRef is a reference to the machine class/flavor of the machine.", "$ref": "#/definitions/io.k8s.api.core.v1.LocalObjectReference" @@ -74314,14 +74320,6 @@ "description": "Encryption is an optional field which provides attributes to encrypt Volume.", "$ref": "#/definitions/com.github.ironcore-dev.ironcore.api.storage.v1alpha1.VolumeEncryption" }, - "image": { - "description": "Image is an optional image to bootstrap the volume with. To be deprecated", - "type": "string" - }, - "imagePullSecretRef": { - "description": "ImagePullSecretRef is an optional secret for pulling the image of a volume.", - "$ref": "#/definitions/io.k8s.api.core.v1.LocalObjectReference" - }, "resources": { "description": "Resources is a description of the volume's resources and capacity.", "type": "object", diff --git a/gen/v3/apis__compute.ironcore.dev__v1alpha1_openapi.json b/gen/v3/apis__compute.ironcore.dev__v1alpha1_openapi.json index 12a6cc149..7158bd449 100644 --- a/gen/v3/apis__compute.ironcore.dev__v1alpha1_openapi.json +++ b/gen/v3/apis__compute.ironcore.dev__v1alpha1_openapi.json @@ -4375,6 +4375,16 @@ } } }, + "com.github.ironcore-dev.ironcore.api.compute.v1alpha1.MachineGuestConfig": { + "description": "MachineGuestConfig contains guest OS level configuration for the machine.", + "type": "object", + "properties": { + "hostname": { + "description": "Hostname is the desired hostname of the machine.", + "type": "string" + } + } + }, "com.github.ironcore-dev.ironcore.api.compute.v1alpha1.MachineList": { "description": "MachineList contains a list of Machine", "type": "object", @@ -4701,23 +4711,19 @@ "x-kubernetes-patch-merge-key": "name", "x-kubernetes-patch-strategy": "merge,retainKeys" }, - "ignitionRef": { - "description": "IgnitionRef is a reference to a secret containing the ignition YAML for the machine to boot up. If key is empty, DefaultIgnitionKey will be used as fallback.", + "guestConfig": { + "description": "GuestConfig contains guest OS level configuration for the machine.", "allOf": [ { - "$ref": "#/components/schemas/com.github.ironcore-dev.ironcore.api.common.v1alpha1.SecretKeySelector" + "$ref": "#/components/schemas/com.github.ironcore-dev.ironcore.api.compute.v1alpha1.MachineGuestConfig" } ] }, - "image": { - "description": "Deprecated: Use LocalDisk to provide a bootable disk Image is the optional URL providing the operating system image of the machine.", - "type": "string" - }, - "imagePullSecret": { - "description": "ImagePullSecretRef is an optional secret for pulling the image of a machine.", + "ignitionRef": { + "description": "IgnitionRef is a reference to a secret containing the ignition YAML for the machine to boot up. If key is empty, DefaultIgnitionKey will be used as fallback.", "allOf": [ { - "$ref": "#/components/schemas/io.k8s.api.core.v1.LocalObjectReference" + "$ref": "#/components/schemas/com.github.ironcore-dev.ironcore.api.common.v1alpha1.SecretKeySelector" } ] }, @@ -5417,18 +5423,6 @@ } ] }, - "image": { - "description": "Image is an optional image to bootstrap the volume with. To be deprecated", - "type": "string" - }, - "imagePullSecretRef": { - "description": "ImagePullSecretRef is an optional secret for pulling the image of a volume.", - "allOf": [ - { - "$ref": "#/components/schemas/io.k8s.api.core.v1.LocalObjectReference" - } - ] - }, "resources": { "description": "Resources is a description of the volume's resources and capacity.", "type": "object", diff --git a/gen/v3/apis__storage.ironcore.dev__v1alpha1_openapi.json b/gen/v3/apis__storage.ironcore.dev__v1alpha1_openapi.json index 3fa1c0fda..e46d17b1b 100644 --- a/gen/v3/apis__storage.ironcore.dev__v1alpha1_openapi.json +++ b/gen/v3/apis__storage.ironcore.dev__v1alpha1_openapi.json @@ -10627,18 +10627,6 @@ } ] }, - "image": { - "description": "Image is an optional image to bootstrap the volume with. To be deprecated", - "type": "string" - }, - "imagePullSecretRef": { - "description": "ImagePullSecretRef is an optional secret for pulling the image of a volume.", - "allOf": [ - { - "$ref": "#/components/schemas/io.k8s.api.core.v1.LocalObjectReference" - } - ] - }, "resources": { "description": "Resources is a description of the volume's resources and capacity.", "type": "object", diff --git a/internal/apis/compute/machine_types.go b/internal/apis/compute/machine_types.go index 2f4e33e1a..861f7b9eb 100644 --- a/internal/apis/compute/machine_types.go +++ b/internal/apis/compute/machine_types.go @@ -23,10 +23,6 @@ type MachineSpec struct { // Power is the desired machine power state. // Defaults to PowerOn. Power Power - // Image is the optional URL providing the operating system image of the machine. - Image string - // ImagePullSecretRef is an optional secret for pulling the image of a machine. - ImagePullSecretRef *corev1.LocalObjectReference // NetworkInterfaces define a list of network interfaces present on the machine NetworkInterfaces []NetworkInterface // Volumes are volumes attached to this machine. diff --git a/internal/apis/compute/util.go b/internal/apis/compute/util.go index 6502542e2..9b23b3f4d 100644 --- a/internal/apis/compute/util.go +++ b/internal/apis/compute/util.go @@ -57,10 +57,6 @@ func MachineVolumeNames(machine *Machine) []string { func MachineSecretNames(machine *Machine) []string { var names []string - if imagePullSecretRef := machine.Spec.ImagePullSecretRef; imagePullSecretRef != nil { - names = append(names, imagePullSecretRef.Name) - } - if ignitionRef := machine.Spec.IgnitionRef; ignitionRef != nil { names = append(names, ignitionRef.Name) } diff --git a/internal/apis/compute/v1alpha1/zz_generated.conversion.go b/internal/apis/compute/v1alpha1/zz_generated.conversion.go index a75b13888..e89dadbea 100644 --- a/internal/apis/compute/v1alpha1/zz_generated.conversion.go +++ b/internal/apis/compute/v1alpha1/zz_generated.conversion.go @@ -846,8 +846,6 @@ func autoConvert_v1alpha1_MachineSpec_To_compute_MachineSpec(in *computev1alpha1 out.MachinePoolSelector = *(*map[string]string)(unsafe.Pointer(&in.MachinePoolSelector)) out.MachinePoolRef = (*v1.LocalObjectReference)(unsafe.Pointer(in.MachinePoolRef)) out.Power = compute.Power(in.Power) - out.Image = in.Image - out.ImagePullSecretRef = (*v1.LocalObjectReference)(unsafe.Pointer(in.ImagePullSecretRef)) out.NetworkInterfaces = *(*[]compute.NetworkInterface)(unsafe.Pointer(&in.NetworkInterfaces)) if in.Volumes != nil { in, out := &in.Volumes, &out.Volumes @@ -877,8 +875,6 @@ func autoConvert_compute_MachineSpec_To_v1alpha1_MachineSpec(in *compute.Machine out.MachinePoolSelector = *(*map[string]string)(unsafe.Pointer(&in.MachinePoolSelector)) out.MachinePoolRef = (*v1.LocalObjectReference)(unsafe.Pointer(in.MachinePoolRef)) out.Power = computev1alpha1.Power(in.Power) - out.Image = in.Image - out.ImagePullSecretRef = (*v1.LocalObjectReference)(unsafe.Pointer(in.ImagePullSecretRef)) out.NetworkInterfaces = *(*[]computev1alpha1.NetworkInterface)(unsafe.Pointer(&in.NetworkInterfaces)) if in.Volumes != nil { in, out := &in.Volumes, &out.Volumes diff --git a/internal/apis/compute/validation/machine.go b/internal/apis/compute/validation/machine.go index 74326605c..87a786d98 100644 --- a/internal/apis/compute/validation/machine.go +++ b/internal/apis/compute/validation/machine.go @@ -92,12 +92,6 @@ func validateMachineSpec(machineSpec *compute.MachineSpec, fldPath *field.Path) } } - if machineSpec.ImagePullSecretRef != nil { - for _, msg := range apivalidation.NameIsDNSSubdomain(machineSpec.ImagePullSecretRef.Name, false) { - allErrs = append(allErrs, field.Invalid(fldPath.Child("imagePullSecretRef").Child("name"), machineSpec.ImagePullSecretRef.Name, msg)) - } - } - seenNames := sets.NewString() seenDevices := sets.NewString() for i, vol := range machineSpec.Volumes { @@ -308,7 +302,6 @@ func validateVolumeTemplateSpecForMachine(template *storage.VolumeTemplateSpec, func validateMachineSpecUpdate(new, old *compute.MachineSpec, fldPath *field.Path) field.ErrorList { var allErrs field.ErrorList - allErrs = append(allErrs, ironcorevalidation.ValidateImmutableField(new.Image, old.Image, fldPath.Child("image"))...) allErrs = append(allErrs, ironcorevalidation.ValidateImmutableField(new.MachineClassRef, old.MachineClassRef, fldPath.Child("machineClassRef"))...) allErrs = append(allErrs, ironcorevalidation.ValidateSetOnceField(new.MachinePoolRef, old.MachinePoolRef, fldPath.Child("machinePoolRef"))...) diff --git a/internal/apis/compute/validation/machine_test.go b/internal/apis/compute/validation/machine_test.go index 02819c135..e2e725894 100644 --- a/internal/apis/compute/validation/machine_test.go +++ b/internal/apis/compute/validation/machine_test.go @@ -194,16 +194,6 @@ var _ = Describe("Machine", func() { }, ContainElement(InvalidField("spec.ignitionRef.name")), ), - Entry("invalid ignition ref name", - &compute.Machine{ - Spec: compute.MachineSpec{ - ImagePullSecretRef: &corev1.LocalObjectReference{ - Name: "foo*", - }, - }, - }, - ContainElement(InvalidField("spec.imagePullSecretRef.name")), - ), ) DescribeTable("ValidateMachineNetworkInterface", diff --git a/internal/apis/compute/zz_generated.deepcopy.go b/internal/apis/compute/zz_generated.deepcopy.go index fc2ca7405..52154d393 100644 --- a/internal/apis/compute/zz_generated.deepcopy.go +++ b/internal/apis/compute/zz_generated.deepcopy.go @@ -514,11 +514,6 @@ func (in *MachineSpec) DeepCopyInto(out *MachineSpec) { *out = new(v1.LocalObjectReference) **out = **in } - if in.ImagePullSecretRef != nil { - in, out := &in.ImagePullSecretRef, &out.ImagePullSecretRef - *out = new(v1.LocalObjectReference) - **out = **in - } if in.NetworkInterfaces != nil { in, out := &in.NetworkInterfaces, &out.NetworkInterfaces *out = make([]NetworkInterface, len(*in)) diff --git a/internal/apis/storage/v1alpha1/zz_generated.conversion.go b/internal/apis/storage/v1alpha1/zz_generated.conversion.go index 9abebfae8..f572e3f97 100644 --- a/internal/apis/storage/v1alpha1/zz_generated.conversion.go +++ b/internal/apis/storage/v1alpha1/zz_generated.conversion.go @@ -1161,8 +1161,6 @@ func autoConvert_v1alpha1_VolumeSpec_To_storage_VolumeSpec(in *storagev1alpha1.V out.VolumePoolRef = (*v1.LocalObjectReference)(unsafe.Pointer(in.VolumePoolRef)) out.ClaimRef = (*commonv1alpha1.LocalUIDReference)(unsafe.Pointer(in.ClaimRef)) out.Resources = *(*core.ResourceList)(unsafe.Pointer(&in.Resources)) - out.Image = in.Image - out.ImagePullSecretRef = (*v1.LocalObjectReference)(unsafe.Pointer(in.ImagePullSecretRef)) out.Unclaimable = in.Unclaimable out.Tolerations = *(*[]commonv1alpha1.Toleration)(unsafe.Pointer(&in.Tolerations)) out.Encryption = (*storage.VolumeEncryption)(unsafe.Pointer(in.Encryption)) @@ -1183,8 +1181,6 @@ func autoConvert_storage_VolumeSpec_To_v1alpha1_VolumeSpec(in *storage.VolumeSpe out.VolumePoolRef = (*v1.LocalObjectReference)(unsafe.Pointer(in.VolumePoolRef)) out.ClaimRef = (*commonv1alpha1.LocalUIDReference)(unsafe.Pointer(in.ClaimRef)) out.Resources = *(*corev1alpha1.ResourceList)(unsafe.Pointer(&in.Resources)) - out.Image = in.Image - out.ImagePullSecretRef = (*v1.LocalObjectReference)(unsafe.Pointer(in.ImagePullSecretRef)) out.Unclaimable = in.Unclaimable out.Tolerations = *(*[]commonv1alpha1.Toleration)(unsafe.Pointer(&in.Tolerations)) out.Encryption = (*storagev1alpha1.VolumeEncryption)(unsafe.Pointer(in.Encryption)) diff --git a/internal/apis/storage/validation/volume.go b/internal/apis/storage/validation/volume.go index 8bc20f359..d765b5790 100644 --- a/internal/apis/storage/validation/volume.go +++ b/internal/apis/storage/validation/volume.go @@ -48,11 +48,6 @@ func validateVolumeSpec(spec *storage.VolumeSpec, fldPath *field.Path) field.Err allErrs = append(allErrs, field.Required(fldPath.Child("resources").Key(string(core.ResourceStorage)), fmt.Sprintf("must specify %s", core.ResourceStorage))) } - if spec.ImagePullSecretRef != nil { - for _, msg := range apivalidation.NameIsDNSSubdomain(spec.ImagePullSecretRef.Name, false) { - allErrs = append(allErrs, field.Invalid(fldPath.Child("imagePullSecretRef").Child("name"), spec.ImagePullSecretRef.Name, msg)) - } - } } else { if spec.VolumePoolSelector != nil { allErrs = append(allErrs, field.Forbidden(fldPath.Child("volumePoolSelector"), "must not specify if volume class is empty")) @@ -66,14 +61,6 @@ func validateVolumeSpec(spec *storage.VolumeSpec, fldPath *field.Path) field.Err allErrs = append(allErrs, field.Forbidden(fldPath.Child("resources"), "must not specify if volume class is empty")) } - if spec.Image != "" { - allErrs = append(allErrs, field.Forbidden(fldPath.Child("image"), "must not specify if volume class is empty")) - } - - if spec.ImagePullSecretRef != nil { - allErrs = append(allErrs, field.Forbidden(fldPath.Child("imagePullSecretRef"), "must not specify if volume class is empty")) - } - if spec.Tolerations != nil { allErrs = append(allErrs, field.Forbidden(fldPath.Child("tolerations"), "must not specify if volume class is empty")) } diff --git a/internal/apis/storage/validation/volume_test.go b/internal/apis/storage/validation/volume_test.go index 8c933e128..0c4ac0857 100644 --- a/internal/apis/storage/validation/volume_test.go +++ b/internal/apis/storage/validation/volume_test.go @@ -72,23 +72,7 @@ var _ = Describe("Volume", func() { }, ContainElement(ForbiddenField("spec.claimRef")), ), - Entry("classless: image pull secret ref", - &storage.Volume{ - Spec: storage.VolumeSpec{ - ImagePullSecretRef: &corev1.LocalObjectReference{Name: "foo"}, - }, - }, - ContainElement(ForbiddenField("spec.imagePullSecretRef")), - ), - Entry("classful: invalid image pull secret ref name", - &storage.Volume{ - Spec: storage.VolumeSpec{ - VolumeClassRef: &corev1.LocalObjectReference{Name: "foo"}, - ImagePullSecretRef: &corev1.LocalObjectReference{Name: "foo*"}, - }, - }, - ContainElement(InvalidField("spec.imagePullSecretRef.name")), - ), + Entry("classless: no resources[storage]", &storage.Volume{}, Not(ContainElement(RequiredField("spec.resources[storage]"))), diff --git a/internal/apis/storage/volume_types.go b/internal/apis/storage/volume_types.go index 473a3408e..b0cc2b159 100644 --- a/internal/apis/storage/volume_types.go +++ b/internal/apis/storage/volume_types.go @@ -30,11 +30,6 @@ type VolumeSpec struct { ClaimRef *commonv1alpha1.LocalUIDReference // Resources is a description of the volume's resources and capacity. Resources core.ResourceList - // Image is an optional image to bootstrap the volume with. - // To be deprecated - Image string - // ImagePullSecretRef is an optional secret for pulling the image of a volume. - ImagePullSecretRef *corev1.LocalObjectReference // Unclaimable marks the volume as unclaimable. Unclaimable bool // Tolerations define tolerations the Volume has. Only a VolumePool whose taints diff --git a/internal/apis/storage/zz_generated.deepcopy.go b/internal/apis/storage/zz_generated.deepcopy.go index 94ccb5dfc..3084ed87d 100644 --- a/internal/apis/storage/zz_generated.deepcopy.go +++ b/internal/apis/storage/zz_generated.deepcopy.go @@ -887,11 +887,6 @@ func (in *VolumeSpec) DeepCopyInto(out *VolumeSpec) { (*out)[key] = val.DeepCopy() } } - if in.ImagePullSecretRef != nil { - in, out := &in.ImagePullSecretRef, &out.ImagePullSecretRef - *out = new(v1.LocalObjectReference) - **out = **in - } if in.Tolerations != nil { in, out := &in.Tolerations, &out.Tolerations *out = make([]v1alpha1.Toleration, len(*in)) diff --git a/internal/controllers/compute/machineclass_controller_test.go b/internal/controllers/compute/machineclass_controller_test.go index 71ce2c9e8..4def7f438 100644 --- a/internal/controllers/compute/machineclass_controller_test.go +++ b/internal/controllers/compute/machineclass_controller_test.go @@ -40,7 +40,6 @@ var _ = Describe("machineclass controller", func() { GenerateName: "machine-", }, Spec: computev1alpha1.MachineSpec{ - Image: "my-image", MachineClassRef: corev1.LocalObjectReference{ Name: machineClass.Name, }, diff --git a/internal/registry/compute/machine/storage/tableconvertor.go b/internal/registry/compute/machine/storage/tableconvertor.go index 6dd868bce..2f8d86182 100644 --- a/internal/registry/compute/machine/storage/tableconvertor.go +++ b/internal/registry/compute/machine/storage/tableconvertor.go @@ -52,11 +52,6 @@ func (c *convertor) ConvertToTable(ctx context.Context, obj runtime.Object, tabl cells = append(cells, name) cells = append(cells, machine.Spec.MachineClassRef.Name) - if image := machine.Spec.Image; image != "" { - cells = append(cells, image) - } else { - cells = append(cells, "") - } if machinePoolRef := machine.Spec.MachinePoolRef; machinePoolRef != nil { cells = append(cells, machinePoolRef.Name) } else { diff --git a/internal/registry/storage/volume/storage/tableconvertor.go b/internal/registry/storage/volume/storage/tableconvertor.go index 2f71614c1..ba90084c0 100644 --- a/internal/registry/storage/volume/storage/tableconvertor.go +++ b/internal/registry/storage/volume/storage/tableconvertor.go @@ -56,11 +56,6 @@ func (c *convertor) ConvertToTable(ctx context.Context, obj runtime.Object, tabl } else { cells = append(cells, "") } - if image := volume.Spec.Image; image != "" { - cells = append(cells, image) - } else { - cells = append(cells, "") - } if volumeClassRef := volume.Spec.VolumeClassRef; volumeClassRef != nil { cells = append(cells, volumeClassRef.Name) } else { diff --git a/iri/apis/volume/v1alpha1/api.pb.go b/iri/apis/volume/v1alpha1/api.pb.go index d368f0283..d6d14e025 100644 --- a/iri/apis/volume/v1alpha1/api.pb.go +++ b/iri/apis/volume/v1alpha1/api.pb.go @@ -480,7 +480,6 @@ func (x *VolumeDataSource) GetSnapshotDataSource() *SnapshotDataSource { type VolumeSpec struct { state protoimpl.MessageState `protogen:"open.v1"` - Image string `protobuf:"bytes,1,opt,name=image,proto3" json:"image,omitempty"` Class string `protobuf:"bytes,2,opt,name=class,proto3" json:"class,omitempty"` Resources *VolumeResources `protobuf:"bytes,3,opt,name=resources,proto3" json:"resources,omitempty"` Encryption *EncryptionSpec `protobuf:"bytes,4,opt,name=encryption,proto3" json:"encryption,omitempty"` @@ -519,13 +518,6 @@ func (*VolumeSpec) Descriptor() ([]byte, []int) { return file_volume_v1alpha1_api_proto_rawDescGZIP(), []int{7} } -func (x *VolumeSpec) GetImage() string { - if x != nil { - return x.Image - } - return "" -} - func (x *VolumeSpec) GetClass() string { if x != nil { return x.Class @@ -2008,10 +2000,9 @@ const file_volume_v1alpha1_api_proto_rawDesc = "" + "snapshotId\"\xb7\x01\n" + "\x10VolumeDataSource\x12L\n" + "\x11image_data_source\x18\x01 \x01(\v2 .volume.v1alpha1.ImageDataSourceR\x0fimageDataSource\x12U\n" + - "\x14snapshot_data_source\x18\x02 \x01(\v2#.volume.v1alpha1.SnapshotDataSourceR\x12snapshotDataSource\"\x8a\x02\n" + + "\x14snapshot_data_source\x18\x02 \x01(\v2#.volume.v1alpha1.SnapshotDataSourceR\x12snapshotDataSource\"\xf4\x01\n" + "\n" + "VolumeSpec\x12\x14\n" + - "\x05image\x18\x01 \x01(\tR\x05image\x12\x14\n" + "\x05class\x18\x02 \x01(\tR\x05class\x12>\n" + "\tresources\x18\x03 \x01(\v2 .volume.v1alpha1.VolumeResourcesR\tresources\x12?\n" + "\n" + diff --git a/iri/apis/volume/v1alpha1/api.proto b/iri/apis/volume/v1alpha1/api.proto index 5520f8529..7b9a68c69 100644 --- a/iri/apis/volume/v1alpha1/api.proto +++ b/iri/apis/volume/v1alpha1/api.proto @@ -55,7 +55,6 @@ message VolumeDataSource { } message VolumeSpec { - string image = 1; string class = 2; VolumeResources resources = 3; EncryptionSpec encryption = 4; diff --git a/irictl-volume/tableconverters/volume.go b/irictl-volume/tableconverters/volume.go index 845b72ff1..119af1f0d 100644 --- a/irictl-volume/tableconverters/volume.go +++ b/irictl-volume/tableconverters/volume.go @@ -29,7 +29,6 @@ var ( return api.Row{ volume.Metadata.Id, volume.Spec.Class, - volume.Spec.Image, volume.Status.State.String(), duration.HumanDuration(time.Since(time.Unix(0, volume.Metadata.CreatedAt))), }, nil diff --git a/poollet/machinepoollet/controllers/machine_controller.go b/poollet/machinepoollet/controllers/machine_controller.go index 35fe9a78c..e8d43e3c2 100644 --- a/poollet/machinepoollet/controllers/machine_controller.go +++ b/poollet/machinepoollet/controllers/machine_controller.go @@ -338,10 +338,6 @@ func (r *MachineReconciler) create( return ctrl.Result{}, nil } - if machine.Spec.Image != "" { //nolint:staticcheck - r.Eventf(machine, nil, corev1.EventTypeWarning, "ImageRefDeprecated", "Image reference in %s is deprecated", machine.Spec.Image) //nolint:staticcheck - } - log.V(1).Info("Creating machine") res, err := r.MachineRuntime.CreateMachine(ctx, &iri.CreateMachineRequest{ Machine: iriMachine, diff --git a/poollet/volumepoollet/controllers/volume_controller.go b/poollet/volumepoollet/controllers/volume_controller.go index 20bd08e25..d3b7589cd 100644 --- a/poollet/volumepoollet/controllers/volume_controller.go +++ b/poollet/volumepoollet/controllers/volume_controller.go @@ -455,7 +455,6 @@ func (r *VolumeReconciler) prepareIRIVolume(ctx context.Context, log logr.Logger return &iri.Volume{ Metadata: metadata, Spec: &iri.VolumeSpec{ - Image: volume.Spec.Image, Class: class, Resources: resources, Encryption: encryption, diff --git a/poollet/volumepoollet/controllers/volume_controller_test.go b/poollet/volumepoollet/controllers/volume_controller_test.go index 540043a40..2c4582940 100644 --- a/poollet/volumepoollet/controllers/volume_controller_test.go +++ b/poollet/volumepoollet/controllers/volume_controller_test.go @@ -66,7 +66,6 @@ var _ = Describe("VolumeController", func() { _, iriVolume := GetSingleMapEntry(srv.Volumes) - Expect(iriVolume.Spec.Image).To(Equal("")) Expect(iriVolume.Spec.Class).To(Equal(vc.Name)) Expect(iriVolume.Spec.Encryption).To(BeNil()) Expect(iriVolume.Spec.Resources.StorageBytes).To(Equal(size.Value())) @@ -158,7 +157,6 @@ var _ = Describe("VolumeController", func() { _, iriVolume := GetSingleMapEntry(srv.Volumes) - Expect(iriVolume.Spec.Image).To(Equal("")) Expect(iriVolume.Spec.Class).To(Equal(vc.Name)) Expect(iriVolume.Spec.Resources.StorageBytes).To(Equal(size.Value())) Expect(iriVolume.Spec.Encryption.SecretData).NotTo(HaveKeyWithValue(encryptionDataKey, encryptionData)) @@ -193,7 +191,6 @@ var _ = Describe("VolumeController", func() { _, iriVolume := GetSingleMapEntry(srv.Volumes) - Expect(iriVolume.Spec.Image).To(Equal("")) Expect(iriVolume.Spec.Class).To(Equal(expandableVc.Name)) Expect(iriVolume.Spec.Resources.StorageBytes).To(Equal(size.Value())) @@ -984,7 +981,6 @@ var _ = Describe("VolumeController", func() { _, iriVolume := GetSingleMapEntry(srv.Volumes) - Expect(iriVolume.Spec.Image).To(Equal("")) Expect(iriVolume.Spec.Class).To(Equal(vc.Name)) Expect(iriVolume.Spec.Encryption).To(BeNil()) Expect(iriVolume.Spec.Resources.StorageBytes).To(Equal(size.Value())) From 6ed6aceefcbf60786afb0d6c2ac2679940a6aa13 Mon Sep 17 00:00:00 2001 From: Rohit Kumar Date: Wed, 8 Jul 2026 11:45:21 +0530 Subject: [PATCH 2/2] address review comments Signed-off-by: Rohit Kumar --- internal/apis/storage/validation/volume.go | 2 +- internal/apis/storage/validation/volume_test.go | 6 +++--- .../compute/machine/storage/tableconvertor.go | 14 ++++++++++++++ .../storage/volume/storage/tableconvertor.go | 5 +++++ iri/apis/volume/v1alpha1/api.pb.go | 4 ++-- iri/apis/volume/v1alpha1/api.proto | 2 ++ 6 files changed, 27 insertions(+), 6 deletions(-) diff --git a/internal/apis/storage/validation/volume.go b/internal/apis/storage/validation/volume.go index d765b5790..93a8a6f0a 100644 --- a/internal/apis/storage/validation/volume.go +++ b/internal/apis/storage/validation/volume.go @@ -66,7 +66,7 @@ func validateVolumeSpec(spec *storage.VolumeSpec, fldPath *field.Path) field.Err } if spec.DataSource.OSImage != nil { - allErrs = append(allErrs, field.Forbidden(fldPath.Child("osImage"), "must not specify if volume class is empty")) + allErrs = append(allErrs, field.Forbidden(fldPath.Child("dataSource").Child("osImage"), "must not specify if volume class is empty")) } } diff --git a/internal/apis/storage/validation/volume_test.go b/internal/apis/storage/validation/volume_test.go index 0c4ac0857..307502e0c 100644 --- a/internal/apis/storage/validation/volume_test.go +++ b/internal/apis/storage/validation/volume_test.go @@ -146,7 +146,7 @@ var _ = Describe("Volume", func() { }, }, }, - Not(ContainElement(ForbiddenField("spec.osImage"))), + Not(ContainElement(ForbiddenField("spec.dataSource.osImage"))), ), Entry("classless: invalid os image as volume data source", &storage.Volume{ @@ -158,7 +158,7 @@ var _ = Describe("Volume", func() { }, }, }, - ContainElement(ForbiddenField("spec.osImage")), + ContainElement(ForbiddenField("spec.dataSource.osImage")), ), Entry("invalid os image as single volume data source", &storage.Volume{ @@ -171,7 +171,7 @@ var _ = Describe("Volume", func() { }, }, }, - ContainElement(ForbiddenField("spec.osImage")), + ContainElement(ForbiddenField("spec.dataSource.osImage")), ), ) diff --git a/internal/registry/compute/machine/storage/tableconvertor.go b/internal/registry/compute/machine/storage/tableconvertor.go index 2f8d86182..d8da7d979 100644 --- a/internal/registry/compute/machine/storage/tableconvertor.go +++ b/internal/registry/compute/machine/storage/tableconvertor.go @@ -32,6 +32,15 @@ func newTableConvertor() *convertor { return &convertor{} } +func volumeImage(machine *compute.Machine) string { + for _, volume := range machine.Spec.Volumes { + if volume.LocalDisk != nil && volume.LocalDisk.Image != "" { + return volume.LocalDisk.Image + } + } + return "" +} + func (c *convertor) ConvertToTable(ctx context.Context, obj runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) { tab := &metav1.Table{ ColumnDefinitions: headers, @@ -52,6 +61,11 @@ func (c *convertor) ConvertToTable(ctx context.Context, obj runtime.Object, tabl cells = append(cells, name) cells = append(cells, machine.Spec.MachineClassRef.Name) + if image := volumeImage(machine); image != "" { + cells = append(cells, image) + } else { + cells = append(cells, "") + } if machinePoolRef := machine.Spec.MachinePoolRef; machinePoolRef != nil { cells = append(cells, machinePoolRef.Name) } else { diff --git a/internal/registry/storage/volume/storage/tableconvertor.go b/internal/registry/storage/volume/storage/tableconvertor.go index ba90084c0..0596cb677 100644 --- a/internal/registry/storage/volume/storage/tableconvertor.go +++ b/internal/registry/storage/volume/storage/tableconvertor.go @@ -56,6 +56,11 @@ func (c *convertor) ConvertToTable(ctx context.Context, obj runtime.Object, tabl } else { cells = append(cells, "") } + if volume.Spec.DataSource.OSImage != nil && volume.Spec.DataSource.OSImage.Image != "" { + cells = append(cells, volume.Spec.DataSource.OSImage.Image) + } else { + cells = append(cells, "") + } if volumeClassRef := volume.Spec.VolumeClassRef; volumeClassRef != nil { cells = append(cells, volumeClassRef.Name) } else { diff --git a/iri/apis/volume/v1alpha1/api.pb.go b/iri/apis/volume/v1alpha1/api.pb.go index d6d14e025..758f82ae8 100644 --- a/iri/apis/volume/v1alpha1/api.pb.go +++ b/iri/apis/volume/v1alpha1/api.pb.go @@ -2000,7 +2000,7 @@ const file_volume_v1alpha1_api_proto_rawDesc = "" + "snapshotId\"\xb7\x01\n" + "\x10VolumeDataSource\x12L\n" + "\x11image_data_source\x18\x01 \x01(\v2 .volume.v1alpha1.ImageDataSourceR\x0fimageDataSource\x12U\n" + - "\x14snapshot_data_source\x18\x02 \x01(\v2#.volume.v1alpha1.SnapshotDataSourceR\x12snapshotDataSource\"\xf4\x01\n" + + "\x14snapshot_data_source\x18\x02 \x01(\v2#.volume.v1alpha1.SnapshotDataSourceR\x12snapshotDataSource\"\x81\x02\n" + "\n" + "VolumeSpec\x12\x14\n" + "\x05class\x18\x02 \x01(\tR\x05class\x12>\n" + @@ -2008,7 +2008,7 @@ const file_volume_v1alpha1_api_proto_rawDesc = "" + "\n" + "encryption\x18\x04 \x01(\v2\x1f.volume.v1alpha1.EncryptionSpecR\n" + "encryption\x12O\n" + - "\x12volume_data_source\x18\x05 \x01(\v2!.volume.v1alpha1.VolumeDataSourceR\x10volumeDataSource\"\xb9\x01\n" + + "\x12volume_data_source\x18\x05 \x01(\v2!.volume.v1alpha1.VolumeDataSourceR\x10volumeDataSourceJ\x04\b\x01\x10\x02R\x05image\"\xb9\x01\n" + "\fVolumeStatus\x122\n" + "\x05state\x18\x01 \x01(\x0e2\x1c.volume.v1alpha1.VolumeStateR\x05state\x125\n" + "\x06access\x18\x02 \x01(\v2\x1d.volume.v1alpha1.VolumeAccessR\x06access\x12>\n" + diff --git a/iri/apis/volume/v1alpha1/api.proto b/iri/apis/volume/v1alpha1/api.proto index 7b9a68c69..20c9799ae 100644 --- a/iri/apis/volume/v1alpha1/api.proto +++ b/iri/apis/volume/v1alpha1/api.proto @@ -55,6 +55,8 @@ message VolumeDataSource { } message VolumeSpec { + reserved 1; + reserved "image"; string class = 2; VolumeResources resources = 3; EncryptionSpec encryption = 4;