From 5e245ae83e23be1d1fb471e8cab212be1f445f27 Mon Sep 17 00:00:00 2001 From: Itamar Holder Date: Wed, 13 Nov 2024 15:11:45 +0200 Subject: [PATCH 1/4] Avoid setting a default value for completionTimeoutPerGiB Signed-off-by: Itamar Holder --- api/v1beta1/hyperconverged_types.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/api/v1beta1/hyperconverged_types.go b/api/v1beta1/hyperconverged_types.go index 117dce2a1..605923eb0 100644 --- a/api/v1beta1/hyperconverged_types.go +++ b/api/v1beta1/hyperconverged_types.go @@ -72,7 +72,7 @@ type HyperConvergedSpec struct { // Live migration limits and timeouts are applied so that migration processes do not // overwhelm the cluster. - // +kubebuilder:default={"completionTimeoutPerGiB": 800, "parallelMigrationsPerCluster": 5, "parallelOutboundMigrationsPerNode": 2, "progressTimeout": 150, "allowAutoConverge": false, "allowPostCopy": false} + // +kubebuilder:default={"parallelMigrationsPerCluster": 5, "parallelOutboundMigrationsPerNode": 2, "progressTimeout": 150, "allowAutoConverge": false, "allowPostCopy": false} // +optional LiveMigrationConfig LiveMigrationConfigurations `json:"liveMigrationConfig,omitempty"` @@ -337,8 +337,6 @@ type LiveMigrationConfigurations struct { // higher completionTimeoutPerGiB to let workload with spikes in its memory dirty // rate to converge. // The format is a number. - // +kubebuilder:default=800 - // +default=800 // +optional CompletionTimeoutPerGiB *int64 `json:"completionTimeoutPerGiB,omitempty"` @@ -868,7 +866,7 @@ type HyperConverged struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - // +kubebuilder:default={"certConfig": {"ca": {"duration": "48h0m0s", "renewBefore": "24h0m0s"}, "server": {"duration": "24h0m0s", "renewBefore": "12h0m0s"}},"featureGates": {"downwardMetrics": false, "withHostPassthroughCPU": false, "enableCommonBootImageImport": true, "deployTektonTaskResources": false, "deployVmConsoleProxy": false, "deployKubeSecondaryDNS": false, "deployKubevirtIpamController": false, "nonRoot": true, "disableMDevConfiguration": false, "persistentReservation": false, "enableManagedTenantQuota": false, "autoResourceLimits": false, "enableApplicationAwareQuota": false, "primaryUserDefinedNetworkBinding": false}, "liveMigrationConfig": {"completionTimeoutPerGiB": 800, "parallelMigrationsPerCluster": 5, "parallelOutboundMigrationsPerNode": 2, "progressTimeout": 150, "allowAutoConverge": false, "allowPostCopy": false}, "resourceRequirements": {"vmiCPUAllocationRatio": 10}, "uninstallStrategy": "BlockUninstallIfWorkloadsExist", "virtualMachineOptions": {"disableFreePageReporting": false, "disableSerialConsoleLog": true}} + // +kubebuilder:default={"certConfig": {"ca": {"duration": "48h0m0s", "renewBefore": "24h0m0s"}, "server": {"duration": "24h0m0s", "renewBefore": "12h0m0s"}},"featureGates": {"downwardMetrics": false, "withHostPassthroughCPU": false, "enableCommonBootImageImport": true, "deployTektonTaskResources": false, "deployVmConsoleProxy": false, "deployKubeSecondaryDNS": false, "deployKubevirtIpamController": false, "nonRoot": true, "disableMDevConfiguration": false, "persistentReservation": false, "enableManagedTenantQuota": false, "autoResourceLimits": false, "enableApplicationAwareQuota": false, "primaryUserDefinedNetworkBinding": false}, "liveMigrationConfig": {"parallelMigrationsPerCluster": 5, "parallelOutboundMigrationsPerNode": 2, "progressTimeout": 150, "allowAutoConverge": false, "allowPostCopy": false}, "resourceRequirements": {"vmiCPUAllocationRatio": 10}, "uninstallStrategy": "BlockUninstallIfWorkloadsExist", "virtualMachineOptions": {"disableFreePageReporting": false, "disableSerialConsoleLog": true}} // +optional Spec HyperConvergedSpec `json:"spec,omitempty"` Status HyperConvergedStatus `json:"status,omitempty"` From 858b6146a55c72c97e546c6f49f33cf59c8bac38 Mon Sep 17 00:00:00 2001 From: Itamar Holder Date: Wed, 13 Nov 2024 15:12:56 +0200 Subject: [PATCH 2/4] adapt tests Signed-off-by: Itamar Holder --- controllers/operands/kubevirt_test.go | 2 -- tests/func-tests/defaults_test.go | 2 -- 2 files changed, 4 deletions(-) diff --git a/controllers/operands/kubevirt_test.go b/controllers/operands/kubevirt_test.go index 6625c3989..0cbab78b6 100644 --- a/controllers/operands/kubevirt_test.go +++ b/controllers/operands/kubevirt_test.go @@ -335,7 +335,6 @@ Version: 1.2.3`) mc := foundResource.Spec.Configuration.MigrationConfiguration Expect(mc).ToNot(BeNil()) Expect(mc.BandwidthPerMigration).To(BeNil()) - Expect(*mc.CompletionTimeoutPerGiB).To(Equal(int64(800))) Expect(*mc.ParallelMigrationsPerCluster).To(Equal(uint32(5))) Expect(*mc.ParallelOutboundMigrationsPerNode).To(Equal(uint32(2))) Expect(*mc.ProgressTimeout).To(Equal(int64(150))) @@ -544,7 +543,6 @@ Version: 1.2.3`) mc := foundResource.Spec.Configuration.MigrationConfiguration Expect(mc).ToNot(BeNil()) Expect(mc.BandwidthPerMigration).To(BeNil()) - Expect(*mc.CompletionTimeoutPerGiB).To(Equal(int64(800))) Expect(*mc.ParallelMigrationsPerCluster).To(Equal(uint32(5))) Expect(*mc.ParallelOutboundMigrationsPerNode).To(Equal(uint32(2))) Expect(*mc.ProgressTimeout).To(Equal(int64(150))) diff --git a/tests/func-tests/defaults_test.go b/tests/func-tests/defaults_test.go index a3d467be2..fb7770fc5 100644 --- a/tests/func-tests/defaults_test.go +++ b/tests/func-tests/defaults_test.go @@ -117,7 +117,6 @@ var _ = Describe("Check Default values", Label("defaults"), Serial, func() { defaultLiveMigrationConfig := v1beta1.LiveMigrationConfigurations{ AllowAutoConverge: ptr.To(false), AllowPostCopy: ptr.To(false), - CompletionTimeoutPerGiB: ptr.To(int64(800)), ParallelMigrationsPerCluster: ptr.To(uint32(5)), ParallelOutboundMigrationsPerNode: ptr.To(uint32(2)), ProgressTimeout: ptr.To(int64(150)), @@ -136,7 +135,6 @@ var _ = Describe("Check Default values", Label("defaults"), Serial, func() { }, Entry("when removing /spec/liveMigrationConfig/allowAutoConverge", "/spec/liveMigrationConfig/allowAutoConverge"), Entry("when removing /spec/liveMigrationConfig/allowPostCopy", "/spec/liveMigrationConfig/allowPostCopy"), - Entry("when removing /spec/liveMigrationConfig/completionTimeoutPerGiB", "/spec/liveMigrationConfig/completionTimeoutPerGiB"), Entry("when removing /spec/liveMigrationConfig/parallelMigrationsPerCluster", "/spec/liveMigrationConfig/parallelMigrationsPerCluster"), Entry("when removing /spec/liveMigrationConfig/parallelOutboundMigrationsPerNode", "/spec/liveMigrationConfig/parallelOutboundMigrationsPerNode"), Entry("when removing /spec/liveMigrationConfig/progressTimeout", "/spec/liveMigrationConfig/progressTimeout"), From 85aac8e9316b8eb02471484e360e85a42ff8bbaf Mon Sep 17 00:00:00 2001 From: Itamar Holder Date: Wed, 13 Nov 2024 15:17:09 +0200 Subject: [PATCH 3/4] Remove default CompletionTimeoutPerGiB from generated files Signed-off-by: Itamar Holder --- api/v1beta1/zz_generated.defaults.go | 4 ---- api/v1beta1/zz_generated.openapi.go | 1 - 2 files changed, 5 deletions(-) diff --git a/api/v1beta1/zz_generated.defaults.go b/api/v1beta1/zz_generated.defaults.go index 8c96ac282..1fc7b4828 100644 --- a/api/v1beta1/zz_generated.defaults.go +++ b/api/v1beta1/zz_generated.defaults.go @@ -108,10 +108,6 @@ func SetObjectDefaults_HyperConverged(in *HyperConverged) { var ptrVar1 uint32 = 2 in.Spec.LiveMigrationConfig.ParallelOutboundMigrationsPerNode = &ptrVar1 } - if in.Spec.LiveMigrationConfig.CompletionTimeoutPerGiB == nil { - var ptrVar1 int64 = 800 - in.Spec.LiveMigrationConfig.CompletionTimeoutPerGiB = &ptrVar1 - } if in.Spec.LiveMigrationConfig.ProgressTimeout == nil { var ptrVar1 int64 = 150 in.Spec.LiveMigrationConfig.ProgressTimeout = &ptrVar1 diff --git a/api/v1beta1/zz_generated.openapi.go b/api/v1beta1/zz_generated.openapi.go index 034205e6e..224dcf7c4 100644 --- a/api/v1beta1/zz_generated.openapi.go +++ b/api/v1beta1/zz_generated.openapi.go @@ -855,7 +855,6 @@ func schema_kubevirt_hyperconverged_cluster_operator_api_v1beta1_LiveMigrationCo "completionTimeoutPerGiB": { SchemaProps: spec.SchemaProps{ Description: "If a migrating VM is big and busy, while the connection to the destination node is slow, migration may never converge. The completion timeout is calculated based on completionTimeoutPerGiB times the size of the guest (both RAM and migrated disks, if any). For example, with completionTimeoutPerGiB set to 800, a virtual machine instance with 6GiB memory will timeout if it has not completed migration in 1h20m. Use a lower completionTimeoutPerGiB to induce quicker failure, so that another destination or post-copy is attempted. Use a higher completionTimeoutPerGiB to let workload with spikes in its memory dirty rate to converge. The format is a number.", - Default: 800, Type: []string{"integer"}, Format: "int64", }, From 7b349e747df12a8721bcff8fc01d5e4d354bb766 Mon Sep 17 00:00:00 2001 From: Itamar Holder Date: Wed, 13 Nov 2024 15:23:49 +0200 Subject: [PATCH 4/4] update base HCO objects Signed-off-by: Itamar Holder --- config/crd/bases/hco.kubevirt.io_hyperconvergeds.yaml | 3 --- deploy/crds/hco00.crd.yaml | 3 --- 2 files changed, 6 deletions(-) diff --git a/config/crd/bases/hco.kubevirt.io_hyperconvergeds.yaml b/config/crd/bases/hco.kubevirt.io_hyperconvergeds.yaml index 7f7ef947a..140fe8ae8 100644 --- a/config/crd/bases/hco.kubevirt.io_hyperconvergeds.yaml +++ b/config/crd/bases/hco.kubevirt.io_hyperconvergeds.yaml @@ -74,7 +74,6 @@ spec: liveMigrationConfig: allowAutoConverge: false allowPostCopy: false - completionTimeoutPerGiB: 800 parallelMigrationsPerCluster: 5 parallelOutboundMigrationsPerNode: 2 progressTimeout: 150 @@ -2252,7 +2251,6 @@ spec: default: allowAutoConverge: false allowPostCopy: false - completionTimeoutPerGiB: 800 parallelMigrationsPerCluster: 5 parallelOutboundMigrationsPerNode: 2 progressTimeout: 150 @@ -2284,7 +2282,6 @@ spec: pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ type: string completionTimeoutPerGiB: - default: 800 description: |- If a migrating VM is big and busy, while the connection to the destination node is slow, migration may never converge. The completion timeout is calculated diff --git a/deploy/crds/hco00.crd.yaml b/deploy/crds/hco00.crd.yaml index 7f7ef947a..140fe8ae8 100644 --- a/deploy/crds/hco00.crd.yaml +++ b/deploy/crds/hco00.crd.yaml @@ -74,7 +74,6 @@ spec: liveMigrationConfig: allowAutoConverge: false allowPostCopy: false - completionTimeoutPerGiB: 800 parallelMigrationsPerCluster: 5 parallelOutboundMigrationsPerNode: 2 progressTimeout: 150 @@ -2252,7 +2251,6 @@ spec: default: allowAutoConverge: false allowPostCopy: false - completionTimeoutPerGiB: 800 parallelMigrationsPerCluster: 5 parallelOutboundMigrationsPerNode: 2 progressTimeout: 150 @@ -2284,7 +2282,6 @@ spec: pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ type: string completionTimeoutPerGiB: - default: 800 description: |- If a migrating VM is big and busy, while the connection to the destination node is slow, migration may never converge. The completion timeout is calculated