Skip to content

migrate: adopt HCO v1 API throughout templates, code, and tests#187

Merged
tiraboschi merged 1 commit into
openshift-virtualization:mainfrom
tiraboschi:worktree-hco-v1-migration
May 20, 2026
Merged

migrate: adopt HCO v1 API throughout templates, code, and tests#187
tiraboschi merged 1 commit into
openshift-virtualization:mainfrom
tiraboschi:worktree-hco-v1-migration

Conversation

@tiraboschi
Copy link
Copy Markdown
Member

@tiraboschi tiraboschi commented May 19, 2026

Summary

  • Migrates all HCO references from v1beta1 to v1 across templates, Go code, and tests
  • Rewrites extractFeatureGates for the v1 [{name, state}] array format (was v1beta1 map {key: bool})
  • Updates Sprig dig paths in templates to v1 spec layout (spec.virtualization.liveMigrationConfig, spec.deployment.nodePlacements.infra)
  • Fixes 5 failing make test-integration tests caused by the HCO CRD upstream update making v1 the storage version (v1beta1-style fields are structurally pruned on create)

Root cause

The upstream HCO CRD update promoted v1 to storage version. Without a conversion webhook in envtest, creating objects via the old v1beta1 API causes structural pruning: fields defined in v1beta1 but not in v1 (e.g., spec.featureGates as a map, spec.liveMigrationConfig) are silently dropped.

Fix strategy

Adopt the v1 schema directly everywhere — templates read spec.virtualization.liveMigrationConfig and spec.deployment.nodePlacements.infra, feature gates are parsed as [{name, state}] arrays, all test HCO objects use apiVersion: hco.kubevirt.io/v1.

@tiraboschi tiraboschi force-pushed the worktree-hco-v1-migration branch from b427886 to e3f91c1 Compare May 20, 2026 07:04
@github-actions
Copy link
Copy Markdown
Contributor

Generated Files Verification Failed

One or more generated files in this PR are out of sync:

  • CRDs: Run make update-crds if CRD verification failed
  • RBAC: Run make generate-rbac if RBAC verification failed

Please regenerate the files locally and commit the changes.

@tiraboschi tiraboschi force-pushed the worktree-hco-v1-migration branch from e3f91c1 to 05c9c82 Compare May 20, 2026 08:18
@github-actions
Copy link
Copy Markdown
Contributor

Generated Files Verification Failed

One or more generated files in this PR are out of sync:

  • CRDs: Run make update-crds if CRD verification failed
  • RBAC: Run make generate-rbac if RBAC verification failed

Please regenerate the files locally and commit the changes.

@tiraboschi tiraboschi force-pushed the worktree-hco-v1-migration branch from 05c9c82 to 17c4261 Compare May 20, 2026 08:44
Comment thread pkg/controller/platform_controller.go Outdated
Comment thread pkg/controller/platform_controller_test.go Outdated
Comment thread pkg/controller/platform_controller_test.go Outdated
Comment thread pkg/controller/platform_controller_test.go Outdated
Comment thread testdata/hco-minimal.yaml Outdated
@tiraboschi tiraboschi force-pushed the worktree-hco-v1-migration branch from 17c4261 to 23260d4 Compare May 20, 2026 12:53
The HCO CRD upstream update made v1 the storage version. With v1 as
storage, v1beta1-style fields (featureGates map, liveMigrationConfig at
spec root, spec.infra.nodePlacement) are structurally pruned on create,
breaking the 5 integration tests that depended on those paths.

Changes:
- pkg/context: set HCOVersion = "v1"
- pkg/controller: rewrite extractFeatureGates for v1 array format
  [{name, state}] instead of v1beta1 map {key: bool}; add tests for
  disabled gates and missing state
- templates: update dig paths to v1 layout
  (spec.virtualization.liveMigrationConfig, spec.deployment.nodePlacements.infra)
- cmd, pkg/debug, pkg/util: update HCO apiVersion/GVK references to v1
- tests: use hco.kubevirt.io/v1 and v1 spec field paths throughout

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Simone Tiraboschi <stirabos@redhat.com>
@tiraboschi tiraboschi force-pushed the worktree-hco-v1-migration branch from 23260d4 to 2e81dbb Compare May 20, 2026 12:54
@tiraboschi
Copy link
Copy Markdown
Member Author

/approve
/lgtm

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 20, 2026

@tiraboschi: you cannot LGTM your own PR.

Details

In response to this:

/approve
/lgtm

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 20, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tiraboschi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tiraboschi tiraboschi merged commit 01d4a2e into openshift-virtualization:main May 20, 2026
6 of 7 checks passed
@tiraboschi tiraboschi deleted the worktree-hco-v1-migration branch May 20, 2026 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants