From 8399021c4d2de6dbae08c0261f171aaabf71d1d9 Mon Sep 17 00:00:00 2001 From: Javier Cano Cano Date: Fri, 15 Mar 2024 16:00:09 +0100 Subject: [PATCH] Make `downwardMetric` feature gate opt-in The feature gate `downwardMetric` is an opt-out feature gate. This is due to backward compatibility reasons. Before this feature gate was introduced, it was hardcoded. It makes this feature gate to be disabled by default, leaving this decision to the final user. Signed-off-by: Javier Cano Cano --- api/v1beta1/hyperconverged_types.go | 6 ++-- api/v1beta1/zz_generated.defaults.go | 4 +++ api/v1beta1/zz_generated.openapi.go | 1 + .../hco.kubevirt.io_hyperconvergeds.yaml | 3 ++ .../hyperconverged_controller_test.go | 1 - controllers/operands/kubevirt.go | 5 +--- controllers/operands/kubevirt_test.go | 28 +++++++++---------- deploy/crds/hco00.crd.yaml | 3 ++ deploy/hco.cr.yaml | 1 + .../1.12.0/manifests/hco00.crd.yaml | 3 ++ .../1.12.0/manifests/hco00.crd.yaml | 3 ++ docs/api.md | 6 ++-- docs/cluster-configuration.md | 6 ++-- tests/func-tests/defaults_test.go | 2 ++ .../api/v1beta1/hyperconverged_types.go | 6 ++-- .../api/v1beta1/zz_generated.defaults.go | 4 +++ .../api/v1beta1/zz_generated.openapi.go | 1 + 17 files changed, 53 insertions(+), 30 deletions(-) diff --git a/api/v1beta1/hyperconverged_types.go b/api/v1beta1/hyperconverged_types.go index 3a36642e1f..c5bf798512 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={"withHostPassthroughCPU": false, "enableCommonBootImageImport": true, "deployTektonTaskResources": false, "deployVmConsoleProxy": false, "deployKubeSecondaryDNS": false, "nonRoot": true, "disableMDevConfiguration": false, "persistentReservation": false, "enableManagedTenantQuota": false,"autoResourceLimits": false, "enableApplicationAwareQuota": false} + // +kubebuilder:default={"downwardMetrics": false, "withHostPassthroughCPU": false, "enableCommonBootImageImport": true, "deployTektonTaskResources": false, "deployVmConsoleProxy": false, "deployKubeSecondaryDNS": false, "nonRoot": true, "disableMDevConfiguration": false, "persistentReservation": false, "enableManagedTenantQuota": false,"autoResourceLimits": false, "enableApplicationAwareQuota": false} // +optional FeatureGates HyperConvergedFeatureGates `json:"featureGates,omitempty"` @@ -395,6 +395,8 @@ type VirtualMachineOptions struct { type HyperConvergedFeatureGates struct { // Allow to expose a limited set of host metrics to guests. // +optional + // +kubebuilder:default=false + // +default=false DownwardMetrics *bool `json:"downwardMetrics,omitempty"` // Allow migrating a virtual machine with CPU host-passthrough mode. This should be @@ -819,7 +821,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": {"withHostPassthroughCPU": false, "enableCommonBootImageImport": true, "deployTektonTaskResources": false, "deployVmConsoleProxy": false, "deployKubeSecondaryDNS": false, "nonRoot": true, "disableMDevConfiguration": false, "persistentReservation": false, "enableManagedTenantQuota": false, "autoResourceLimits": false, "enableApplicationAwareQuota": 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, "nonRoot": true, "disableMDevConfiguration": false, "persistentReservation": false, "enableManagedTenantQuota": false, "autoResourceLimits": false, "enableApplicationAwareQuota": false}, "liveMigrationConfig": {"completionTimeoutPerGiB": 800, "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"` diff --git a/api/v1beta1/zz_generated.defaults.go b/api/v1beta1/zz_generated.defaults.go index 27de080836..dbd7fdf8a9 100644 --- a/api/v1beta1/zz_generated.defaults.go +++ b/api/v1beta1/zz_generated.defaults.go @@ -40,6 +40,10 @@ func RegisterDefaults(scheme *runtime.Scheme) error { } func SetObjectDefaults_HyperConverged(in *HyperConverged) { + if in.Spec.FeatureGates.DownwardMetrics == nil { + var ptrVar1 bool = false + in.Spec.FeatureGates.DownwardMetrics = &ptrVar1 + } if in.Spec.FeatureGates.WithHostPassthroughCPU == nil { var ptrVar1 bool = false in.Spec.FeatureGates.WithHostPassthroughCPU = &ptrVar1 diff --git a/api/v1beta1/zz_generated.openapi.go b/api/v1beta1/zz_generated.openapi.go index 849cf65ec4..6d3c6c0a76 100644 --- a/api/v1beta1/zz_generated.openapi.go +++ b/api/v1beta1/zz_generated.openapi.go @@ -234,6 +234,7 @@ func schema_kubevirt_hyperconverged_cluster_operator_api_v1beta1_HyperConvergedF "downwardMetrics": { SchemaProps: spec.SchemaProps{ Description: "Allow to expose a limited set of host metrics to guests.", + Default: false, Type: []string{"boolean"}, Format: "", }, diff --git a/config/crd/bases/hco.kubevirt.io_hyperconvergeds.yaml b/config/crd/bases/hco.kubevirt.io_hyperconvergeds.yaml index 381fb810df..e36c79aa73 100644 --- a/config/crd/bases/hco.kubevirt.io_hyperconvergeds.yaml +++ b/config/crd/bases/hco.kubevirt.io_hyperconvergeds.yaml @@ -62,6 +62,7 @@ spec: deployTektonTaskResources: false deployVmConsoleProxy: false disableMDevConfiguration: false + downwardMetrics: false enableApplicationAwareQuota: false enableCommonBootImageImport: true enableManagedTenantQuota: false @@ -1065,6 +1066,7 @@ spec: deployTektonTaskResources: false deployVmConsoleProxy: false disableMDevConfiguration: false + downwardMetrics: false enableApplicationAwareQuota: false enableCommonBootImageImport: true enableManagedTenantQuota: false @@ -1110,6 +1112,7 @@ spec: description: Disable mediated devices handling on KubeVirt type: boolean downwardMetrics: + default: false description: Allow to expose a limited set of host metrics to guests. type: boolean diff --git a/controllers/hyperconverged/hyperconverged_controller_test.go b/controllers/hyperconverged/hyperconverged_controller_test.go index 7e4aa53ef9..6a8019973f 100644 --- a/controllers/hyperconverged/hyperconverged_controller_test.go +++ b/controllers/hyperconverged/hyperconverged_controller_test.go @@ -204,7 +204,6 @@ var _ = Describe("HyperconvergedController", func() { "HostDevices", "WithHostModelCPU", "HypervStrictCheck", - "DownwardMetrics", "ExpandDisks", "NUMA", "WithHostPassthroughCPU", diff --git a/controllers/operands/kubevirt.go b/controllers/operands/kubevirt.go index d31402768d..2487f4e220 100644 --- a/controllers/operands/kubevirt.go +++ b/controllers/operands/kubevirt.go @@ -756,7 +756,7 @@ func hcoConfig2KvConfig(hcoConfig hcov1beta1.HyperConvergedConfig, infrastructur func getFeatureGateChecks(featureGates *hcov1beta1.HyperConvergedFeatureGates) []string { fgs := make([]string, 0, 2) - if featureGates.DownwardMetrics == nil || *featureGates.DownwardMetrics { + if featureGates.DownwardMetrics != nil && *featureGates.DownwardMetrics { fgs = append(fgs, kvDownwardMetrics) } @@ -889,11 +889,8 @@ func getMandatoryKvFeatureGates(isKVMEmulation bool) []string { // get list of feature gates or KV FG list func getKvFeatureGateList(fgs *hcov1beta1.HyperConvergedFeatureGates) []string { checks := getFeatureGateChecks(fgs) - res := make([]string, 0, len(checks)+len(mandatoryKvFeatureGates)+1) - res = append(res, mandatoryKvFeatureGates...) - res = append(res, checks...) return res diff --git a/controllers/operands/kubevirt_test.go b/controllers/operands/kubevirt_test.go index fe730bb074..5189e0b893 100644 --- a/controllers/operands/kubevirt_test.go +++ b/controllers/operands/kubevirt_test.go @@ -29,8 +29,6 @@ import ( ) var _ = Describe("KubeVirt Operand", func() { - // DownwardMetrics FG is not listed on any of these lists, but it is enabled by default - const enabledByDefaultFeatureGates = 1 var ( basicNumFgOnOpenshift = len(hardCodeKvFgs) + len(sspConditionKvFgs) @@ -221,7 +219,7 @@ Version: 1.2.3`) Expect(foundResource.Namespace).To(Equal(expectedResource.Namespace)) Expect(foundResource.Spec.Configuration.DeveloperConfiguration).ToNot(BeNil()) - Expect(foundResource.Spec.Configuration.DeveloperConfiguration.FeatureGates).To(HaveLen(basicNumFgOnOpenshift + 1 + enabledByDefaultFeatureGates)) + Expect(foundResource.Spec.Configuration.DeveloperConfiguration.FeatureGates).To(HaveLen(basicNumFgOnOpenshift + 1)) Expect(foundResource.Spec.Configuration.DeveloperConfiguration.FeatureGates).To(ContainElements( hardCodeKvFgs, )) @@ -425,7 +423,7 @@ Version: 1.2.3`) foundResource), ).ToNot(HaveOccurred()) Expect(foundResource.Spec.Configuration.DeveloperConfiguration).ToNot(BeNil()) - Expect(foundResource.Spec.Configuration.DeveloperConfiguration.FeatureGates).To(HaveLen(basicNumFgOnOpenshift + 1 + enabledByDefaultFeatureGates)) + Expect(foundResource.Spec.Configuration.DeveloperConfiguration.FeatureGates).To(HaveLen(basicNumFgOnOpenshift + 1)) Expect(foundResource.Spec.Configuration.DeveloperConfiguration.FeatureGates).To(ContainElements( hardCodeKvFgs, )) @@ -1795,7 +1793,7 @@ Version: 1.2.3`) Expect(existingResource.Spec.Configuration.DeveloperConfiguration).ToNot(BeNil()) fgList := getKvFeatureGateList(&hco.Spec.FeatureGates) - Expect(fgList).To(HaveLen(basicNumFgOnOpenshift + enabledByDefaultFeatureGates)) + Expect(fgList).To(HaveLen(basicNumFgOnOpenshift)) Expect(fgList).To(ContainElements(hardCodeKvFgs)) Expect(fgList).To(ContainElements(sspConditionKvFgs)) }) @@ -1813,7 +1811,7 @@ Version: 1.2.3`) }) }) - It("should add the DownwardMetrics if feature gate DownwardMetrics is not in HyperConverged CR", func() { + It("should no add the DownwardMetrics if feature gate DownwardMetrics is not in HyperConverged CR", func() { hco.Spec.FeatureGates = hcov1beta1.HyperConvergedFeatureGates{ DownwardMetrics: nil, } @@ -1822,7 +1820,7 @@ Version: 1.2.3`) Expect(err).ToNot(HaveOccurred()) By("KV CR should contain the DownwardMetrics feature gate", func() { Expect(existingResource.Spec.Configuration.DeveloperConfiguration).NotTo(BeNil()) - Expect(existingResource.Spec.Configuration.DeveloperConfiguration.FeatureGates).To(ContainElement(kvDownwardMetrics)) + Expect(existingResource.Spec.Configuration.DeveloperConfiguration.FeatureGates).ToNot(ContainElement(kvDownwardMetrics)) }) }) @@ -1913,7 +1911,7 @@ Version: 1.2.3`) mandatoryKvFeatureGates = getMandatoryKvFeatureGates(false) Expect(foundResource.Spec.Configuration.DeveloperConfiguration).ToNot(BeNil()) fgList := getKvFeatureGateList(&hco.Spec.FeatureGates) - Expect(fgList).To(HaveLen(basicNumFgOnOpenshift + enabledByDefaultFeatureGates)) + Expect(fgList).To(HaveLen(basicNumFgOnOpenshift)) Expect(fgList).To(ContainElements(hardCodeKvFgs)) Expect(fgList).To(ContainElements(sspConditionKvFgs)) }) @@ -2097,7 +2095,7 @@ Version: 1.2.3`) ).ToNot(HaveOccurred()) Expect(foundResource.Spec.Configuration.DeveloperConfiguration).ToNot(BeNil()) - Expect(foundResource.Spec.Configuration.DeveloperConfiguration.FeatureGates).To(HaveLen(len(hardCodeKvFgs) + enabledByDefaultFeatureGates)) + Expect(foundResource.Spec.Configuration.DeveloperConfiguration.FeatureGates).To(HaveLen(len(hardCodeKvFgs))) Expect(foundResource.Spec.Configuration.DeveloperConfiguration.FeatureGates).To(ContainElements(hardCodeKvFgs)) }) }) @@ -2128,37 +2126,37 @@ Version: 1.2.3`) Entry("When not using kvm-emulation and FG is empty", false, &hcov1beta1.HyperConvergedFeatureGates{}, - basicNumFgOnOpenshift+enabledByDefaultFeatureGates, + basicNumFgOnOpenshift, [][]string{hardCodeKvFgs, sspConditionKvFgs}, ), Entry("When using kvm-emulation and FG is empty", true, &hcov1beta1.HyperConvergedFeatureGates{}, - len(hardCodeKvFgs)+enabledByDefaultFeatureGates, + len(hardCodeKvFgs), [][]string{hardCodeKvFgs}, ), Entry("When not using kvm-emulation and all FGs are disabled", false, &hcov1beta1.HyperConvergedFeatureGates{WithHostPassthroughCPU: ptr.To(false)}, - basicNumFgOnOpenshift+enabledByDefaultFeatureGates, + basicNumFgOnOpenshift, [][]string{hardCodeKvFgs, sspConditionKvFgs}, ), Entry("When using kvm-emulation all FGs are disabled", true, &hcov1beta1.HyperConvergedFeatureGates{WithHostPassthroughCPU: ptr.To(false)}, - len(hardCodeKvFgs)+enabledByDefaultFeatureGates, + len(hardCodeKvFgs), [][]string{hardCodeKvFgs}, ), Entry("When not using kvm-emulation and all FGs are enabled", false, &hcov1beta1.HyperConvergedFeatureGates{WithHostPassthroughCPU: ptr.To(true)}, - basicNumFgOnOpenshift+1+enabledByDefaultFeatureGates, + basicNumFgOnOpenshift+1, [][]string{hardCodeKvFgs, sspConditionKvFgs, {kvWithHostPassthroughCPU}}, ), Entry("When using kvm-emulation all FGs are enabled", true, &hcov1beta1.HyperConvergedFeatureGates{WithHostPassthroughCPU: ptr.To(true)}, - len(hardCodeKvFgs)+1+enabledByDefaultFeatureGates, + len(hardCodeKvFgs)+1, [][]string{hardCodeKvFgs, {kvWithHostPassthroughCPU}}, )) }) diff --git a/deploy/crds/hco00.crd.yaml b/deploy/crds/hco00.crd.yaml index 381fb810df..e36c79aa73 100644 --- a/deploy/crds/hco00.crd.yaml +++ b/deploy/crds/hco00.crd.yaml @@ -62,6 +62,7 @@ spec: deployTektonTaskResources: false deployVmConsoleProxy: false disableMDevConfiguration: false + downwardMetrics: false enableApplicationAwareQuota: false enableCommonBootImageImport: true enableManagedTenantQuota: false @@ -1065,6 +1066,7 @@ spec: deployTektonTaskResources: false deployVmConsoleProxy: false disableMDevConfiguration: false + downwardMetrics: false enableApplicationAwareQuota: false enableCommonBootImageImport: true enableManagedTenantQuota: false @@ -1110,6 +1112,7 @@ spec: description: Disable mediated devices handling on KubeVirt type: boolean downwardMetrics: + default: false description: Allow to expose a limited set of host metrics to guests. type: boolean diff --git a/deploy/hco.cr.yaml b/deploy/hco.cr.yaml index ab721d97b5..a393b18844 100644 --- a/deploy/hco.cr.yaml +++ b/deploy/hco.cr.yaml @@ -18,6 +18,7 @@ spec: deployTektonTaskResources: false deployVmConsoleProxy: false disableMDevConfiguration: false + downwardMetrics: false enableApplicationAwareQuota: false enableCommonBootImageImport: true enableManagedTenantQuota: false diff --git a/deploy/index-image/community-kubevirt-hyperconverged/1.12.0/manifests/hco00.crd.yaml b/deploy/index-image/community-kubevirt-hyperconverged/1.12.0/manifests/hco00.crd.yaml index 381fb810df..e36c79aa73 100644 --- a/deploy/index-image/community-kubevirt-hyperconverged/1.12.0/manifests/hco00.crd.yaml +++ b/deploy/index-image/community-kubevirt-hyperconverged/1.12.0/manifests/hco00.crd.yaml @@ -62,6 +62,7 @@ spec: deployTektonTaskResources: false deployVmConsoleProxy: false disableMDevConfiguration: false + downwardMetrics: false enableApplicationAwareQuota: false enableCommonBootImageImport: true enableManagedTenantQuota: false @@ -1065,6 +1066,7 @@ spec: deployTektonTaskResources: false deployVmConsoleProxy: false disableMDevConfiguration: false + downwardMetrics: false enableApplicationAwareQuota: false enableCommonBootImageImport: true enableManagedTenantQuota: false @@ -1110,6 +1112,7 @@ spec: description: Disable mediated devices handling on KubeVirt type: boolean downwardMetrics: + default: false description: Allow to expose a limited set of host metrics to guests. type: boolean diff --git a/deploy/olm-catalog/community-kubevirt-hyperconverged/1.12.0/manifests/hco00.crd.yaml b/deploy/olm-catalog/community-kubevirt-hyperconverged/1.12.0/manifests/hco00.crd.yaml index 381fb810df..e36c79aa73 100644 --- a/deploy/olm-catalog/community-kubevirt-hyperconverged/1.12.0/manifests/hco00.crd.yaml +++ b/deploy/olm-catalog/community-kubevirt-hyperconverged/1.12.0/manifests/hco00.crd.yaml @@ -62,6 +62,7 @@ spec: deployTektonTaskResources: false deployVmConsoleProxy: false disableMDevConfiguration: false + downwardMetrics: false enableApplicationAwareQuota: false enableCommonBootImageImport: true enableManagedTenantQuota: false @@ -1065,6 +1066,7 @@ spec: deployTektonTaskResources: false deployVmConsoleProxy: false disableMDevConfiguration: false + downwardMetrics: false enableApplicationAwareQuota: false enableCommonBootImageImport: true enableManagedTenantQuota: false @@ -1110,6 +1112,7 @@ spec: description: Disable mediated devices handling on KubeVirt type: boolean downwardMetrics: + default: false description: Allow to expose a limited set of host metrics to guests. type: boolean diff --git a/docs/api.md b/docs/api.md index d60e258f6b..7c21e30e94 100644 --- a/docs/api.md +++ b/docs/api.md @@ -119,7 +119,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": {"withHostPassthroughCPU": false, "enableCommonBootImageImport": true, "deployTektonTaskResources": false, "deployVmConsoleProxy": false, "deployKubeSecondaryDNS": false, "nonRoot": true, "disableMDevConfiguration": false, "persistentReservation": false, "enableManagedTenantQuota": false, "autoResourceLimits": false, "enableApplicationAwareQuota": 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, "withHostPassthroughCPU": false, "enableCommonBootImageImport": true, "deployTektonTaskResources": false, "deployVmConsoleProxy": false, "deployKubeSecondaryDNS": false, "nonRoot": true, "disableMDevConfiguration": false, "persistentReservation": false, "enableManagedTenantQuota": false, "autoResourceLimits": false, "enableApplicationAwareQuota": 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 | | status | | [HyperConvergedStatus](#hyperconvergedstatus) | | false | [Back to TOC](#table-of-contents) @@ -151,7 +151,7 @@ HyperConvergedFeatureGates is a set of optional feature gates to enable or disab | Field | Description | Scheme | Default | Required | | ----- | ----------- | ------ | -------- |-------- | -| downwardMetrics | Allow to expose a limited set of host metrics to guests. | *bool | | false | +| 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 | *bool | false | 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 | | deployTektonTaskResources | deploy resources (kubevirt tekton tasks and example pipelines) in SSP operator | *bool | false | false | @@ -199,7 +199,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) | {"withHostPassthroughCPU": false, "enableCommonBootImageImport": true, "deployTektonTaskResources": false, "deployVmConsoleProxy": false, "deployKubeSecondaryDNS": false, "nonRoot": true, "disableMDevConfiguration": false, "persistentReservation": false, "enableManagedTenantQuota": false,"autoResourceLimits": false, "enableApplicationAwareQuota": 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, "withHostPassthroughCPU": false, "enableCommonBootImageImport": true, "deployTektonTaskResources": false, "deployVmConsoleProxy": false, "deployKubeSecondaryDNS": false, "nonRoot": true, "disableMDevConfiguration": false, "persistentReservation": false, "enableManagedTenantQuota": false,"autoResourceLimits": false, "enableApplicationAwareQuota": 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 | diff --git a/docs/cluster-configuration.md b/docs/cluster-configuration.md index 0aa70cf8f4..bffe1c42b6 100644 --- a/docs/cluster-configuration.md +++ b/docs/cluster-configuration.md @@ -136,10 +136,10 @@ The format is compatible with [vhostmd](https://github.com/vhostmd/vhostmd). These metrics allow third-parties diagnosing issues. DownwardMetrics may be exposed to the guest through a `volume` or a `virtio-serial port`. -By default, if the `downwardMetrics` is not set to `false`, the metrics will be available to the guests. -This means that updates from previous versions will not require any special configuration. +**Note**: Updates from previous versions require to enable this feature gate if the metrics was used in any +virtual machine. -**Note**: In future versions, the feature gate will be disabled by default. +**Default**: `false` ### withHostPassthroughCPU Feature Gate Set the `withHostPassthroughCPU` feature gate in order to allow migrating a virtual machine with CPU host-passthrough diff --git a/tests/func-tests/defaults_test.go b/tests/func-tests/defaults_test.go index bdf04c2f9e..c84ff0b332 100644 --- a/tests/func-tests/defaults_test.go +++ b/tests/func-tests/defaults_test.go @@ -75,6 +75,7 @@ var _ = Describe("Check Default values", Label("defaults"), Serial, func() { Context("feature gate defaults", func() { defaultFeatureGates := v1beta1.HyperConvergedFeatureGates{ + DownwardMetrics: ptr.To(false), DeployKubeSecondaryDNS: ptr.To(false), DeployTektonTaskResources: ptr.To(false), DeployVMConsoleProxy: ptr.To(false), @@ -100,6 +101,7 @@ var _ = Describe("Check Default values", Label("defaults"), Serial, func() { g.Expect(reflect.DeepEqual(hc.Spec.FeatureGates, defaultFeatureGates)).To(BeTrue(), "featureGates should be equal to default") }).WithTimeout(2 * time.Second).WithPolling(100 * time.Millisecond).Should(Succeed()) }, + Entry("when removing /spec/featureGates/downwardMetrics", "/spec/featureGates/downwardMetrics"), Entry("when removing /spec/featureGates/deployKubeSecondaryDNS", "/spec/featureGates/deployKubeSecondaryDNS"), Entry("when removing /spec/featureGates/deployTektonTaskResources", "/spec/featureGates/deployTektonTaskResources"), Entry("when removing /spec/featureGates/deployVmConsoleProxy", "/spec/featureGates/deployVmConsoleProxy"), diff --git a/tests/vendor/github.com/kubevirt/hyperconverged-cluster-operator/api/v1beta1/hyperconverged_types.go b/tests/vendor/github.com/kubevirt/hyperconverged-cluster-operator/api/v1beta1/hyperconverged_types.go index 3a36642e1f..c5bf798512 100644 --- a/tests/vendor/github.com/kubevirt/hyperconverged-cluster-operator/api/v1beta1/hyperconverged_types.go +++ b/tests/vendor/github.com/kubevirt/hyperconverged-cluster-operator/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={"withHostPassthroughCPU": false, "enableCommonBootImageImport": true, "deployTektonTaskResources": false, "deployVmConsoleProxy": false, "deployKubeSecondaryDNS": false, "nonRoot": true, "disableMDevConfiguration": false, "persistentReservation": false, "enableManagedTenantQuota": false,"autoResourceLimits": false, "enableApplicationAwareQuota": false} + // +kubebuilder:default={"downwardMetrics": false, "withHostPassthroughCPU": false, "enableCommonBootImageImport": true, "deployTektonTaskResources": false, "deployVmConsoleProxy": false, "deployKubeSecondaryDNS": false, "nonRoot": true, "disableMDevConfiguration": false, "persistentReservation": false, "enableManagedTenantQuota": false,"autoResourceLimits": false, "enableApplicationAwareQuota": false} // +optional FeatureGates HyperConvergedFeatureGates `json:"featureGates,omitempty"` @@ -395,6 +395,8 @@ type VirtualMachineOptions struct { type HyperConvergedFeatureGates struct { // Allow to expose a limited set of host metrics to guests. // +optional + // +kubebuilder:default=false + // +default=false DownwardMetrics *bool `json:"downwardMetrics,omitempty"` // Allow migrating a virtual machine with CPU host-passthrough mode. This should be @@ -819,7 +821,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": {"withHostPassthroughCPU": false, "enableCommonBootImageImport": true, "deployTektonTaskResources": false, "deployVmConsoleProxy": false, "deployKubeSecondaryDNS": false, "nonRoot": true, "disableMDevConfiguration": false, "persistentReservation": false, "enableManagedTenantQuota": false, "autoResourceLimits": false, "enableApplicationAwareQuota": 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, "nonRoot": true, "disableMDevConfiguration": false, "persistentReservation": false, "enableManagedTenantQuota": false, "autoResourceLimits": false, "enableApplicationAwareQuota": false}, "liveMigrationConfig": {"completionTimeoutPerGiB": 800, "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"` diff --git a/tests/vendor/github.com/kubevirt/hyperconverged-cluster-operator/api/v1beta1/zz_generated.defaults.go b/tests/vendor/github.com/kubevirt/hyperconverged-cluster-operator/api/v1beta1/zz_generated.defaults.go index 27de080836..dbd7fdf8a9 100644 --- a/tests/vendor/github.com/kubevirt/hyperconverged-cluster-operator/api/v1beta1/zz_generated.defaults.go +++ b/tests/vendor/github.com/kubevirt/hyperconverged-cluster-operator/api/v1beta1/zz_generated.defaults.go @@ -40,6 +40,10 @@ func RegisterDefaults(scheme *runtime.Scheme) error { } func SetObjectDefaults_HyperConverged(in *HyperConverged) { + if in.Spec.FeatureGates.DownwardMetrics == nil { + var ptrVar1 bool = false + in.Spec.FeatureGates.DownwardMetrics = &ptrVar1 + } if in.Spec.FeatureGates.WithHostPassthroughCPU == nil { var ptrVar1 bool = false in.Spec.FeatureGates.WithHostPassthroughCPU = &ptrVar1 diff --git a/tests/vendor/github.com/kubevirt/hyperconverged-cluster-operator/api/v1beta1/zz_generated.openapi.go b/tests/vendor/github.com/kubevirt/hyperconverged-cluster-operator/api/v1beta1/zz_generated.openapi.go index 849cf65ec4..6d3c6c0a76 100644 --- a/tests/vendor/github.com/kubevirt/hyperconverged-cluster-operator/api/v1beta1/zz_generated.openapi.go +++ b/tests/vendor/github.com/kubevirt/hyperconverged-cluster-operator/api/v1beta1/zz_generated.openapi.go @@ -234,6 +234,7 @@ func schema_kubevirt_hyperconverged_cluster_operator_api_v1beta1_HyperConvergedF "downwardMetrics": { SchemaProps: spec.SchemaProps{ Description: "Allow to expose a limited set of host metrics to guests.", + Default: false, Type: []string{"boolean"}, Format: "", },