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

Improve the upgrade json patch mechanism #3248

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

Conversation

nunnatsa
Copy link
Collaborator

@nunnatsa nunnatsa commented Dec 26, 2024

What this PR does / why we need it:

Improve the upgrade json patch by

  1. move it to its own package
  2. made some refactoring for better performance
  3. the code is now more testable
  4. move the initialization of the upgradePatch object to boot, instead of in the reconcile loop, in order to fail fast on error
  5. To implement 3, add a json string of the HyperConverged CR with default values.
  6. To implement 4, add a tiny tool to go-generate the go file with the json string, and call it at build time

Remove two old upgrade mechanism:

  1. dropped the CRD remover. this is not needed anymore. the v2v CRD was dropped many versions ago.
  2. dropped the code that remove the v1alpha1 API version from the HC CRD, as it was done many versions ago.

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:

None

Release note:

Droped unused code

@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 Dec 26, 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 ask for approval from nunnatsa. 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

Improve the upgrade json patch by:
1. move it to its own package
2. made some refactoring for better performance
3. move the initialization of the upgradePatch object to boot, instead of in the reconcile loop, in order to fail fast on error
4. To implement 3, add a json string of the HyperConverged CR with default values.
5. To implement 4, add a tiny tool to go-generate the go file with the json string, and call it at build time

Signed-off-by: Nahshon Unna-Tsameret <[email protected]>
The CRDRemover type was written to remove the v2v CRDs on upgrade. This
is no longer relevant.

Even for newer CRD removes, we have a common solution - the json patch
mechanism.

This PR removes the unused code.

Signed-off-by: Nahshon Unna-Tsameret <[email protected]>
This API version is very old, and there is no need to remove it anymore.

Signed-off-by: Nahshon Unna-Tsameret <[email protected]>
@coveralls
Copy link
Collaborator

Pull Request Test Coverage Report for Build 12504775034

Details

  • 92 of 148 (62.16%) changed or added relevant lines in 2 files are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.6%) to 71.154%

Changes Missing Coverage Covered Lines Changed/Added Lines %
controllers/hyperconverged/hyperconverged_controller.go 13 14 92.86%
pkg/upgradepatches/upgradePatches.go 79 134 58.96%
Files with Coverage Reduction New Missed Lines %
controllers/hyperconverged/hyperconverged_controller.go 2 81.57%
Totals Coverage Status
Change from base Build 12491111563: -0.6%
Covered Lines: 5989
Relevant Lines: 8417

💛 - Coveralls

@hco-bot
Copy link
Collaborator

hco-bot commented Dec 26, 2024

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

@kubevirt-bot
Copy link
Contributor

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

In response to this:

hco-e2e-upgrade-operator-sdk-aws lane succeeded.
/override ci/prow/hco-e2e-upgrade-operator-sdk-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-sigs/prow repository.

@hco-bot
Copy link
Collaborator

hco-bot commented Dec 26, 2024

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

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/hco-e2e-upgrade-operator-sdk-sno-azure

In response to this:

hco-e2e-upgrade-operator-sdk-sno-aws lane succeeded.
/override ci/prow/hco-e2e-upgrade-operator-sdk-sno-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-sigs/prow repository.

@hco-bot
Copy link
Collaborator

hco-bot commented Dec 26, 2024

hco-e2e-operator-sdk-gcp, hco-e2e-operator-sdk-aws lanes succeeded.
/override ci/prow/hco-e2e-operator-sdk-azure
hco-e2e-operator-sdk-sno-azure lane succeeded.
/override ci/prow/hco-e2e-operator-sdk-sno-aws

@kubevirt-bot
Copy link
Contributor

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

In response to this:

hco-e2e-operator-sdk-gcp, hco-e2e-operator-sdk-aws lanes succeeded.
/override ci/prow/hco-e2e-operator-sdk-azure
hco-e2e-operator-sdk-sno-azure lane succeeded.
/override ci/prow/hco-e2e-operator-sdk-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-sigs/prow repository.

@hco-bot
Copy link
Collaborator

hco-bot commented Dec 26, 2024

hco-e2e-consecutive-operator-sdk-upgrades-aws lane succeeded.
/override ci/prow/hco-e2e-consecutive-operator-sdk-upgrades-azure

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/hco-e2e-consecutive-operator-sdk-upgrades-azure

In response to this:

hco-e2e-consecutive-operator-sdk-upgrades-aws lane succeeded.
/override ci/prow/hco-e2e-consecutive-operator-sdk-upgrades-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-sigs/prow repository.

Copy link

openshift-ci bot commented Dec 26, 2024

@nunnatsa: 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/hco-e2e-upgrade-prev-operator-sdk-aws 89beed8 link true /test hco-e2e-upgrade-prev-operator-sdk-aws
ci/prow/hco-e2e-operator-sdk-sno-aws 89beed8 link false /test hco-e2e-operator-sdk-sno-aws
ci/prow/hco-e2e-upgrade-prev-operator-sdk-sno-aws 89beed8 link false /test hco-e2e-upgrade-prev-operator-sdk-sno-aws
ci/prow/hco-e2e-upgrade-prev-operator-sdk-sno-azure 89beed8 link false /test hco-e2e-upgrade-prev-operator-sdk-sno-azure
ci/prow/hco-e2e-operator-sdk-azure 89beed8 link true /test hco-e2e-operator-sdk-azure
ci/prow/hco-e2e-consecutive-operator-sdk-upgrades-azure 89beed8 link true /test hco-e2e-consecutive-operator-sdk-upgrades-azure
ci/prow/hco-e2e-upgrade-prev-operator-sdk-azure 89beed8 link true /test hco-e2e-upgrade-prev-operator-sdk-azure
ci/prow/hco-e2e-kv-smoke-gcp 89beed8 link true /test hco-e2e-kv-smoke-gcp
ci/prow/hco-e2e-kv-smoke-azure 89beed8 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-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dco-signoff: yes Indicates the PR's author has DCO signed all their commits. 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.

4 participants