Skip to content

Conversation

@ahmadhamzh
Copy link
Contributor

@ahmadhamzh ahmadhamzh commented Dec 31, 2025

What this PR does / why we need it:

  • Filter the KubeVirt OSP list to only include profiles that support the selected OS image version.
  • Fix an issue where the OS image value was not assigned in MD edit mode for Kubevirt provider.

Which issue(s) this PR fixes:
Fixes #7727

What type of PR is this?
/kind feature

Does this PR introduce a user-facing change? Then add your Release Note here:

Filter KubeVirt OSP list based on selected OS image version.

Documentation:

NONE

@kubermatic-bot kubermatic-bot added kind/feature Categorizes issue or PR as related to a new feature. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. dco-signoff: yes Denotes that all commits in the pull request have the valid DCO signoff message. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. do-not-merge/docs-needed Indicates that a PR should not merge because it's missing one of the documentation labels. sig/api Denotes a PR or issue as being assigned to SIG API. labels Dec 31, 2025
@kubermatic-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from ahmadhamzh. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@kubermatic-bot kubermatic-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Dec 31, 2025
@ahmadhamzh ahmadhamzh force-pushed the 7727-filter-osp-based-on-os-kubevirt branch from 9e9b8a3 to aa0fa13 Compare January 8, 2026 10:00
@kubermatic-bot kubermatic-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. docs/none Denotes a PR that doesn't need documentation (changes). and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. do-not-merge/docs-needed Indicates that a PR should not merge because it's missing one of the documentation labels. labels Jan 8, 2026
@ahmadhamzh ahmadhamzh changed the title WIP Filter Kubevirt supported OSP list by selected OS version Filter Kubevirt supported OSP list by selected OS version Jan 8, 2026
@kubermatic-bot kubermatic-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 8, 2026
@ahmadhamzh
Copy link
Contributor Author

/retest

@kubermatic-bot
Copy link
Contributor

@ahmadhamzh: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pre-dashboard-api-e2e aa0fa13 link true /test pre-dashboard-api-e2e

Full PR test history

Details

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. I understand the commands that are listed here.

@KhizerRehan KhizerRehan requested a review from Copilot January 8, 2026 13:51
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the KubeVirt provider's operating system profile (OSP) selection by filtering available profiles based on the selected OS image version, and fixes a bug where OS image values were not properly assigned in machine deployment edit mode.

  • Adds osVersion field to the OperatingSystemProfile entity across frontend and backend
  • Implements filtering logic to show only OSPs compatible with the selected OS image version for KubeVirt
  • Fixes OS image value assignment in edit mode by setting dropdown options when the OS image changes

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
modules/web/src/app/shared/entity/operating-system-profile.ts Adds optional osVersion field to the OperatingSystemProfile class
modules/web/src/app/node-data/component.ts Implements OSP filtering logic based on OS image version and refactors OSP selection methods
modules/web/src/app/node-data/basic/provider/kubevirt/component.ts Updates OS image change handler to set dropdown options and propagate version information
modules/web/src/app/core/services/node-data/provider/kubevirt.ts Adds BehaviorSubject to manage and expose OS image version state
modules/api/pkg/test/e2e/utils/apiclient/models/operating_system_profile.go Adds OSVersion field to the API client model
modules/api/pkg/handler/v2/operatingsystemprofile/operatingsystemprofile.go Includes OSVersion in API response conversion
modules/api/pkg/api/v2/types.go Adds OSVersion field to the OperatingSystemProfile API type
modules/api/cmd/kubermatic-api/swagger.json Updates Swagger documentation with osVersion field

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +779 to +782
if (!version) return true;

const ospObject = this.operatingSystemProfiles.find(profile => profile.name === osp);
return !ospObject?.osVersion || ospObject?.osVersion === version;
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method returns true when ospObject is not found (undefined), which could lead to incorrect filtering. If the OSP doesn't exist in operatingSystemProfiles, the method should return false to prevent selecting an invalid profile.

Suggested change
if (!version) return true;
const ospObject = this.operatingSystemProfiles.find(profile => profile.name === osp);
return !ospObject?.osVersion || ospObject?.osVersion === version;
if (!version) {
return true;
}
const ospObject = this.operatingSystemProfiles.find(profile => profile.name === osp);
if (!ospObject) {
return false;
}
return !ospObject.osVersion || ospObject.osVersion === version;

Copilot uses AI. Check for mistakes.
const selectedOSImage = osImageLink || this.form.get(Controls.PrimaryDiskOSImage).value?.[ComboboxControls?.Select];
if (selectedOSImage) {
this._nodeDataService.kubeVirt.osImageVersion =
this.osImageDropdownOptions?.find(image => image.link === selectedOSImage)?.version || '';
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The osImageVersion is only set when selectedOSImage is truthy, but it's never cleared when selectedOSImage is falsy. This could leave a stale version value from a previous selection. Consider setting this._nodeDataService.kubeVirt.osImageVersion = '' in an else block to ensure the version is cleared when no image is selected.

Suggested change
this.osImageDropdownOptions?.find(image => image.link === selectedOSImage)?.version || '';
this.osImageDropdownOptions?.find(image => image.link === selectedOSImage)?.version || '';
} else {
this._nodeDataService.kubeVirt.osImageVersion = '';

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Denotes that all commits in the pull request have the valid DCO signoff message. docs/none Denotes a PR that doesn't need documentation (changes). kind/feature Categorizes issue or PR as related to a new feature. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/api Denotes a PR or issue as being assigned to SIG API. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Configure OSP for each supported OS version in kubevirt DC.

2 participants