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

feat: Implement version rollback for server restore #1680

Merged
merged 21 commits into from
Oct 4, 2021
Merged

feat: Implement version rollback for server restore #1680

merged 21 commits into from
Oct 4, 2021

Conversation

mmorhun
Copy link
Contributor

@mmorhun mmorhun commented Sep 21, 2021

What does this PR do?

Implements ability to restore to a different version of Che than deployed operator.
It added several new falgs to server:restore command:
--rollback - finds backup made automatically and restores Che operator to the previous version and restore installation from the backup
--backup-cr - restores Che from given backup described by a backup object (it includes Che version as well)
--version - before restoring Che installation, deploys given version of Che Operator (usually used together with --snapshot-id)

Screenshot/screencast of this PR

What issues does this PR fix or reference?

https://issues.redhat.com/browse/CRW-1497

How to test this PR?

  1. Edit latest CSV for OLM stable channel: increment version everywhere, change replace version to the one being replaced. Optionally change operator image.
  2. Build test catalog source with the following command:
olm/buildAndPushBundleImages.sh -p openshift -c "stable"  -i quay.io/eclipse/eclipse-che-openshift-opm-catalog:preview -f true

The script should push images to your images registry account. Remember catalog source image name, for example: docker.io/user/eclipse-che-openshift-opm-catalog:preview
3. Open Openshift console, navigate to Administration -> Cluster Settings -> Configuration tab. Scroll to and click on OperatorHub. Switch to Sources tab. Click Create CatalogSource. Fill in the fields with test and put your catalog source image. Click Create button.
4. Create subscription for the real latest version in stable channel (but there is your fake one on top, so it is possible to update to). Example subscription yaml (change startingCSV to real latest stable one):

apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: eclipse-che
  namespace: eclipse-che
spec:
  channel: stable
  installPlanApproval: Manual
  name: eclipse-che-preview-openshift
  source: test
  sourceNamespace: openshift-marketplace
  startingCSV: eclipse-che-preview-openshift.v7.36.1
  1. Create a checluster object (from terminal or Openshift console).
  2. Wait until Che is ready
  3. Approve new installation plan: oc get ip, select pending to your fake version install plan and edit it: oc edit ip <install-planname>. Set spec.approved to true.
  4. Wait unitl new Operator is deployed and Che is updated. New operator should create a new backup with name like: backup-before-update-to-7-37-0 (the version should be your fake one).
  5. Run ./debug server:restore --rollback. Note, you have to stop in olm.ts constructSubscription function and replace sourceName to your catalog source name (test). It might be omitted if your replace exiting catalog source image instead of adding a new one.

PR Checklist

As the author of this Pull Request I made sure that:

Reviewers

Reviewers, please comment how you tested the PR when approving it.

src/api/kube.ts Outdated Show resolved Hide resolved
src/commands/server/deploy.ts Show resolved Hide resolved
src/constants.ts Show resolved Hide resolved
src/tasks/installers/installer.ts Show resolved Hide resolved
src/commands/server/restore.ts Outdated Show resolved Hide resolved
src/commands/server/restore.ts Outdated Show resolved Hide resolved
src/commands/server/restore.ts Show resolved Hide resolved
src/commands/server/restore.ts Outdated Show resolved Hide resolved
src/commands/server/restore.ts Outdated Show resolved Hide resolved
src/commands/server/restore.ts Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

Codecov Report

Merging #1680 (a09a66c) into main (731f31c) will decrease coverage by 0.26%.
The diff coverage is 2.64%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1680      +/-   ##
==========================================
- Coverage   11.29%   11.02%   -0.27%     
==========================================
  Files          63       63              
  Lines        6569     6709     +140     
  Branches     1111     1142      +31     
==========================================
- Hits          742      740       -2     
- Misses       5827     5969     +142     
Impacted Files Coverage Δ
src/api/kube.ts 5.54% <0.00%> (-0.06%) ⬇️
src/commands/server/backup.ts 0.00% <0.00%> (ø)
src/commands/server/deploy.ts 0.00% <0.00%> (ø)
src/commands/server/restore.ts 0.00% <0.00%> (ø)
src/tasks/installers/installer.ts 0.00% <0.00%> (ø)
src/tasks/installers/olm.ts 0.00% <0.00%> (ø)
src/tasks/installers/operator.ts 0.00% <0.00%> (ø)
src/api/context.ts 53.65% <33.33%> (ø)
src/api/backup-restore.ts 41.93% <40.00%> (-0.93%) ⬇️
src/constants.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 731f31c...a09a66c. Read the comment docs.

src/api/kube.ts Outdated Show resolved Hide resolved
src/commands/server/restore.ts Show resolved Hide resolved
src/commands/server/restore.ts Outdated Show resolved Hide resolved
src/tasks/installers/olm.ts Show resolved Hide resolved
src/tasks/installers/olm.ts Outdated Show resolved Hide resolved
src/commands/server/restore.ts Outdated Show resolved Hide resolved
src/commands/server/restore.ts Outdated Show resolved Hide resolved
src/commands/server/restore.ts Outdated Show resolved Hide resolved
src/commands/server/restore.ts Outdated Show resolved Hide resolved
src/commands/server/restore.ts Outdated Show resolved Hide resolved
src/commands/server/restore.ts Outdated Show resolved Hide resolved
src/commands/server/restore.ts Outdated Show resolved Hide resolved
src/commands/server/restore.ts Show resolved Hide resolved
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
@tolusha tolusha changed the title Implement version rollback for server restore feat: Implement version rollback for server restore Sep 29, 2021
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
src/commands/server/restore.ts Outdated Show resolved Hide resolved
src/commands/server/restore.ts Outdated Show resolved Hide resolved
src/commands/server/restore.ts Show resolved Hide resolved
src/commands/server/restore.ts Outdated Show resolved Hide resolved
src/commands/server/restore.ts Outdated Show resolved Hide resolved
src/commands/server/restore.ts Outdated Show resolved Hide resolved
src/commands/server/restore.ts Outdated Show resolved Hide resolved
src/commands/server/restore.ts Outdated Show resolved Hide resolved
src/commands/server/restore.ts Show resolved Hide resolved
src/commands/server/restore.ts Show resolved Hide resolved
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
src/commands/server/restore.ts Outdated Show resolved Hide resolved
src/commands/server/restore.ts Outdated Show resolved Hide resolved
src/commands/server/restore.ts Outdated Show resolved Hide resolved
src/commands/server/restore.ts Outdated Show resolved Hide resolved
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
src/commands/server/restore.ts Outdated Show resolved Hide resolved
src/commands/server/restore.ts Outdated Show resolved Hide resolved
src/commands/server/restore.ts Outdated Show resolved Hide resolved
src/commands/server/restore.ts Outdated Show resolved Hide resolved
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
@openshift-ci
Copy link

openshift-ci bot commented Oct 1, 2021

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mmorhun, tolusha

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

Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
@openshift-ci openshift-ci bot removed the lgtm label Oct 4, 2021
@openshift-ci
Copy link

openshift-ci bot commented Oct 4, 2021

New changes are detected. LGTM label has been removed.

Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
@mmorhun mmorhun merged commit 50a899d into main Oct 4, 2021
@mmorhun mmorhun deleted the crw-1497 branch October 4, 2021 09:47
@che-bot che-bot added this to the 7.38 milestone Oct 4, 2021
@mmorhun mmorhun mentioned this pull request Oct 4, 2021
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants