From 6a642ba0c82d404404a8dbd31b11ec0737b2b185 Mon Sep 17 00:00:00 2001 From: Nahshon Unna-Tsameret Date: Mon, 2 Dec 2024 16:39:51 +0200 Subject: [PATCH] Move the enableCommonBootImageImport field Deprecated the `spec.featureGates.enableCommonBootImageImport` field. Added the `spec.enableCommonBootImageImport` field instead. Signed-off-by: Nahshon Unna-Tsameret --- api/v1beta1/hyperconverged_types.go | 16 +++- api/v1beta1/zz_generated.deepcopy.go | 5 ++ api/v1beta1/zz_generated.defaults.go | 8 +- api/v1beta1/zz_generated.openapi.go | 11 ++- assets/upgradePatches.json | 32 +++++++- .../hco.kubevirt.io_hyperconvergeds.yaml | 13 +++- controllers/operands/imageStream.go | 6 +- controllers/operands/imageStream_test.go | 38 +++++----- controllers/operands/ssp.go | 3 +- controllers/operands/ssp_test.go | 76 +++++++++---------- deploy/crds/hco00.crd.yaml | 13 +++- deploy/hco.cr.yaml | 2 +- .../1.14.0/manifests/hco00.crd.yaml | 13 +++- .../1.14.0/manifests/hco00.crd.yaml | 13 +++- docs/api.md | 7 +- docs/cluster-configuration.md | 26 ++++--- pkg/boolean/boolean.go | 5 ++ tests/func-tests/defaults_test.go | 2 - 18 files changed, 187 insertions(+), 102 deletions(-) create mode 100644 pkg/boolean/boolean.go diff --git a/api/v1beta1/hyperconverged_types.go b/api/v1beta1/hyperconverged_types.go index e3fcd45ff..fe070e90e 100644 --- a/api/v1beta1/hyperconverged_types.go +++ b/api/v1beta1/hyperconverged_types.go @@ -66,7 +66,7 @@ type HyperConvergedSpec struct { // featureGates is a map of feature gate flags. Setting a flag to `true` will enable // the feature. Setting `false` or removing the feature gate, disables the feature. - // +kubebuilder:default={"downwardMetrics": false, "enableCommonBootImageImport": true, "deployVmConsoleProxy": false, "deployKubeSecondaryDNS": false, "deployKubevirtIpamController": false, "disableMDevConfiguration": false, "persistentReservation": false, "autoResourceLimits": false, "enableApplicationAwareQuota": false, "primaryUserDefinedNetworkBinding": false} + // +kubebuilder:default={"downwardMetrics": false, "deployVmConsoleProxy": false, "deployKubeSecondaryDNS": false, "deployKubevirtIpamController": false, "disableMDevConfiguration": false, "persistentReservation": false, "autoResourceLimits": false, "enableApplicationAwareQuota": false, "primaryUserDefinedNetworkBinding": false} // +optional FeatureGates HyperConvergedFeatureGates `json:"featureGates,omitempty"` @@ -243,6 +243,15 @@ type HyperConvergedSpec struct { // +default={"memoryOvercommitPercentage": 100} // +optional HigherWorkloadDensity *HigherWorkloadDensityConfiguration `json:"higherWorkloadDensity,omitempty"` + + // Opt-in to automatic delivery/updates of the common data import cron templates. + // There are two sources for the data import cron templates: hard coded list of common templates, and custom + // templates that can be added to the dataImportCronTemplates field. This feature gates only control the common + // templates. It is possible to use custom templates by adding them to the dataImportCronTemplates field. + // +optional + // +kubebuilder:default=true + // +default=true + EnableCommonBootImageImport *bool `json:"enableCommonBootImageImport,omitempty"` } // CertRotateConfigCA contains the tunables for TLS certificates. @@ -414,8 +423,7 @@ type HyperConvergedFeatureGates struct { // templates that can be added to the dataImportCronTemplates field. This feature gates only control the common // templates. It is possible to use custom templates by adding them to the dataImportCronTemplates field. // +optional - // +kubebuilder:default=true - // +default=true + // Deprecated: use spec.enableCommonBootImageImport instead EnableCommonBootImageImport *bool `json:"enableCommonBootImageImport,omitempty"` // deploy VM console proxy resources in SSP operator @@ -842,7 +850,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, "enableCommonBootImageImport": true, "deployVmConsoleProxy": false, "deployKubeSecondaryDNS": false, "deployKubevirtIpamController": false, "disableMDevConfiguration": false, "persistentReservation": 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, "deployVmConsoleProxy": false, "deployKubeSecondaryDNS": false, "deployKubevirtIpamController": false, "disableMDevConfiguration": false, "persistentReservation": 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}, "enableCommonBootImageImport": true} // +optional Spec HyperConvergedSpec `json:"spec,omitempty"` Status HyperConvergedStatus `json:"status,omitempty"` diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index cf271e6d3..8bc86409c 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -518,6 +518,11 @@ func (in *HyperConvergedSpec) DeepCopyInto(out *HyperConvergedSpec) { *out = new(HigherWorkloadDensityConfiguration) **out = **in } + if in.EnableCommonBootImageImport != nil { + in, out := &in.EnableCommonBootImageImport, &out.EnableCommonBootImageImport + *out = new(bool) + **out = **in + } return } diff --git a/api/v1beta1/zz_generated.defaults.go b/api/v1beta1/zz_generated.defaults.go index c30754323..0c0ca3f4e 100644 --- a/api/v1beta1/zz_generated.defaults.go +++ b/api/v1beta1/zz_generated.defaults.go @@ -44,10 +44,6 @@ func SetObjectDefaults_HyperConverged(in *HyperConverged) { var ptrVar1 bool = false in.Spec.FeatureGates.DownwardMetrics = &ptrVar1 } - if in.Spec.FeatureGates.EnableCommonBootImageImport == nil { - var ptrVar1 bool = true - in.Spec.FeatureGates.EnableCommonBootImageImport = &ptrVar1 - } if in.Spec.FeatureGates.DeployVMConsoleProxy == nil { var ptrVar1 bool = false in.Spec.FeatureGates.DeployVMConsoleProxy = &ptrVar1 @@ -176,6 +172,10 @@ func SetObjectDefaults_HyperConverged(in *HyperConverged) { in.Spec.HigherWorkloadDensity.MemoryOvercommitPercentage = 100 } } + if in.Spec.EnableCommonBootImageImport == nil { + var ptrVar1 bool = true + in.Spec.EnableCommonBootImageImport = &ptrVar1 + } } func SetObjectDefaults_HyperConvergedList(in *HyperConvergedList) { diff --git a/api/v1beta1/zz_generated.openapi.go b/api/v1beta1/zz_generated.openapi.go index 9e0817de7..02ec5b35a 100644 --- a/api/v1beta1/zz_generated.openapi.go +++ b/api/v1beta1/zz_generated.openapi.go @@ -248,8 +248,7 @@ func schema_kubevirt_hyperconverged_cluster_operator_api_v1beta1_HyperConvergedF }, "enableCommonBootImageImport": { SchemaProps: spec.SchemaProps{ - Description: "Opt-in to automatic delivery/updates of the common data import cron templates. There are two sources for the data import cron templates: hard coded list of common templates, and custom templates that can be added to the dataImportCronTemplates field. This feature gates only control the common templates. It is possible to use custom templates by adding them to the dataImportCronTemplates field.", - Default: true, + Description: "Opt-in to automatic delivery/updates of the common data import cron templates. There are two sources for the data import cron templates: hard coded list of common templates, and custom templates that can be added to the dataImportCronTemplates field. This feature gates only control the common templates. It is possible to use custom templates by adding them to the dataImportCronTemplates field. Deprecated: use spec.enableCommonBootImageImport instead", Type: []string{"boolean"}, Format: "", }, @@ -628,6 +627,14 @@ func schema_kubevirt_hyperconverged_cluster_operator_api_v1beta1_HyperConvergedS Ref: ref("github.com/kubevirt/hyperconverged-cluster-operator/api/v1beta1.HigherWorkloadDensityConfiguration"), }, }, + "enableCommonBootImageImport": { + SchemaProps: spec.SchemaProps{ + Description: "Opt-in to automatic delivery/updates of the common data import cron templates. There are two sources for the data import cron templates: hard coded list of common templates, and custom templates that can be added to the dataImportCronTemplates field. This feature gates only control the common templates. It is possible to use custom templates by adding them to the dataImportCronTemplates field.", + Default: true, + Type: []string{"boolean"}, + Format: "", + }, + }, }, }, }, diff --git a/assets/upgradePatches.json b/assets/upgradePatches.json index e474d385b..1179541d5 100644 --- a/assets/upgradePatches.json +++ b/assets/upgradePatches.json @@ -34,7 +34,37 @@ { "op": "replace", "path": "/spec/virtualMachineOptions/disableFreePageReporting", - "value": false + "value": false + } + ], + "jsonPatchApplyOptions": { + "allowMissingPathOnRemove": true + } + }, + { + "semverRange": "<1.15.0", + "jsonPatch": [ + { + "op": "test", + "path": "/spec/featureGates/enableCommonBootImageImport", + "value": false + }, + { + "op": "replace", + "path": "/spec/enableCommonBootImageImport", + "value": false + } + ], + "jsonPatchApplyOptions": { + "allowMissingPathOnRemove": true + } + }, + { + "semverRange": "<1.15.0", + "jsonPatch": [ + { + "op": "remove", + "path": "/spec/featureGates/enableCommonBootImageImport" } ], "jsonPatchApplyOptions": { diff --git a/config/crd/bases/hco.kubevirt.io_hyperconvergeds.yaml b/config/crd/bases/hco.kubevirt.io_hyperconvergeds.yaml index 2b02aba51..6f3067dff 100644 --- a/config/crd/bases/hco.kubevirt.io_hyperconvergeds.yaml +++ b/config/crd/bases/hco.kubevirt.io_hyperconvergeds.yaml @@ -56,6 +56,7 @@ spec: server: duration: 24h0m0s renewBefore: 12h0m0s + enableCommonBootImageImport: true featureGates: autoResourceLimits: false deployKubeSecondaryDNS: false @@ -64,7 +65,6 @@ spec: disableMDevConfiguration: false downwardMetrics: false enableApplicationAwareQuota: false - enableCommonBootImageImport: true persistentReservation: false primaryUserDefinedNetworkBinding: false liveMigrationConfig: @@ -1018,6 +1018,14 @@ spec: Default RuntimeClass can be changed when kubevirt is running, existing VMIs are not impacted till the next restart/live-migration when they are eventually going to consume the new default RuntimeClass. type: string + enableCommonBootImageImport: + default: true + description: |- + Opt-in to automatic delivery/updates of the common data import cron templates. + There are two sources for the data import cron templates: hard coded list of common templates, and custom + templates that can be added to the dataImportCronTemplates field. This feature gates only control the common + templates. It is possible to use custom templates by adding them to the dataImportCronTemplates field. + type: boolean evictionStrategy: description: |- EvictionStrategy defines at the cluster level if the VirtualMachineInstance should be @@ -1044,7 +1052,6 @@ spec: disableMDevConfiguration: false downwardMetrics: false enableApplicationAwareQuota: false - enableCommonBootImageImport: true persistentReservation: false primaryUserDefinedNetworkBinding: false description: |- @@ -1097,12 +1104,12 @@ spec: Application Aware Quota feature type: boolean enableCommonBootImageImport: - default: true description: |- Opt-in to automatic delivery/updates of the common data import cron templates. There are two sources for the data import cron templates: hard coded list of common templates, and custom templates that can be added to the dataImportCronTemplates field. This feature gates only control the common templates. It is possible to use custom templates by adding them to the dataImportCronTemplates field. + Deprecated: use spec.enableCommonBootImageImport instead type: boolean persistentReservation: default: false diff --git a/controllers/operands/imageStream.go b/controllers/operands/imageStream.go index 3961defd0..d14e6d34c 100644 --- a/controllers/operands/imageStream.go +++ b/controllers/operands/imageStream.go @@ -18,6 +18,7 @@ import ( hcov1beta1 "github.com/kubevirt/hyperconverged-cluster-operator/api/v1beta1" "github.com/kubevirt/hyperconverged-cluster-operator/controllers/common" + "github.com/kubevirt/hyperconverged-cluster-operator/pkg/boolean" "github.com/kubevirt/hyperconverged-cluster-operator/pkg/util" ) @@ -40,9 +41,8 @@ type imageStreamOperand struct { } func (iso imageStreamOperand) ensure(req *common.HcoRequest) *EnsureResult { - if req.Instance.Spec.FeatureGates.EnableCommonBootImageImport != nil && *req.Instance.Spec.FeatureGates.EnableCommonBootImageImport { - // if the FG is set, make sure the imageStream is in place and up-to-date - + // if the EnableCommonBootImageImport field is set, make sure the imageStream is in place and up-to-date + if boolean.IsTrue(req.Instance.Spec.EnableCommonBootImageImport) { if result := iso.checkCustomNamespace(req); result != nil { return result } diff --git a/controllers/operands/imageStream_test.go b/controllers/operands/imageStream_test.go index 1f8682e25..197199085 100644 --- a/controllers/operands/imageStream_test.go +++ b/controllers/operands/imageStream_test.go @@ -42,7 +42,7 @@ var _ = Describe("imageStream tests", func() { Context("test imageStreamHandler", func() { It("should not create the ImageStream resource if the FG is not set", func() { - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(false) + hco.Spec.EnableCommonBootImageImport = ptr.To(false) getImageStreamFileLocation = func() string { return testFilesLocation @@ -69,7 +69,7 @@ var _ = Describe("imageStream tests", func() { }) It("should delete the ImageStream resource if the FG is not set", func() { - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(false) + hco.Spec.EnableCommonBootImageImport = ptr.To(false) getImageStreamFileLocation = func() string { return testFilesLocation @@ -137,7 +137,7 @@ var _ = Describe("imageStream tests", func() { hcoNamespace := commontestutils.NewHcoNamespace() hco := commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) eventEmitter := commontestutils.NewEventEmitterMock() ci := commontestutils.ClusterInfoMock{} cli := commontestutils.InitClient([]client.Object{hcoNamespace, hco, ci.GetCSV()}) @@ -163,7 +163,7 @@ var _ = Describe("imageStream tests", func() { By("Run again, this time when the FG is false") eventEmitter.Reset() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(false) + hco.Spec.EnableCommonBootImageImport = ptr.To(false) req = commontestutils.NewReq(hco) Expect(handler.Ensure(req)).To(Succeed()) @@ -229,7 +229,7 @@ var _ = Describe("imageStream tests", func() { } hco := commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) cli := commontestutils.InitClient([]client.Object{hco}) handlers, err := getImageStreamHandlers(logger, cli, schemeForTest, hco) Expect(err).ToNot(HaveOccurred()) @@ -280,7 +280,7 @@ var _ = Describe("imageStream tests", func() { Expect(imageStreamNames).To(ContainElement("test-image-stream")) hco := commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) By("apply the ImageStream CRs", func() { req := commontestutils.NewReq(hco) res := handlers[0].ensure(req) @@ -344,7 +344,7 @@ var _ = Describe("imageStream tests", func() { Expect(imageStreamNames).To(ContainElement("test-image-stream")) hco := commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) By("apply the ImageStream CRs", func() { req := commontestutils.NewReq(hco) @@ -417,7 +417,7 @@ var _ = Describe("imageStream tests", func() { Expect(imageStreamNames).To(ContainElement("test-image-stream")) hco := commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) By("apply the ImageStream CRs", func() { req := commontestutils.NewReq(hco) @@ -486,7 +486,7 @@ var _ = Describe("imageStream tests", func() { Expect(imageStreamNames).To(ContainElement("test-image-stream")) hco := commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) By("apply the ImageStream CRs", func() { req := commontestutils.NewReq(hco) @@ -555,7 +555,7 @@ var _ = Describe("imageStream tests", func() { Expect(imageStreamNames).To(ContainElement("test-image-stream")) hco := commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) By("apply the ImageStream CRs", func() { req := commontestutils.NewReq(hco) @@ -625,7 +625,7 @@ var _ = Describe("imageStream tests", func() { Expect(imageStreamNames).To(ContainElement("test-image-stream")) hco := commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) By("apply the ImageStream CRs", func() { req := commontestutils.NewReq(hco) @@ -702,7 +702,7 @@ var _ = Describe("imageStream tests", func() { Expect(imageStreamNames).To(ContainElement("test-image-stream")) hco := commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) By("apply the ImageStream CRs", func() { req := commontestutils.NewReq(hco) @@ -753,7 +753,7 @@ var _ = Describe("imageStream tests", func() { } hco := commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) hco.Spec.CommonBootImageNamespace = ptr.To(customNS) cli := commontestutils.InitClient([]client.Object{hco}) @@ -781,7 +781,7 @@ var _ = Describe("imageStream tests", func() { By("create imagestream in the default namespace") hco := commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) cli := commontestutils.InitClient([]client.Object{hco}) handlers, err := getImageStreamHandlers(logger, cli, schemeForTest, hco) Expect(err).ToNot(HaveOccurred()) @@ -804,7 +804,7 @@ var _ = Describe("imageStream tests", func() { By("replace the image stream with a new one in the custom namespace") hco = commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) hco.Spec.CommonBootImageNamespace = ptr.To(customNS) Expect(objectreferencesv1.SetObjectReference(&hco.Status.RelatedObjects, *ref)).To(Succeed()) @@ -835,7 +835,7 @@ var _ = Describe("imageStream tests", func() { By("create imagestream in a custom namespace") hco := commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) hco.Spec.CommonBootImageNamespace = ptr.To(customNS) cli := commontestutils.InitClient([]client.Object{hco}) @@ -860,7 +860,7 @@ var _ = Describe("imageStream tests", func() { By("replace the image stream with a new one in the default namespace") hco = commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) Expect(objectreferencesv1.SetObjectReference(&hco.Status.RelatedObjects, *ref)).To(Succeed()) req = commontestutils.NewReq(hco) @@ -890,7 +890,7 @@ var _ = Describe("imageStream tests", func() { By("create imagestream in a custom namespace") hco := commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) hco.Spec.CommonBootImageNamespace = ptr.To(customNS) cli := commontestutils.InitClient([]client.Object{hco}) @@ -915,7 +915,7 @@ var _ = Describe("imageStream tests", func() { By("replace the image stream with a new one in another custom namespace") hco = commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) hco.Spec.CommonBootImageNamespace = ptr.To(customNS + "1") Expect(objectreferencesv1.SetObjectReference(&hco.Status.RelatedObjects, *ref)).To(Succeed()) diff --git a/controllers/operands/ssp.go b/controllers/operands/ssp.go index 654131e08..213e8a2c3 100644 --- a/controllers/operands/ssp.go +++ b/controllers/operands/ssp.go @@ -21,6 +21,7 @@ import ( hcov1beta1 "github.com/kubevirt/hyperconverged-cluster-operator/api/v1beta1" "github.com/kubevirt/hyperconverged-cluster-operator/controllers/common" + "github.com/kubevirt/hyperconverged-cluster-operator/pkg/boolean" "github.com/kubevirt/hyperconverged-cluster-operator/pkg/util" hcoutil "github.com/kubevirt/hyperconverged-cluster-operator/pkg/util" ) @@ -238,7 +239,7 @@ func getDataImportCronTemplates(hc *hcov1beta1.HyperConverged) ([]hcov1beta1.Dat } var dictList []hcov1beta1.DataImportCronTemplateStatus - if hc.Spec.FeatureGates.EnableCommonBootImageImport != nil && *hc.Spec.FeatureGates.EnableCommonBootImageImport { + if boolean.IsTrue(hc.Spec.EnableCommonBootImageImport) { dictList = getCommonDicts(dictList, crDicts, hc) } dictList = getCustomDicts(dictList, crDicts) diff --git a/controllers/operands/ssp_test.go b/controllers/operands/ssp_test.go index 1ce8fb604..daec7f522 100644 --- a/controllers/operands/ssp_test.go +++ b/controllers/operands/ssp_test.go @@ -692,7 +692,7 @@ var _ = Describe("SSP Operands", func() { It("should not return the hard coded list dataImportCron FeatureGate is false", func() { hco := commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(false) + hco.Spec.EnableCommonBootImageImport = ptr.To(false) dataImportCronTemplateHardCodedMap = map[string]hcov1beta1.DataImportCronTemplate{ image1.Name: image1, image2.Name: image2, @@ -711,10 +711,10 @@ var _ = Describe("SSP Operands", func() { It("should return an empty list if both the hard-coded list and the list from HC are empty", func() { hcoWithEmptyList := commontestutils.NewHco() - hcoWithEmptyList.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hcoWithEmptyList.Spec.EnableCommonBootImageImport = ptr.To(true) hcoWithEmptyList.Spec.DataImportCronTemplates = []hcov1beta1.DataImportCronTemplate{} hcoWithNilList := commontestutils.NewHco() - hcoWithNilList.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hcoWithNilList.Spec.EnableCommonBootImageImport = ptr.To(true) hcoWithNilList.Spec.DataImportCronTemplates = nil dataImportCronTemplateHardCodedMap = nil @@ -731,7 +731,7 @@ var _ = Describe("SSP Operands", func() { image2.Name: image2, } hco := commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) hco.Spec.DataImportCronTemplates = []hcov1beta1.DataImportCronTemplate{image3, image4} goldenImageList, err := getDataImportCronTemplates(hco) Expect(err).ToNot(HaveOccurred()) @@ -746,7 +746,7 @@ var _ = Describe("SSP Operands", func() { image2.Name: image2, } hco := commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) disabledImage1 := image1.DeepCopy() disableDict(disabledImage1) @@ -768,7 +768,7 @@ var _ = Describe("SSP Operands", func() { It("should not add user DIC template if it is disabled", func() { dataImportCronTemplateHardCodedMap = nil hco := commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) disabledUserImage := image1.DeepCopy() disableDict(disabledUserImage) @@ -794,7 +794,7 @@ var _ = Describe("SSP Operands", func() { image2.Name: image2, } hco := commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) image3Modified := image3.DeepCopy() image3Modified.Name = image4.Name @@ -806,7 +806,7 @@ var _ = Describe("SSP Operands", func() { It("Should reject if the CR list contain DIC templates with the same name", func() { hco := commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) image3Modified := image3.DeepCopy() image3Modified.Name = image4.Name @@ -824,7 +824,7 @@ var _ = Describe("SSP Operands", func() { } hco := commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) hco.Spec.DataImportCronTemplates = nil goldenImageList, err := getDataImportCronTemplates(hco) Expect(err).ToNot(HaveOccurred()) @@ -842,7 +842,7 @@ var _ = Describe("SSP Operands", func() { It("Should return only the CR list, if the hard-coded list is empty", func() { hco := commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) hco.Spec.DataImportCronTemplates = []hcov1beta1.DataImportCronTemplate{image3, image4} By("when dataImportCronTemplateHardCodedList is nil") @@ -880,7 +880,7 @@ var _ = Describe("SSP Operands", func() { } hco := commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) modifiedImage1 := image1.DeepCopy() modifiedImage1.Spec.Template.Spec.Source = &cdiv1beta1.DataVolumeSource{ @@ -926,7 +926,7 @@ var _ = Describe("SSP Operands", func() { } hco := commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) modifiedImage1 := image1.DeepCopy() storageFromCr := &cdiv1beta1.StorageSpec{ @@ -966,7 +966,7 @@ var _ = Describe("SSP Operands", func() { It("should return an empty list if there is no file and no list in the HyperConverged CR", func() { hco := commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) ssp, _, err := NewSSP(hco) Expect(err).ToNot(HaveOccurred()) @@ -983,7 +983,7 @@ var _ = Describe("SSP Operands", func() { Expect(readDataImportCronTemplatesFromFile()).To(Succeed()) hco := commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) ssp, _, err := NewSSP(hco) Expect(err).ToNot(HaveOccurred()) @@ -1003,7 +1003,7 @@ var _ = Describe("SSP Operands", func() { Expect(readDataImportCronTemplatesFromFile()).To(Succeed()) hco := commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) hco.Spec.DataImportCronTemplates = []hcov1beta1.DataImportCronTemplate{image3, image4} ssp, _, err := NewSSP(hco) Expect(err).ToNot(HaveOccurred()) @@ -1033,7 +1033,7 @@ var _ = Describe("SSP Operands", func() { Expect(readDataImportCronTemplatesFromFile()).To(Succeed()) hco := commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) Expect(dataImportCronTemplateHardCodedMap).To(HaveLen(2)) commonFedora := dataImportCronTemplateHardCodedMap["fedora-image-cron"] @@ -1063,7 +1063,7 @@ var _ = Describe("SSP Operands", func() { Expect(readDataImportCronTemplatesFromFile()).To(Succeed()) hco := commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) Expect(dataImportCronTemplateHardCodedMap).ToNot(BeEmpty()) image3Modified := image3.DeepCopy() @@ -1079,7 +1079,7 @@ var _ = Describe("SSP Operands", func() { Expect(readDataImportCronTemplatesFromFile()).To(Succeed()) hco := commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(false) + hco.Spec.EnableCommonBootImageImport = ptr.To(false) Expect(dataImportCronTemplateHardCodedMap).To(BeEmpty()) image3Modified := image3.DeepCopy() @@ -1096,7 +1096,7 @@ var _ = Describe("SSP Operands", func() { Expect(dataImportCronTemplateHardCodedMap).To(BeEmpty()) hco := commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) hco.Spec.DataImportCronTemplates = []hcov1beta1.DataImportCronTemplate{image3, image4} ssp, _, err := NewSSP(hco) Expect(err).ToNot(HaveOccurred()) @@ -1119,7 +1119,7 @@ var _ = Describe("SSP Operands", func() { Expect(readDataImportCronTemplatesFromFile()).To(Succeed()) hco := commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(false) + hco.Spec.EnableCommonBootImageImport = ptr.To(false) hco.Spec.DataImportCronTemplates = []hcov1beta1.DataImportCronTemplate{image3, image4} ssp, _, err := NewSSP(hco) Expect(err).ToNot(HaveOccurred()) @@ -1141,7 +1141,7 @@ var _ = Describe("SSP Operands", func() { Expect(readDataImportCronTemplatesFromFile()).To(Succeed()) hco := commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) Expect(dataImportCronTemplateHardCodedMap).To(HaveLen(2)) commonFedora := dataImportCronTemplateHardCodedMap["fedora-image-cron"] @@ -1177,7 +1177,7 @@ var _ = Describe("SSP Operands", func() { Expect(readDataImportCronTemplatesFromFile()).To(Succeed()) hco := commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) Expect(dataImportCronTemplateHardCodedMap).To(HaveLen(2)) @@ -1219,7 +1219,7 @@ var _ = Describe("SSP Operands", func() { Expect(readDataImportCronTemplatesFromFile()).To(Succeed()) hco := commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) hco.Spec.CommonBootImageNamespace = ptr.To(customNS) ssp, _, err := NewSSP(hco) Expect(err).ToNot(HaveOccurred()) @@ -1244,7 +1244,7 @@ var _ = Describe("SSP Operands", func() { Expect(readDataImportCronTemplatesFromFile()).To(Succeed()) hco := commontestutils.NewHco() - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) hco.Spec.CommonBootImageNamespace = ptr.To(customNS) hco.Spec.DataImportCronTemplates = []hcov1beta1.DataImportCronTemplate{image3, image4} ssp, _, err := NewSSP(hco) @@ -1316,7 +1316,7 @@ var _ = Describe("SSP Operands", func() { Context("on SSP create", func() { It("should create ssp with 2 common DICTs", func() { - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) expectedResource, _, err := NewSSP(hco) Expect(err).ToNot(HaveOccurred()) cl := commontestutils.InitClient([]client.Object{}) @@ -1344,7 +1344,7 @@ var _ = Describe("SSP Operands", func() { }) It("should create ssp with 2 custom DICTs", func() { - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(false) + hco.Spec.EnableCommonBootImageImport = ptr.To(false) hco.Spec.DataImportCronTemplates = []hcov1beta1.DataImportCronTemplate{image3, image4} expectedResource, _, err := NewSSP(hco) Expect(err).ToNot(HaveOccurred()) @@ -1373,7 +1373,7 @@ var _ = Describe("SSP Operands", func() { }) It("should create ssp with 2 common and 2 custom DICTs", func() { - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) hco.Spec.DataImportCronTemplates = []hcov1beta1.DataImportCronTemplate{image3, image4} expectedResource, _, err := NewSSP(hco) Expect(err).ToNot(HaveOccurred()) @@ -1406,7 +1406,7 @@ var _ = Describe("SSP Operands", func() { }) It("should create ssp with 1 common and 2 custom DICTs, when one of the common is disabled", func() { - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) sspCentos8 := dataImportCronTemplateHardCodedMap["centos8-image-cron"] disabledCentos8 := sspCentos8.DeepCopy() @@ -1445,7 +1445,7 @@ var _ = Describe("SSP Operands", func() { }) It("should create ssp with 1 modified common DICT and 2 custom DICTs, when one of the common is modified", func() { - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) sspCentos8 := dataImportCronTemplateHardCodedMap["centos8-image-cron"] modifiedCentos8 := sspCentos8.DeepCopy() @@ -1499,7 +1499,7 @@ var _ = Describe("SSP Operands", func() { }) It("should create ssp with custom namespace", func() { - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) hco.Spec.CommonBootImageNamespace = ptr.To(customNS) expectedResource, _, err := NewSSP(hco) Expect(err).ToNot(HaveOccurred()) @@ -1529,7 +1529,7 @@ var _ = Describe("SSP Operands", func() { }) It("modified or custom dicts should not be with custom namespace", func() { - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) sspCentos8 := dataImportCronTemplateHardCodedMap["centos8-image-cron"] modifiedCentos8 := sspCentos8.DeepCopy() @@ -1594,7 +1594,7 @@ var _ = Describe("SSP Operands", func() { Context("on SSP update", func() { It("should create ssp with 2 common DICTs", func() { - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) origSSP, _, err := NewSSP(hco) Expect(err).ToNot(HaveOccurred()) cl := commontestutils.InitClient([]client.Object{origSSP}) @@ -1622,7 +1622,7 @@ var _ = Describe("SSP Operands", func() { }) It("should create ssp with 2 custom DICTs", func() { - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(false) + hco.Spec.EnableCommonBootImageImport = ptr.To(false) origSSP, _, err := NewSSP(hco) Expect(err).ToNot(HaveOccurred()) @@ -1654,7 +1654,7 @@ var _ = Describe("SSP Operands", func() { }) It("should create ssp with 2 common and 2 custom DICTs", func() { - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) origSSP, _, err := NewSSP(hco) Expect(err).ToNot(HaveOccurred()) @@ -1690,7 +1690,7 @@ var _ = Describe("SSP Operands", func() { }) It("should create ssp with 1 common and 2 custom DICTs, when one of the common is disabled", func() { - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) origSSP, _, err := NewSSP(hco) Expect(err).ToNot(HaveOccurred()) @@ -1732,7 +1732,7 @@ var _ = Describe("SSP Operands", func() { It("should create ssp with 1 modified common DICT and 2 custom DICTs, when one of the common is modified", func() { const scName = "anotherStorageClassName" - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) origSSP, _, err := NewSSP(hco) Expect(err).ToNot(HaveOccurred()) @@ -1783,7 +1783,7 @@ var _ = Describe("SSP Operands", func() { }) It("should create ssp with 2 common DICTs, in a custom namespace", func() { - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) origSSP, _, err := NewSSP(hco) Expect(err).ToNot(HaveOccurred()) cl := commontestutils.InitClient([]client.Object{origSSP}) @@ -1815,7 +1815,7 @@ var _ = Describe("SSP Operands", func() { It("only non modified common dict should use the custom namespace", func() { const scName = "anotherStorageClassName" - hco.Spec.FeatureGates.EnableCommonBootImageImport = ptr.To(true) + hco.Spec.EnableCommonBootImageImport = ptr.To(true) origSSP, _, err := NewSSP(hco) Expect(err).ToNot(HaveOccurred()) diff --git a/deploy/crds/hco00.crd.yaml b/deploy/crds/hco00.crd.yaml index 2b02aba51..6f3067dff 100644 --- a/deploy/crds/hco00.crd.yaml +++ b/deploy/crds/hco00.crd.yaml @@ -56,6 +56,7 @@ spec: server: duration: 24h0m0s renewBefore: 12h0m0s + enableCommonBootImageImport: true featureGates: autoResourceLimits: false deployKubeSecondaryDNS: false @@ -64,7 +65,6 @@ spec: disableMDevConfiguration: false downwardMetrics: false enableApplicationAwareQuota: false - enableCommonBootImageImport: true persistentReservation: false primaryUserDefinedNetworkBinding: false liveMigrationConfig: @@ -1018,6 +1018,14 @@ spec: Default RuntimeClass can be changed when kubevirt is running, existing VMIs are not impacted till the next restart/live-migration when they are eventually going to consume the new default RuntimeClass. type: string + enableCommonBootImageImport: + default: true + description: |- + Opt-in to automatic delivery/updates of the common data import cron templates. + There are two sources for the data import cron templates: hard coded list of common templates, and custom + templates that can be added to the dataImportCronTemplates field. This feature gates only control the common + templates. It is possible to use custom templates by adding them to the dataImportCronTemplates field. + type: boolean evictionStrategy: description: |- EvictionStrategy defines at the cluster level if the VirtualMachineInstance should be @@ -1044,7 +1052,6 @@ spec: disableMDevConfiguration: false downwardMetrics: false enableApplicationAwareQuota: false - enableCommonBootImageImport: true persistentReservation: false primaryUserDefinedNetworkBinding: false description: |- @@ -1097,12 +1104,12 @@ spec: Application Aware Quota feature type: boolean enableCommonBootImageImport: - default: true description: |- Opt-in to automatic delivery/updates of the common data import cron templates. There are two sources for the data import cron templates: hard coded list of common templates, and custom templates that can be added to the dataImportCronTemplates field. This feature gates only control the common templates. It is possible to use custom templates by adding them to the dataImportCronTemplates field. + Deprecated: use spec.enableCommonBootImageImport instead type: boolean persistentReservation: default: false diff --git a/deploy/hco.cr.yaml b/deploy/hco.cr.yaml index 54ed72040..6dd3dff9e 100644 --- a/deploy/hco.cr.yaml +++ b/deploy/hco.cr.yaml @@ -11,6 +11,7 @@ spec: server: duration: 24h0m0s renewBefore: 12h0m0s + enableCommonBootImageImport: true featureGates: alignCPUs: false autoResourceLimits: false @@ -20,7 +21,6 @@ spec: disableMDevConfiguration: false downwardMetrics: false enableApplicationAwareQuota: false - enableCommonBootImageImport: true persistentReservation: false primaryUserDefinedNetworkBinding: false higherWorkloadDensity: diff --git a/deploy/index-image/community-kubevirt-hyperconverged/1.14.0/manifests/hco00.crd.yaml b/deploy/index-image/community-kubevirt-hyperconverged/1.14.0/manifests/hco00.crd.yaml index 2b02aba51..6f3067dff 100644 --- a/deploy/index-image/community-kubevirt-hyperconverged/1.14.0/manifests/hco00.crd.yaml +++ b/deploy/index-image/community-kubevirt-hyperconverged/1.14.0/manifests/hco00.crd.yaml @@ -56,6 +56,7 @@ spec: server: duration: 24h0m0s renewBefore: 12h0m0s + enableCommonBootImageImport: true featureGates: autoResourceLimits: false deployKubeSecondaryDNS: false @@ -64,7 +65,6 @@ spec: disableMDevConfiguration: false downwardMetrics: false enableApplicationAwareQuota: false - enableCommonBootImageImport: true persistentReservation: false primaryUserDefinedNetworkBinding: false liveMigrationConfig: @@ -1018,6 +1018,14 @@ spec: Default RuntimeClass can be changed when kubevirt is running, existing VMIs are not impacted till the next restart/live-migration when they are eventually going to consume the new default RuntimeClass. type: string + enableCommonBootImageImport: + default: true + description: |- + Opt-in to automatic delivery/updates of the common data import cron templates. + There are two sources for the data import cron templates: hard coded list of common templates, and custom + templates that can be added to the dataImportCronTemplates field. This feature gates only control the common + templates. It is possible to use custom templates by adding them to the dataImportCronTemplates field. + type: boolean evictionStrategy: description: |- EvictionStrategy defines at the cluster level if the VirtualMachineInstance should be @@ -1044,7 +1052,6 @@ spec: disableMDevConfiguration: false downwardMetrics: false enableApplicationAwareQuota: false - enableCommonBootImageImport: true persistentReservation: false primaryUserDefinedNetworkBinding: false description: |- @@ -1097,12 +1104,12 @@ spec: Application Aware Quota feature type: boolean enableCommonBootImageImport: - default: true description: |- Opt-in to automatic delivery/updates of the common data import cron templates. There are two sources for the data import cron templates: hard coded list of common templates, and custom templates that can be added to the dataImportCronTemplates field. This feature gates only control the common templates. It is possible to use custom templates by adding them to the dataImportCronTemplates field. + Deprecated: use spec.enableCommonBootImageImport instead type: boolean persistentReservation: default: false diff --git a/deploy/olm-catalog/community-kubevirt-hyperconverged/1.14.0/manifests/hco00.crd.yaml b/deploy/olm-catalog/community-kubevirt-hyperconverged/1.14.0/manifests/hco00.crd.yaml index 2b02aba51..6f3067dff 100644 --- a/deploy/olm-catalog/community-kubevirt-hyperconverged/1.14.0/manifests/hco00.crd.yaml +++ b/deploy/olm-catalog/community-kubevirt-hyperconverged/1.14.0/manifests/hco00.crd.yaml @@ -56,6 +56,7 @@ spec: server: duration: 24h0m0s renewBefore: 12h0m0s + enableCommonBootImageImport: true featureGates: autoResourceLimits: false deployKubeSecondaryDNS: false @@ -64,7 +65,6 @@ spec: disableMDevConfiguration: false downwardMetrics: false enableApplicationAwareQuota: false - enableCommonBootImageImport: true persistentReservation: false primaryUserDefinedNetworkBinding: false liveMigrationConfig: @@ -1018,6 +1018,14 @@ spec: Default RuntimeClass can be changed when kubevirt is running, existing VMIs are not impacted till the next restart/live-migration when they are eventually going to consume the new default RuntimeClass. type: string + enableCommonBootImageImport: + default: true + description: |- + Opt-in to automatic delivery/updates of the common data import cron templates. + There are two sources for the data import cron templates: hard coded list of common templates, and custom + templates that can be added to the dataImportCronTemplates field. This feature gates only control the common + templates. It is possible to use custom templates by adding them to the dataImportCronTemplates field. + type: boolean evictionStrategy: description: |- EvictionStrategy defines at the cluster level if the VirtualMachineInstance should be @@ -1044,7 +1052,6 @@ spec: disableMDevConfiguration: false downwardMetrics: false enableApplicationAwareQuota: false - enableCommonBootImageImport: true persistentReservation: false primaryUserDefinedNetworkBinding: false description: |- @@ -1097,12 +1104,12 @@ spec: Application Aware Quota feature type: boolean enableCommonBootImageImport: - default: true description: |- Opt-in to automatic delivery/updates of the common data import cron templates. There are two sources for the data import cron templates: hard coded list of common templates, and custom templates that can be added to the dataImportCronTemplates field. This feature gates only control the common templates. It is possible to use custom templates by adding them to the dataImportCronTemplates field. + Deprecated: use spec.enableCommonBootImageImport instead type: boolean persistentReservation: default: false diff --git a/docs/api.md b/docs/api.md index ee571e56a..889dbcd9a 100644 --- a/docs/api.md +++ b/docs/api.md @@ -121,7 +121,7 @@ HyperConverged is the Schema for the hyperconvergeds API | Field | Description | Scheme | Default | Required | | ----- | ----------- | ------ | -------- |-------- | | metadata | | [metav1.ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#objectmeta-v1-meta) | | false | -| spec | | [HyperConvergedSpec](#hyperconvergedspec) | {"certConfig": {"ca": {"duration": "48h0m0s", "renewBefore": "24h0m0s"}, "server": {"duration": "24h0m0s", "renewBefore": "12h0m0s"}},"featureGates": {"downwardMetrics": false, "enableCommonBootImageImport": true, "deployVmConsoleProxy": false, "deployKubeSecondaryDNS": false, "deployKubevirtIpamController": false, "disableMDevConfiguration": false, "persistentReservation": 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}} | false | +| spec | | [HyperConvergedSpec](#hyperconvergedspec) | {"certConfig": {"ca": {"duration": "48h0m0s", "renewBefore": "24h0m0s"}, "server": {"duration": "24h0m0s", "renewBefore": "12h0m0s"}},"featureGates": {"downwardMetrics": false, "deployVmConsoleProxy": false, "deployKubeSecondaryDNS": false, "deployKubevirtIpamController": false, "disableMDevConfiguration": false, "persistentReservation": 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}, "enableCommonBootImageImport": true} | false | | status | | [HyperConvergedStatus](#hyperconvergedstatus) | | false | [Back to TOC](#table-of-contents) @@ -155,7 +155,7 @@ HyperConvergedFeatureGates is a set of optional feature gates to enable or disab | ----- | ----------- | ------ | -------- |-------- | | downwardMetrics | Allow to expose a limited set of host metrics to guests. | *bool | false | false | | withHostPassthroughCPU | Allow migrating a virtual machine with CPU host-passthrough mode. This should be enabled only when the Cluster is homogeneous from CPU HW perspective doc here Deprecated: there is no such FG in KubeVirt. This field is ignored | *bool | | false | -| enableCommonBootImageImport | Opt-in to automatic delivery/updates of the common data import cron templates. There are two sources for the data import cron templates: hard coded list of common templates, and custom templates that can be added to the dataImportCronTemplates field. This feature gates only control the common templates. It is possible to use custom templates by adding them to the dataImportCronTemplates field. | *bool | true | false | +| enableCommonBootImageImport | Opt-in to automatic delivery/updates of the common data import cron templates. There are two sources for the data import cron templates: hard coded list of common templates, and custom templates that can be added to the dataImportCronTemplates field. This feature gates only control the common templates. It is possible to use custom templates by adding them to the dataImportCronTemplates field. Deprecated: use spec.enableCommonBootImageImport instead | *bool | | false | | deployVmConsoleProxy | deploy VM console proxy resources in SSP operator | *bool | false | false | | deployKubeSecondaryDNS | Deploy KubeSecondaryDNS by CNAO | *bool | false | false | | deployKubevirtIpamController | Deploy KubevirtIpamController by CNAO. Allows having persistent IPs for Kubevirt user defined networks. | *bool | false | false | @@ -200,7 +200,7 @@ HyperConvergedSpec defines the desired state of HyperConverged | tuningPolicy | TuningPolicy allows to configure the mode in which the RateLimits of kubevirt are set. If TuningPolicy is not present the default kubevirt values are used. It can be set to `annotation` for fine-tuning the kubevirt queryPerSeconds (qps) and burst values. Qps and burst values are taken from the annotation hco.kubevirt.io/tuningPolicy | HyperConvergedTuningPolicy | | false | | infra | infra HyperConvergedConfig influences the pod configuration (currently only placement) for all the infra components needed on the virtualization enabled cluster but not necessarily directly on each node running VMs/VMIs. | [HyperConvergedConfig](#hyperconvergedconfig) | | false | | workloads | workloads HyperConvergedConfig influences the pod configuration (currently only placement) of components which need to be running on a node where virtualization workloads should be able to run. Changes to Workloads HyperConvergedConfig can be applied only without existing workload. | [HyperConvergedConfig](#hyperconvergedconfig) | | false | -| featureGates | featureGates is a map of feature gate flags. Setting a flag to `true` will enable the feature. Setting `false` or removing the feature gate, disables the feature. | [HyperConvergedFeatureGates](#hyperconvergedfeaturegates) | {"downwardMetrics": false, "enableCommonBootImageImport": true, "deployVmConsoleProxy": false, "deployKubeSecondaryDNS": false, "deployKubevirtIpamController": false, "disableMDevConfiguration": false, "persistentReservation": false, "autoResourceLimits": false, "enableApplicationAwareQuota": false, "primaryUserDefinedNetworkBinding": false} | false | +| featureGates | featureGates is a map of feature gate flags. Setting a flag to `true` will enable the feature. Setting `false` or removing the feature gate, disables the feature. | [HyperConvergedFeatureGates](#hyperconvergedfeaturegates) | {"downwardMetrics": false, "deployVmConsoleProxy": false, "deployKubeSecondaryDNS": false, "deployKubevirtIpamController": false, "disableMDevConfiguration": false, "persistentReservation": false, "autoResourceLimits": false, "enableApplicationAwareQuota": false, "primaryUserDefinedNetworkBinding": false} | false | | liveMigrationConfig | Live migration limits and timeouts are applied so that migration processes do not overwhelm the cluster. | [LiveMigrationConfigurations](#livemigrationconfigurations) | {"completionTimeoutPerGiB": 800, "parallelMigrationsPerCluster": 5, "parallelOutboundMigrationsPerNode": 2, "progressTimeout": 150, "allowAutoConverge": false, "allowPostCopy": false} | false | | permittedHostDevices | PermittedHostDevices holds information about devices allowed for passthrough | *[PermittedHostDevices](#permittedhostdevices) | | false | | mediatedDevicesConfiguration | MediatedDevicesConfiguration holds information about MDEV types to be defined on nodes, if available | *[MediatedDevicesConfiguration](#mediateddevicesconfiguration) | | false | @@ -230,6 +230,7 @@ HyperConvergedSpec defines the desired state of HyperConverged | networkBinding | NetworkBinding defines the network binding plugins. Those bindings can be used when defining virtual machine interfaces. | map[string]v1.InterfaceBindingPlugin | | false | | applicationAwareConfig | ApplicationAwareConfig set the AAQ configurations | *[ApplicationAwareConfigurations](#applicationawareconfigurations) | | false | | higherWorkloadDensity | HigherWorkloadDensity holds configurataion aimed to increase virtual machine density | *[HigherWorkloadDensityConfiguration](#higherworkloaddensityconfiguration) | {"memoryOvercommitPercentage": 100} | false | +| enableCommonBootImageImport | Opt-in to automatic delivery/updates of the common data import cron templates. There are two sources for the data import cron templates: hard coded list of common templates, and custom templates that can be added to the dataImportCronTemplates field. This feature gates only control the common templates. It is possible to use custom templates by adding them to the dataImportCronTemplates field. | *bool | true | false | [Back to TOC](#table-of-contents) diff --git a/docs/cluster-configuration.md b/docs/cluster-configuration.md index d0a28c240..736d6f530 100644 --- a/docs/cluster-configuration.md +++ b/docs/cluster-configuration.md @@ -144,18 +144,6 @@ virtual machine. ### withHostPassthroughCPU Feature Gate This feature gate is deprecated and is ignored. -### enableCommonBootImageImport Feature Gate - -Set the `enableCommonBootImageImport` feature gate to `false` in order to disable the common golden images in the cluster -(for instance to reduce logs noise on disconnected environments). -For additional information, see -here: https://github.com/kubevirt/community/blob/master/design-proposals/golden-image-delivery-and-update-pipeline.md - -**Note**: Custom golden images are enabled by adding them -the [dataImportCronTemplates field](#configure-custom-golden-images), even if this feature gate is `false`. - -**Default**: `true` - ### deployVmConsoleProxy Feature Gate Set the `deployVmConsoleProxy` feature gate to true to allow SSP operator to deploy its resources. SSP operator will deploy a proxy that provides an access to the VNC console of a KubeVirt Virtual Machine (VM). @@ -841,6 +829,20 @@ The list of all the golden images is available at the `status` field, under `dat The supported modifications are: disabling a specific image, and changing the `storage` field. Editing other fields will be ignored by HCO. +### Disabling all common golden images + +Set the `spec.enableCommonBootImageImport` to `false` in order to disable the common golden images in the cluster +(for instance to reduce logs noise on disconnected environments). +For additional information, see +here: https://github.com/kubevirt/community/blob/master/design-proposals/golden-image-delivery-and-update-pipeline.md + +**Note**: `spec.enableCommonBootImageImport` is `true` by default. + +Example: +```yaml +spec: + enableCommonBootImageImport: false +``` ### Disabling a common golden image To disable a golden image, add it to the dataImportCronTemplates` field in the spec object, with the `dataimportcrontemplate.kubevirt.io/enable` annotation, with the value of `false`; for example, disabling the fedora golden image: ```yaml diff --git a/pkg/boolean/boolean.go b/pkg/boolean/boolean.go new file mode 100644 index 000000000..8500b7b52 --- /dev/null +++ b/pkg/boolean/boolean.go @@ -0,0 +1,5 @@ +package boolean + +func IsTrue(b *bool) bool { + return b != nil && *b +} diff --git a/tests/func-tests/defaults_test.go b/tests/func-tests/defaults_test.go index da4b6c138..c1231147f 100644 --- a/tests/func-tests/defaults_test.go +++ b/tests/func-tests/defaults_test.go @@ -71,7 +71,6 @@ var _ = Describe("Check Default values", Label("defaults"), Serial, func() { DeployKubevirtIpamController: ptr.To(false), DeployVMConsoleProxy: ptr.To(false), DisableMDevConfiguration: ptr.To(false), - EnableCommonBootImageImport: ptr.To(true), PersistentReservation: ptr.To(false), AutoResourceLimits: ptr.To(false), AlignCPUs: ptr.To(false), @@ -94,7 +93,6 @@ var _ = Describe("Check Default values", Label("defaults"), Serial, func() { Entry("when removing /spec/featureGates/deployKubeSecondaryDNS", "/spec/featureGates/deployKubeSecondaryDNS"), Entry("when removing /spec/featureGates/deployKubevirtIpamController", "/spec/featureGates/deployKubevirtIpamController"), Entry("when removing /spec/featureGates/deployVmConsoleProxy", "/spec/featureGates/deployVmConsoleProxy"), - Entry("when removing /spec/featureGates/enableCommonBootImageImport", "/spec/featureGates/enableCommonBootImageImport"), Entry("when removing /spec/featureGates/persistentReservation", "/spec/featureGates/persistentReservation"), Entry("when removing /spec/featureGates/autoResourceLimits", "/spec/featureGates/autoResourceLimits"), Entry("when removing /spec/featureGates/alignCPUs", "/spec/featureGates/alignCPUs"),