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

Automatically perform a backup of Che server side components before attempting an upgrade #1055

Merged
merged 10 commits into from
Sep 15, 2021

Conversation

mmorhun
Copy link
Contributor

@mmorhun mmorhun commented Sep 7, 2021

What does this PR do?

Makes Che Operator to create a backup of Che installation before upgrading it to newer version.

As operator cannot know when it will be replaced with a newer version, it is the newer operator that does the backup before updating Che to newer version. The backup is sent to internal backup server to have the behavior more predictable (and to not to guess in case several backup servers configured). Backup CRs are named after version to upgrade to: backup-before-update-to-<version> (for example: backup-before-update-to-7-36-2). Also, to be able to know the version of the operator needed to reastore the backup, cheVersion field is added to the backup CRD status.

Screenshot/screencast of this PR

N/A

What issues does this PR fix or reference?

Is a part of https://issues.redhat.com/browse/CRW-1497

How to test this PR?

  1. Create a new fake version in stable channel that uses operator image from this PR. To do this modify ./bundle/stable/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml.
  2. Build catalog source image. It cannot be deployed via operator-sdk as it considers CSV not valid after our release scripts changes.
  3. Run ./olm/testUpdate.sh script till waitCheServerDeploy line (it should deploy the catalog source built in previous step)
  4. Approve install plan to update to the fake version.
  5. Check that internal backup server is created and configured and backup CR is created.

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.

Release Notes Text

Server component backup of the Che server has been introduced a few releases ago. Now it’s performed automatically before every Che upgrade.

Copy link
Contributor

@AndrienkoAleksandr AndrienkoAleksandr left a comment

Choose a reason for hiding this comment

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

It would be nice to have some unit tests for this new feature.

controllers/che/checluster_controller.go Show resolved Hide resolved
go.mod Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
controllers/che/backup.go Outdated Show resolved Hide resolved
controllers/che/backup.go Outdated Show resolved Hide resolved
controllers/che/backup.go Outdated Show resolved Hide resolved
controllers/che/checluster_controller.go Outdated Show resolved Hide resolved
api/v1/checlusterbackup_types.go Show resolved Hide resolved
controllers/che/backup.go Show resolved Hide resolved
controllers/che/backup.go Outdated Show resolved Hide resolved
controllers/che/checluster_controller.go Outdated Show resolved Hide resolved
controllers/che/backup.go Outdated Show resolved Hide resolved
controllers/che/backup.go Outdated Show resolved Hide resolved
controllers/che/backup.go Outdated Show resolved Hide resolved
go.mod 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>
@codecov
Copy link

codecov bot commented Sep 10, 2021

Codecov Report

Merging #1055 (c6b47ef) into main (8b1dd15) will decrease coverage by 0.32%.
The diff coverage is 19.44%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1055      +/-   ##
==========================================
- Coverage   52.52%   52.19%   -0.33%     
==========================================
  Files          62       63       +1     
  Lines        7688     7757      +69     
==========================================
+ Hits         4038     4049      +11     
- Misses       3215     3271      +56     
- Partials      435      437       +2     
Impacted Files Coverage Δ
controllers/che/checluster_controller.go 20.00% <0.00%> (-0.44%) ⬇️
controllers/che/backup.go 21.31% <21.31%> (ø)
pkg/deploy/server/server.go 63.87% <100.00%> (-0.38%) ⬇️

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 8b1dd15...c6b47ef. Read the comment docs.

controllers/che/checluster_controller.go Show resolved Hide resolved
controllers/che/backup.go Outdated Show resolved Hide resolved
controllers/che/backup.go Outdated Show resolved Hide resolved
controllers/che/backup.go Outdated Show resolved Hide resolved
controllers/che/backup.go Outdated Show resolved Hide resolved
controllers/che/backup.go Show resolved Hide resolved
controllers/che/checluster_controller.go Show resolved Hide resolved
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
controllers/che/backup.go Outdated Show resolved Hide resolved
controllers/che/backup.go Outdated Show resolved Hide resolved
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
@openshift-ci openshift-ci bot removed the lgtm label Sep 14, 2021
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
@openshift-ci openshift-ci bot added the lgtm label Sep 15, 2021
@openshift-ci
Copy link

openshift-ci bot commented Sep 15, 2021

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: AndrienkoAleksandr, 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

@mmorhun mmorhun merged commit a1f30c3 into main Sep 15, 2021
@mmorhun mmorhun deleted the crw-1497 branch September 15, 2021 12:38
@che-bot che-bot added this to the 7.37 milestone Sep 15, 2021
@l0rd l0rd added new&noteworthy status/release-notes-review-needed Issues that needs to be reviewed by the doc team for the Release Notes wording labels Sep 28, 2021
@l0rd l0rd changed the title Create backup on each update Automatically perform a backup before attempting to upgrade Che Dec 12, 2021
@l0rd l0rd changed the title Automatically perform a backup before attempting to upgrade Che Automatically perform a backup of Che server side components before attempting an upgrade Dec 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm new&noteworthy status/release-notes-review-needed Issues that needs to be reviewed by the doc team for the Release Notes wording
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants