-
Notifications
You must be signed in to change notification settings - Fork 71
Filter Kubevirt supported OSP list by selected OS version #7747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Filter Kubevirt supported OSP list by selected OS version #7747
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
9e9b8a3 to
aa0fa13
Compare
|
/retest |
|
@ahmadhamzh: The following test failed, say
DetailsInstructions 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. |
There was a problem hiding this 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
osVersionfield 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.
| if (!version) return true; | ||
|
|
||
| const ospObject = this.operatingSystemProfiles.find(profile => profile.name === osp); | ||
| return !ospObject?.osVersion || ospObject?.osVersion === version; |
Copilot
AI
Jan 8, 2026
There was a problem hiding this comment.
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.
| 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; |
| 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 || ''; |
Copilot
AI
Jan 8, 2026
There was a problem hiding this comment.
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.
| this.osImageDropdownOptions?.find(image => image.link === selectedOSImage)?.version || ''; | |
| this.osImageDropdownOptions?.find(image => image.link === selectedOSImage)?.version || ''; | |
| } else { | |
| this._nodeDataService.kubeVirt.osImageVersion = ''; |
What this PR does / why we need it:
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:
Documentation: