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

[CPDEV-93723] Restore from backup holding another Kubernetes version #520

Merged
merged 3 commits into from
Oct 17, 2023

Conversation

ilia1243
Copy link
Contributor

@ilia1243 ilia1243 commented Oct 13, 2023

Description

  • If backup.tar.gz for restore procedure holds different Kubernetes version, it is not reflected in final cluster.yaml.

Solution

  • prepare.verify_backup_data task is now always done during enrichment, so Kubernetes version is always enriched.
  • prepare.unpack task is now always done before enrichment.
  • Recreate inventory with the version that is restored from backup.

Test Cases

TestCase 1

Backup and restore to the previous Kubernetes version. Check final inventory.

Steps:

  1. Install kubernetes and make backup.
  2. Upgrade to new version.
  3. Restore using the backup archive.

ER: thirdparties are installed for old version. Old version is restored.

  1. Check the resulting cluster.yaml.

Results:

Before After
Still holds new Kubernetes version Holds old Kubernetes version

TestCase 2

Restore only specific resources.

Steps:

  1. Prepare backup and run restore --tasks import.nodes.

Results:

Before After
KeyError: 'backup_tmpdir' The task is run successfully.

Checklist

  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • Integration CI passed
  • Unit tests. If Yes list of new/changed tests with brief description
  • There is no merge conflicts

Unit tests

test_restore.py - added tests to cover enrichment.

@ilia1243 ilia1243 added the bug Something isn't working label Oct 13, 2023
@ilia1243 ilia1243 requested a review from Imadzuma October 13, 2023 07:59
@ilia1243 ilia1243 marked this pull request as draft October 13, 2023 08:01
1. Always unpack before running the task.
2. Always verify Kubernetes version. Move enrichment of the version to kubernetes module.
3. Recreate inventory if the version was restored from backup.
@ilia1243 ilia1243 force-pushed the bugfix/restore_extract_version branch from b553714 to 9fbf63a Compare October 13, 2023 08:12
@ilia1243 ilia1243 marked this pull request as ready for review October 13, 2023 08:19
@koryaga koryaga merged commit 68e6229 into main Oct 17, 2023
@koryaga koryaga deleted the bugfix/restore_extract_version branch October 17, 2023 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants