From 853a79bd7db0a9874f73a4acce91a7b9a37c5b98 Mon Sep 17 00:00:00 2001 From: Matthias Teich Date: Mon, 8 Jan 2024 09:03:42 +0100 Subject: [PATCH] Make machinetemplate.spec.ram mutable --- api/v1alpha1/ionoscloudmachine_types.go | 1 - .../infrastructure.cluster.x-k8s.io_ionoscloudmachines.yaml | 3 --- ...ructure.cluster.x-k8s.io_ionoscloudmachinetemplates.yaml | 3 --- internal/controller/ionoscloudmachine_controller_test.go | 6 ------ 4 files changed, 13 deletions(-) diff --git a/api/v1alpha1/ionoscloudmachine_types.go b/api/v1alpha1/ionoscloudmachine_types.go index 892ab6a..a8d2631 100644 --- a/api/v1alpha1/ionoscloudmachine_types.go +++ b/api/v1alpha1/ionoscloudmachine_types.go @@ -50,7 +50,6 @@ type IONOSCloudMachineSpec struct { // The memory size for the enterprise server in MB, such as 2048. // +kubebuilder:validation:Minimum=256 // +kubebuilder:validation:MultipleOf=256 - // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Ram is immutable" Ram *int32 `json:"ram"` BootVolume IONOSVolumeSpec `json:"bootVolume"` diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_ionoscloudmachines.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_ionoscloudmachines.yaml index 7894909..0a780a5 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ionoscloudmachines.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ionoscloudmachines.yaml @@ -134,9 +134,6 @@ spec: minimum: 256 multipleOf: 256 type: integer - x-kubernetes-validations: - - message: Ram is immutable - rule: self == oldSelf required: - bootVolume - cores diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_ionoscloudmachinetemplates.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_ionoscloudmachinetemplates.yaml index b125033..75b49ab 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ionoscloudmachinetemplates.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ionoscloudmachinetemplates.yaml @@ -135,9 +135,6 @@ spec: minimum: 256 multipleOf: 256 type: integer - x-kubernetes-validations: - - message: Ram is immutable - rule: self == oldSelf required: - bootVolume - cores diff --git a/internal/controller/ionoscloudmachine_controller_test.go b/internal/controller/ionoscloudmachine_controller_test.go index 147853a..f489cbe 100644 --- a/internal/controller/ionoscloudmachine_controller_test.go +++ b/internal/controller/ionoscloudmachine_controller_test.go @@ -234,12 +234,6 @@ var _ = Describe("IONOSCloudMachine controller", func() { return 0 }, timeout, interval).Should(Equal(1)) }) - - It("should not be possible to change immutable fields", func() { - capicMachine.Spec.Ram = ionoscloud.ToPtr(int32(256)) - err := k8sClient.Update(ctx, capicMachine) - Expect(err).Should(HaveOccurred()) - }) }) When("IONOSCloudMachine has been created", func() {