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

Deprecate mediatedDevicesTypes in favor of mediatedDeviceTypes #2402

Merged
merged 1 commit into from
Jun 29, 2023

Conversation

tiraboschi
Copy link
Member

What this PR does / why we need it:
With github.com/kubevirt/kubevirt/pull/8525
mediatedDevicesTypes got deprecated in favor of mediatedDeviceTypes on kubevirt/kubevirt.
Let's do the same on the HCO side for consistency.

The mutating webhook will take care of the migration to the new API and the validating webhook will
prevent inconsistencies between the two APIs.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2054863

Reviewer Checklist

Reviewers are supposed to review the PR for every aspect below one by one. To check an item means the PR is either "OK" or "Not Applicable" in terms of that item. All items are supposed to be checked before merging a PR.

  • PR Message
  • Commit Messages
  • How to test
  • Unit Tests
  • Functional Tests
  • User Documentation
  • Developer Documentation
  • Upgrade Scenario
  • Uninstallation Scenario
  • Backward Compatibility
  • Troubleshooting Friendly

Jira Ticket:

https://issues.redhat.com/browse/CNV-16422

Release note:

CR option mediatedDevicesTypes is deprecated in favor of mediatedDeviceTypes

@kubevirt-bot kubevirt-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. labels Jun 27, 2023
@coveralls
Copy link
Collaborator

coveralls commented Jun 27, 2023

Pull Request Test Coverage Report for Build 5399287220

  • 51 of 51 (100.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.1%) to 85.988%

Totals Coverage Status
Change from base Build 5399009068: 0.1%
Covered Lines: 4983
Relevant Lines: 5795

💛 - Coveralls

@hco-bot
Copy link
Collaborator

hco-bot commented Jun 27, 2023

hco-e2e-operator-sdk-sno-azure lane succeeded.
/override ci/prow/hco-e2e-operator-sdk-sno-aws
okd-hco-e2e-upgrade-index-gcp lane succeeded.
/override ci/prow/okd-hco-e2e-upgrade-index-aws
hco-e2e-operator-sdk-gcp lane succeeded.
/override ci/prow/hco-e2e-operator-sdk-aws

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/hco-e2e-operator-sdk-aws, ci/prow/hco-e2e-operator-sdk-sno-aws, ci/prow/okd-hco-e2e-upgrade-index-aws

In response to this:

hco-e2e-operator-sdk-sno-azure lane succeeded.
/override ci/prow/hco-e2e-operator-sdk-sno-aws
okd-hco-e2e-upgrade-index-gcp lane succeeded.
/override ci/prow/okd-hco-e2e-upgrade-index-aws
hco-e2e-operator-sdk-gcp lane succeeded.
/override ci/prow/hco-e2e-operator-sdk-aws

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/test-infra repository.

@hco-bot
Copy link
Collaborator

hco-bot commented Jun 27, 2023

hco-e2e-upgrade-index-azure lane succeeded.
/override ci/prow/hco-e2e-upgrade-index-aws

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/hco-e2e-upgrade-index-aws

In response to this:

hco-e2e-upgrade-index-azure lane succeeded.
/override ci/prow/hco-e2e-upgrade-index-aws

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/test-infra repository.

@tiraboschi
Copy link
Member Author

/retest

@hco-bot
Copy link
Collaborator

hco-bot commented Jun 27, 2023

hco-e2e-upgrade-prev-index-azure lane succeeded.
/override ci/prow/hco-e2e-upgrade-prev-index-aws

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/hco-e2e-upgrade-prev-index-aws

In response to this:

hco-e2e-upgrade-prev-index-azure lane succeeded.
/override ci/prow/hco-e2e-upgrade-prev-index-aws

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/test-infra repository.

@tiraboschi
Copy link
Member Author

/retest

Comment on lines +589 to +590
Expect(mdevConf.MediatedDeviceTypes).To(HaveLen(2))
Expect(mdevConf.MediatedDeviceTypes).To(ContainElements("nvidia-222", "nvidia-230"))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you ant also to check that mdevConf.MediatedDevicesTypes is empty?

Copy link
Member Author

Choose a reason for hiding this comment

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

done, thanks

Expect(mdevConf.NodeMediatedDeviceTypes[1].NodeSelector).To(HaveKeyWithValue("testLabel2", "true"))

})
It("should update the permitted host devices configuration from the HC", func() {
It("should propagate the mediated devices configuration from the HC with node selectors with new APIs", func() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure about "new API". This is very clear today. But one day (tomorrow?) it won't be new anymore...

Copy link
Member Author

Choose a reason for hiding this comment

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

yes. it makes sense: let's call them mediatedDeviceTypes (explicitly) and deprecated (for better visibility).

Comment on lines +114 to +129
if len(hc.Spec.MediatedDevicesConfiguration.MediatedDevicesTypes) > 0 && len(hc.Spec.MediatedDevicesConfiguration.MediatedDeviceTypes) == 0 { //nolint SA1019
patches = append(patches, jsonpatch.JsonPatchOperation{
Operation: "add",
Path: "/spec/mediatedDevicesConfiguration/mediatedDeviceTypes",
Value: hc.Spec.MediatedDevicesConfiguration.MediatedDevicesTypes, //nolint SA1019
})
}
for i, hcoNodeMdevTypeConf := range hc.Spec.MediatedDevicesConfiguration.NodeMediatedDeviceTypes {
if len(hcoNodeMdevTypeConf.MediatedDevicesTypes) > 0 && len(hcoNodeMdevTypeConf.MediatedDeviceTypes) == 0 { //nolint SA1019
patches = append(patches, jsonpatch.JsonPatchOperation{
Operation: "add",
Path: fmt.Sprintf("/spec/mediatedDevicesConfiguration/nodeMediatedDeviceTypes/%d/mediatedDeviceTypes", i),
Value: hcoNodeMdevTypeConf.MediatedDevicesTypes, //nolint SA1019
})
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we also want to clear to MediatedDevicesTypes fields?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, I think we should not: they are deprecated but still there and some external code could also try to read it and we don't want to break it.

With github.com/kubevirt/kubevirt/pull/8525
mediatedDevicesTypes got deprecated in favor of mediatedDeviceTypes
on kubevirt/kubevirt.
Let's do the same on the HCO side for consistency.

The mutating webhook will take care of the migration
to the new API and the validating webhook will
prevent inconsistencies between the two APIs.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2054863

Signed-off-by: Simone Tiraboschi <stirabos@redhat.com>
@sonarcloud
Copy link

sonarcloud bot commented Jun 28, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@hco-bot
Copy link
Collaborator

hco-bot commented Jun 28, 2023

okd-hco-e2e-operator-sdk-aws lane succeeded.
/override ci/prow/okd-hco-e2e-operator-sdk-gcp

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/okd-hco-e2e-operator-sdk-gcp

In response to this:

okd-hco-e2e-operator-sdk-aws lane succeeded.
/override ci/prow/okd-hco-e2e-operator-sdk-gcp

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/test-infra repository.

@hco-bot
Copy link
Collaborator

hco-bot commented Jun 28, 2023

hco-e2e-upgrade-index-sno-aws lane succeeded.
/override ci/prow/hco-e2e-upgrade-index-sno-azure
okd-hco-e2e-upgrade-index-gcp lane succeeded.
/override ci/prow/okd-hco-e2e-upgrade-index-aws

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/hco-e2e-upgrade-index-sno-azure, ci/prow/okd-hco-e2e-upgrade-index-aws

In response to this:

hco-e2e-upgrade-index-sno-aws lane succeeded.
/override ci/prow/hco-e2e-upgrade-index-sno-azure
okd-hco-e2e-upgrade-index-gcp lane succeeded.
/override ci/prow/okd-hco-e2e-upgrade-index-aws

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/test-infra repository.

@hco-bot
Copy link
Collaborator

hco-bot commented Jun 28, 2023

hco-e2e-upgrade-index-aws lane succeeded.
/override ci/prow/hco-e2e-upgrade-index-azure
hco-e2e-upgrade-prev-index-sno-azure lane succeeded.
/override ci/prow/hco-e2e-upgrade-prev-index-sno-aws

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/hco-e2e-upgrade-index-azure, ci/prow/hco-e2e-upgrade-prev-index-sno-aws

In response to this:

hco-e2e-upgrade-index-aws lane succeeded.
/override ci/prow/hco-e2e-upgrade-index-azure
hco-e2e-upgrade-prev-index-sno-azure lane succeeded.
/override ci/prow/hco-e2e-upgrade-prev-index-sno-aws

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/test-infra repository.

@openshift-ci
Copy link

openshift-ci bot commented Jun 28, 2023

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

Test name Commit Details Required Rerun command
ci/prow/okd-hco-e2e-upgrade-index-aws f0cbe7b link true /test okd-hco-e2e-upgrade-index-aws
ci/prow/hco-e2e-upgrade-prev-index-sno-aws f0cbe7b link false /test hco-e2e-upgrade-prev-index-sno-aws
ci/prow/hco-e2e-upgrade-index-sno-azure f0cbe7b link false /test hco-e2e-upgrade-index-sno-azure
ci/prow/hco-e2e-upgrade-index-azure f0cbe7b link true /test hco-e2e-upgrade-index-azure
ci/prow/hco-e2e-kv-smoke-azure f0cbe7b link true /test hco-e2e-kv-smoke-azure

Full PR test history. Your PR dashboard.

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

@tiraboschi
Copy link
Member Author

/override-bot

@hco-bot
Copy link
Collaborator

hco-bot commented Jun 28, 2023

hco-e2e-kv-smoke-gcp lane succeeded.
/override ci/prow/hco-e2e-kv-smoke-azure

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/hco-e2e-kv-smoke-azure

In response to this:

hco-e2e-kv-smoke-gcp lane succeeded.
/override ci/prow/hco-e2e-kv-smoke-azure

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/test-infra repository.

Copy link
Collaborator

@nunnatsa nunnatsa left a comment

Choose a reason for hiding this comment

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

/approve

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Jun 29, 2023
@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nunnatsa

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

The pull request process is described 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 the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 29, 2023
@kubevirt-bot kubevirt-bot merged commit 575e12f into kubevirt:main Jun 29, 2023
3 checks passed
tiraboschi added a commit to tiraboschi/hyperconverged-cluster-operator that referenced this pull request Oct 2, 2023
With kubevirt#2402 we deprecated MediatedDevicesTypes and
NodeMediatedDeviceTypes.MediatedDevicesTypes for
MediatedDeviceTypes and NodeMediatedDeviceTypes.MediatedDeviceTypes.
We also introduced a mutating webhook to handle the conversion.
Unfortunately make the two new names mandatory is breaking
the validation of the new version of the CRD on OLM upgrades
since only the previous names were there with the old CRD.

We already have func test covering this area,
but they are fooled by the mutating webhook that
instead is not involved into the CRD validation process
on the OLM side.
On the other side, add an additional upgrade lane just for
this is probably too expensive.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=2241327

Signed-off-by: Simone Tiraboschi <stirabos@redhat.com>
kubevirt-bot pushed a commit that referenced this pull request Oct 3, 2023
)

With #2402 we deprecated MediatedDevicesTypes and
NodeMediatedDeviceTypes.MediatedDevicesTypes for
MediatedDeviceTypes and NodeMediatedDeviceTypes.MediatedDeviceTypes.
We also introduced a mutating webhook to handle the conversion.
Unfortunately make the two new names mandatory is breaking
the validation of the new version of the CRD on OLM upgrades
since only the previous names were there with the old CRD.

We already have func test covering this area,
but they are fooled by the mutating webhook that
instead is not involved into the CRD validation process
on the OLM side.
On the other side, add an additional upgrade lane just for
this is probably too expensive.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=2241327

Signed-off-by: Simone Tiraboschi <stirabos@redhat.com>
tiraboschi added a commit to tiraboschi/hyperconverged-cluster-operator that referenced this pull request Oct 3, 2023
…en upgrades (kubevirt#2534)

With kubevirt#2402 we deprecated MediatedDevicesTypes and
NodeMediatedDeviceTypes.MediatedDevicesTypes for
MediatedDeviceTypes and NodeMediatedDeviceTypes.MediatedDeviceTypes.
We also introduced a mutating webhook to handle the conversion.
Unfortunately make the two new names mandatory is breaking
the validation of the new version of the CRD on OLM upgrades
since only the previous names were there with the old CRD.

We already have func test covering this area,
but they are fooled by the mutating webhook that
instead is not involved into the CRD validation process
on the OLM side.
On the other side, add an additional upgrade lane just for
this is probably too expensive.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=2241327

This is a manual cherry-pick of kubevirt#2534

Signed-off-by: Simone Tiraboschi <stirabos@redhat.com>
kubevirt-bot pushed a commit that referenced this pull request Oct 3, 2023
…en upgrades (#2534) (#2537)

With #2402 we deprecated MediatedDevicesTypes and
NodeMediatedDeviceTypes.MediatedDevicesTypes for
MediatedDeviceTypes and NodeMediatedDeviceTypes.MediatedDeviceTypes.
We also introduced a mutating webhook to handle the conversion.
Unfortunately make the two new names mandatory is breaking
the validation of the new version of the CRD on OLM upgrades
since only the previous names were there with the old CRD.

We already have func test covering this area,
but they are fooled by the mutating webhook that
instead is not involved into the CRD validation process
on the OLM side.
On the other side, add an additional upgrade lane just for
this is probably too expensive.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=2241327

This is a manual cherry-pick of #2534

Signed-off-by: Simone Tiraboschi <stirabos@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants