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

Apply upgrade patches according to a json file #1586

Merged
merged 1 commit into from
Nov 10, 2021

Conversation

tiraboschi
Copy link
Member

@tiraboschi tiraboschi commented Nov 8, 2021

Apply upgrade patches according to a json files
shipped within the container.
The operator will read the json file expecting
a fixed struct.

Now it handles only jsonpatches to be applied
on the HCO CR, in the future the same mechanism
could be easily extended to delete leftovers
or patch other objects.

Now it expects something like:

{
  "hcoCRPatchList": [
    {
      "semverRange": ">=1.4.0 <=1.5.0",
      "jsonPatch": [
        {
          "op": "replace",
          "path": "/spec/featureGates/sriovLiveMigration",
          "value": true
        }
      ]
    }
  ]
}

where hcoCRPatchList is a list of upgrade patches.
Each hcoCRPatch consists in a semver range
( https://github.com/blang/semver#ranges ) of affected
source versions and a json patch
( https://datatracker.ietf.org/doc/html/rfc6902 )
to be applied during the upgrade if relevant.

Applying it to set
/spec/featureGates/sriovLiveMigration = true
when upgrading from 1.4.z and 1.5.0 to the current version.

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

Signed-off-by: Simone Tiraboschi stirabos@redhat.com

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

Release note:

Apply upgrade patches according to a json file

@kubevirt-bot kubevirt-bot added 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. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. size/L 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 Nov 8, 2021
@coveralls
Copy link
Collaborator

coveralls commented Nov 8, 2021

Pull Request Test Coverage Report for Build 1443881131

  • 85 of 111 (76.58%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.1%) to 70.398%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/controller/hyperconverged/upgradePatches.go 46 55 83.64%
pkg/controller/hyperconverged/hyperconverged_controller.go 39 56 69.64%
Totals Coverage Status
Change from base Build 1441009774: 0.1%
Covered Lines: 3629
Relevant Lines: 5155

💛 - Coveralls

@hco-bot
Copy link
Collaborator

hco-bot commented Nov 8, 2021

hco-e2e-image-index-aws lane succeeded.
/override ci/prow/hco-e2e-image-index-gcp

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/hco-e2e-image-index-gcp

In response to this:

hco-e2e-image-index-aws lane succeeded.
/override ci/prow/hco-e2e-image-index-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 Nov 8, 2021

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

@kubevirt-bot
Copy link
Contributor

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

In response to this:

hco-e2e-image-index-sno-azure lane succeeded.
/override ci/prow/hco-e2e-image-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.

@hco-bot
Copy link
Collaborator

hco-bot commented Nov 8, 2021

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

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/hco-e2e-image-index-azure

In response to this:

hco-e2e-image-index-aws lane succeeded.
/override ci/prow/hco-e2e-image-index-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.

@hco-bot
Copy link
Collaborator

hco-bot commented Nov 8, 2021

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

@kubevirt-bot
Copy link
Contributor

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

In response to this:

hco-e2e-kv-smoke-azure lane succeeded.
/override ci/prow/hco-e2e-kv-smoke-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 Nov 8, 2021

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

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/hco-e2e-image-index-sno-azure

In response to this:

hco-e2e-image-index-sno-aws lane succeeded.
/override ci/prow/hco-e2e-image-index-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/test-infra repository.

@hco-bot
Copy link
Collaborator

hco-bot commented Nov 9, 2021

hco-e2e-image-index-azure, hco-e2e-image-index-azure, hco-e2e-image-index-aws lanes succeeded.
/override ci/prow/hco-e2e-image-index-gcp

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/hco-e2e-image-index-gcp

In response to this:

hco-e2e-image-index-azure, hco-e2e-image-index-azure, hco-e2e-image-index-aws lanes succeeded.
/override ci/prow/hco-e2e-image-index-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 Nov 9, 2021

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

@kubevirt-bot
Copy link
Contributor

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

In response to this:

hco-e2e-kv-smoke-azure lane succeeded.
/override ci/prow/hco-e2e-kv-smoke-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.

build/Dockerfile.okd Outdated Show resolved Hide resolved
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.

I added several comments

pkg/controller/hyperconverged/hyperconverged_controller.go Outdated Show resolved Hide resolved
pkg/controller/hyperconverged/hyperconverged_controller.go Outdated Show resolved Hide resolved
pkg/controller/hyperconverged/hyperconverged_controller.go Outdated Show resolved Hide resolved
pkg/controller/hyperconverged/hyperconverged_controller.go Outdated Show resolved Hide resolved
pkg/controller/hyperconverged/hyperconverged_controller.go Outdated Show resolved Hide resolved
pkg/controller/hyperconverged/hyperconverged_controller.go Outdated Show resolved Hide resolved
pkg/controller/hyperconverged/hyperconverged_controller.go Outdated Show resolved Hide resolved
assets/upgradePatches.yaml Outdated Show resolved Hide resolved
pkg/controller/hyperconverged/upgradePatches.go Outdated Show resolved Hide resolved
@tiraboschi tiraboschi force-pushed the patch_defaults branch 2 times, most recently from 12fd7cf to c0e5b0d Compare November 9, 2021 15:53
@hco-bot
Copy link
Collaborator

hco-bot commented Nov 9, 2021

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

@kubevirt-bot
Copy link
Contributor

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

In response to this:

hco-e2e-kv-smoke-azure lane succeeded.
/override ci/prow/hco-e2e-kv-smoke-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.

Apply upgrade patches according to a yaml files
shipped within the container.
The operator will read the yaml file expecting
a fixed struct.

Now it handles only jsonpatches to be applied
on the HCO CR, in the future the same mechanism
could be easily extended to delete leftovers
or patch other objects.

Now it expects something like:
```json
{
  "hcoCRPatchList": [
    {
      "semverRange": ">=1.4.0 <=1.5.0",
      "jsonPatch": [
        {
          "op": "replace",
          "path": "/spec/featureGates/sriovLiveMigration",
          "value": true
        }
      ]
    }
  ]
}
```
where hcoCRPatchList is a list of upgrade patches.
Each hcoCRPatch consists in a semver range
( https://github.com/blang/semver#ranges ) of affected
source versions and a json patch
( https://datatracker.ietf.org/doc/html/rfc6902 )
to be applied during the upgrade if relevant.

Applying it to set
/spec/featureGates/sriovLiveMigration = true
when upgrading from 1.4.z and 1.5.0 to the current version.

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

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

sonarcloud bot commented Nov 10, 2021

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 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@nunnatsa
Copy link
Collaborator

/lgtm
/approve

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Nov 10, 2021
@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 Nov 10, 2021
@tiraboschi
Copy link
Member Author

/retest

@hco-bot
Copy link
Collaborator

hco-bot commented Nov 10, 2021

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

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/hco-e2e-image-index-gcp, ci/prow/hco-e2e-image-index-sno-aws

In response to this:

hco-e2e-image-index-azure, hco-e2e-image-index-aws lanes succeeded.
/override ci/prow/hco-e2e-image-index-gcp
hco-e2e-image-index-sno-azure lane succeeded.
/override ci/prow/hco-e2e-image-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.

@hco-bot
Copy link
Collaborator

hco-bot commented Nov 10, 2021

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/okd-hco-e2e-upgrade-index-aws

In response to this:

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 Nov 10, 2021

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

@kubevirt-bot
Copy link
Contributor

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

In response to this:

hco-e2e-upgrade-prev-index-sno-aws lane succeeded.
/override ci/prow/hco-e2e-upgrade-prev-index-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/test-infra repository.

@openshift-ci
Copy link

openshift-ci bot commented Nov 10, 2021

@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/hco-e2e-image-index-sno-aws 5369359 link false /test hco-e2e-image-index-sno-aws
ci/prow/hco-e2e-image-index-gcp 5369359 link true /test hco-e2e-image-index-gcp
ci/prow/hco-e2e-upgrade-prev-index-sno-azure 5369359 link false /test hco-e2e-upgrade-prev-index-sno-azure
ci/prow/okd-hco-e2e-upgrade-index-aws 5369359 link true /test okd-hco-e2e-upgrade-index-aws
ci/prow/hco-e2e-kv-smoke-gcp 5369359 link true /test hco-e2e-kv-smoke-gcp

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.

@hco-bot
Copy link
Collaborator

hco-bot commented Nov 10, 2021

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

@kubevirt-bot
Copy link
Contributor

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

In response to this:

hco-e2e-kv-smoke-azure lane succeeded.
/override ci/prow/hco-e2e-kv-smoke-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.

@kubevirt-bot kubevirt-bot merged commit 5562aad into kubevirt:main Nov 10, 2021
@tiraboschi tiraboschi deleted the patch_defaults branch November 10, 2021 14:30
tiraboschi added a commit to tiraboschi/hyperconverged-cluster-operator that referenced this pull request Nov 10, 2021
…t#1586)

Apply upgrade patches according to a yaml files
shipped within the container.
The operator will read the yaml file expecting
a fixed struct.

Now it handles only jsonpatches to be applied
on the HCO CR, in the future the same mechanism
could be easily extended to delete leftovers
or patch other objects.

Now it expects something like:
```json
{
  "hcoCRPatchList": [
    {
      "semverRange": ">=1.4.0 <=1.5.0",
      "jsonPatch": [
        {
          "op": "replace",
          "path": "/spec/featureGates/sriovLiveMigration",
          "value": true
        }
      ]
    }
  ]
}
```
where hcoCRPatchList is a list of upgrade patches.
Each hcoCRPatch consists in a semver range
( https://github.com/blang/semver#ranges ) of affected
source versions and a json patch
( https://datatracker.ietf.org/doc/html/rfc6902 )
to be applied during the upgrade if relevant.

Applying it to set
/spec/featureGates/sriovLiveMigration = true
when upgrading from 1.4.z and 1.5.0 to the current version.

This is a manual cherry-pick of kubevirt#1586

Bump github.com/evanphx/json-patch => v5.6.0+incompatible
to be aligned with the main branch.

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

Signed-off-by: Simone Tiraboschi <stirabos@redhat.com>
kubevirt-bot pushed a commit that referenced this pull request Nov 11, 2021
…1599)

Apply upgrade patches according to a yaml files
shipped within the container.
The operator will read the yaml file expecting
a fixed struct.

Now it handles only jsonpatches to be applied
on the HCO CR, in the future the same mechanism
could be easily extended to delete leftovers
or patch other objects.

Now it expects something like:
```json
{
  "hcoCRPatchList": [
    {
      "semverRange": ">=1.4.0 <=1.5.0",
      "jsonPatch": [
        {
          "op": "replace",
          "path": "/spec/featureGates/sriovLiveMigration",
          "value": true
        }
      ]
    }
  ]
}
```
where hcoCRPatchList is a list of upgrade patches.
Each hcoCRPatch consists in a semver range
( https://github.com/blang/semver#ranges ) of affected
source versions and a json patch
( https://datatracker.ietf.org/doc/html/rfc6902 )
to be applied during the upgrade if relevant.

Applying it to set
/spec/featureGates/sriovLiveMigration = true
when upgrading from 1.4.z and 1.5.0 to the current version.

This is a manual cherry-pick of #1586

Bump github.com/evanphx/json-patch => v5.6.0+incompatible
to be aligned with the main branch.

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

Signed-off-by: Simone Tiraboschi <stirabos@redhat.com>
@tiraboschi tiraboschi changed the title Apply upgrade patches according to a yaml file Apply upgrade patches according to a json file Nov 19, 2021
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/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants