From cf7d659c2ecd10955a9e3d3f13eeae3b6be28fab Mon Sep 17 00:00:00 2001 From: Martin Jackson Date: Fri, 13 Nov 2026 08:24:02 -0600 Subject: [PATCH] Add feature to skip autopilot if desired --- Chart.yaml | 2 +- README.md | 4 ++- README.md.gotmpl | 1 + templates/hyperconverged.yaml | 61 ++++++++++++++++++++++++++++++++++ tests/hyperconverged_test.yaml | 38 +++++++++++++++++++++ values.yaml | 10 ++++++ 6 files changed, 114 insertions(+), 2 deletions(-) create mode 100644 tests/hyperconverged_test.yaml diff --git a/Chart.yaml b/Chart.yaml index 006a48a..e518064 100644 --- a/Chart.yaml +++ b/Chart.yaml @@ -2,4 +2,4 @@ apiVersion: v2 name: openshift-virtualization-instance description: OpenShift Virtualization type: application -version: 0.1.4 +version: 0.1.5 diff --git a/README.md b/README.md index 33a9796..0ab1ba1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # openshift-virtualization-instance -![Version: 0.1.4](https://img.shields.io/badge/Version-0.1.4-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) +![Version: 0.1.5](https://img.shields.io/badge/Version-0.1.5-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) OpenShift Virtualization @@ -8,6 +8,7 @@ This chart is used to set up OpenShift Virtualization for the Validated Patterns ### Notable changes +* v0.1.5: Add non-default option to skip virt-autopilot managed configuration (virtAutopilot.enabled=false) * v0.1.4: Remove withHostPassthroughCPU setting from hyperconverged. It was deprecated and ignored. * v0.1.3: Be more selective about the common boot import; 4.18 does not accept it * v0.1.2: Correct location of common boot import spec, and make debug/emulation work again @@ -22,6 +23,7 @@ This chart is used to set up OpenShift Virtualization for the Validated Patterns | global.clusterVersion | string | `"4.18"` | | | namespaceOverride | string | `"openshift-cnv"` | | | sriovLiveMigration | bool | `false` | | +| virtAutopilot | object | `{"enabled":true}` | Set to false to skip all virt-autopilot managed configuration (OpenShift Virtualization >= 5.0). virt-autopilot automatically applies opinionated postinstallation defaults: load-aware descheduler tuning, observability dashboards and alerts, swap and node tuning, and more. Skipping it adds the platform.kubevirt.io/disabled-resources annotation to the HyperConverged CR so that the controller does not create or reconcile those resources. | ---------------------------------------------- Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2) diff --git a/README.md.gotmpl b/README.md.gotmpl index 2e05e57..01f0a81 100644 --- a/README.md.gotmpl +++ b/README.md.gotmpl @@ -9,6 +9,7 @@ This chart is used to set up OpenShift Virtualization for the Validated Patterns ### Notable changes +* v0.1.5: Add non-default option to skip virt-autopilot managed configuration (virtAutopilot.enabled=false) * v0.1.4: Remove withHostPassthroughCPU setting from hyperconverged. It was deprecated and ignored. * v0.1.3: Be more selective about the common boot import; 4.18 does not accept it * v0.1.2: Correct location of common boot import spec, and make debug/emulation work again diff --git a/templates/hyperconverged.yaml b/templates/hyperconverged.yaml index 8cb484d..2ce41ed 100644 --- a/templates/hyperconverged.yaml +++ b/templates/hyperconverged.yaml @@ -7,6 +7,67 @@ kind: HyperConverged metadata: annotations: deployOVS: "false" + {{- if not .Values.virtAutopilot.enabled }} + # Skip all virt-autopilot managed configuration (OpenShift Virtualization >= 5.0). + # Rules only match resources rendered by virt-autopilot itself. The kind + # list mirrors the asset catalog of virt-platform-autopilot and may need + # updating as new features are added there. + platform.kubevirt.io/disabled-resources: | + - kind: HyperConverged + name: kubevirt-hyperconverged + # Observability + - kind: Service + name: "*" + - kind: ServiceMonitor + name: "*" + - kind: PrometheusRule + name: "*" + - kind: PersesDashboard + name: "*" + - kind: PersesDatasource + name: "*" + # Node tuning + - kind: MachineConfig + name: "*" + - kind: MachineConfiguration + name: "*" + - kind: ConfigMap + name: "*" + # Operators and components + - kind: KubeDescheduler + name: "*" + - kind: UIPlugin + name: "*" + - kind: OperationRuleSet + name: "*" + - kind: ForkliftController + name: "*" + - kind: MetalLB + name: "*" + - kind: LokiStack + name: "*" + - kind: ClusterLogForwarder + name: "*" + - kind: NodeHealthCheck + name: "*" + - kind: StorageBasedRemediationConfig + name: "*" + - kind: DaemonSet + name: "*" + # Supporting resources + - kind: Namespace + name: "*" + - kind: ServiceAccount + name: "*" + - kind: ClusterRole + name: "*" + - kind: ClusterRoleBinding + name: "*" + - kind: SecurityContextConstraints + name: "*" + - kind: NetworkPolicy + name: "*" + {{- end }} finalizers: - kubevirt.io/hyperconverged labels: diff --git a/tests/hyperconverged_test.yaml b/tests/hyperconverged_test.yaml new file mode 100644 index 0000000..3896341 --- /dev/null +++ b/tests/hyperconverged_test.yaml @@ -0,0 +1,38 @@ +--- +suite: HyperConverged CR +templates: + - templates/hyperconverged.yaml +tests: + - it: does not disable virt-autopilot resources by default + asserts: + - notExists: + path: "metadata.annotations['platform.kubevirt.io/disabled-resources']" + + - it: disables all virt-autopilot resources when virtAutopilot.enabled is false + set: + virtAutopilot: + enabled: false + asserts: + - exists: + path: "metadata.annotations['platform.kubevirt.io/disabled-resources']" + - matchRegex: + path: "metadata.annotations['platform.kubevirt.io/disabled-resources']" + pattern: "kind: HyperConverged" + - matchRegex: + path: "metadata.annotations['platform.kubevirt.io/disabled-resources']" + pattern: "kind: KubeDescheduler" + - matchRegex: + path: "metadata.annotations['platform.kubevirt.io/disabled-resources']" + pattern: "kind: MachineConfig" + - matchRegex: + path: "metadata.annotations['platform.kubevirt.io/disabled-resources']" + pattern: 'name: "\*"' + + - it: keeps the deployOVS annotation when skipping virt-autopilot + set: + virtAutopilot: + enabled: false + asserts: + - equal: + path: metadata.annotations.deployOVS + value: "false" diff --git a/values.yaml b/values.yaml index 19305e7..8b39198 100644 --- a/values.yaml +++ b/values.yaml @@ -9,3 +9,13 @@ global: namespaceOverride: openshift-cnv sriovLiveMigration: false enableCommonBootImageImport: true + +# -- Set to false to skip all virt-autopilot managed configuration +# (OpenShift Virtualization >= 5.0). virt-autopilot automatically applies +# opinionated postinstallation defaults: load-aware descheduler tuning, +# observability dashboards and alerts, swap and node tuning, and more. +# Skipping it adds the platform.kubevirt.io/disabled-resources annotation +# to the HyperConverged CR so that the controller does not create or +# reconcile those resources. +virtAutopilot: + enabled: true