Skip to content
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

instancetype: preferredCPUTopology cleanups #11927

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

lyarwood
Copy link
Member

@lyarwood lyarwood commented May 15, 2024

/area instancetype

What this PR does

This PR introduces shorter preferredCPUTopology constants to make the API slightly easier for users:

  • PreferSockets -> sockets
  • PreferCores -> cores
  • PreferThreads -> threads
  • PreferSpread -> spread
  • PreferAny -> any

The original constants are now deprecated and support will be dropped in a future version of the instancetype.kubevirt.io API with these values converted during upgrade and thus requiring no user actions.

It also adds missing admission validation for preferredCPUTopology to ensure only supported values are accepted. This includes validation of virtctl input when creating a preference manifest.

Fixes #

Why we need it and why it was done in this way

The following tradeoffs were made:

The following alternatives were considered:

Links to places where the discussion took place:

Special notes for your reviewer

Checklist

This checklist is not enforcing, but it's a reminder of items that could be relevant to every PR.
Approvers are expected to review this list.

Release note

All `preferredCPUTopology` constants prefixed with `Prefer` have been deprecated and will be removed in a future version of the `instancetype.kubevirt.io` API.

@kubevirt-bot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@kubevirt-bot kubevirt-bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. area/instancetype do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. size/L labels May 15, 2024
@kubevirt-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 assign vasiliy-ul for approval. For more information see the Kubernetes Code Review Process.

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

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

@kubevirt-bot kubevirt-bot added area/virtctl kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API labels May 15, 2024
Signed-off-by: Lee Yarwood <lyarwood@redhat.com>
Signed-off-by: Lee Yarwood <lyarwood@redhat.com>
@lyarwood lyarwood force-pushed the instancetype-preferredcputopology-cleanup branch from 9d6638e to 66d554a Compare May 17, 2024 10:56
@lyarwood lyarwood marked this pull request as ready for review May 17, 2024 11:21
@kubevirt-bot kubevirt-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 17, 2024
@kubevirt-bot kubevirt-bot added release-note-none Denotes a PR that doesn't merit a release note. 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. labels May 17, 2024
@lyarwood lyarwood marked this pull request as draft May 17, 2024 11:41
@kubevirt-bot kubevirt-bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 17, 2024
Signed-off-by: Lee Yarwood <lyarwood@redhat.com>
@lyarwood lyarwood force-pushed the instancetype-preferredcputopology-cleanup branch from 66d554a to b524f3a Compare May 17, 2024 12:17
@kubevirt-bot kubevirt-bot added the sig/buildsystem Denotes an issue or PR that relates to changes in the build system. label May 17, 2024
@lyarwood lyarwood marked this pull request as ready for review May 17, 2024 12:41
@kubevirt-bot kubevirt-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 17, 2024
@kubevirt-bot kubevirt-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels May 17, 2024
@lyarwood
Copy link
Member Author

/sig api
/cc @alaypatel07

Would you mind taking a look at this from a sig-api point of view, specifically the deprecation of the preferFoo constants and the introduction and naming of the new foo constants?

@kubevirt-bot kubevirt-bot added the sig/api Denotes an issue or PR that relates to changes in api. label May 22, 2024
// Prefer vCPUs to be exposed as cores to the guest
//
// Deprecated, use cores instead.
PreferCores PreferredCPUTopology = "preferCores"
Copy link
Contributor

Choose a reason for hiding this comment

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

https://github.com/kubernetes/kubernetes/blob/fad52aedfcc14061cf20370be061789b4f3d97d9/staging/src/k8s.io/api/core/v1/types.go#L3667

Kubernetes adds Depracated prefix to the api fields without changing the values. Should we follow this pattern here?

cc @EdDev

Copy link
Member

Choose a reason for hiding this comment

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

Should/Can we add a deprecation notice for users in the admitter?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/instancetype area/virtctl dco-signoff: yes Indicates the PR's author has DCO signed all their commits. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/api Denotes an issue or PR that relates to changes in api. sig/buildsystem Denotes an issue or PR that relates to changes in the build system. size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants