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

[Upgrade Assistant] Show on prem backup step when found-snapshots repository not found #121060

Conversation

sabarasaba
Copy link
Member

@sabarasaba sabarasaba commented Dec 13, 2021

Summary

As described by ECE-Snapshots docs users might not have snapshots configured by default. The cloud backup step assumes that the installation has it and that the found-snapshots repository exists, as a consequence of this the user will be seeing an error about a missing snapshots repository.

This PR changes the logic of the backup step to detect this edge case and default to the on prem step that will instead render a button that will take the user to the snapshots app.

How to test

  1. Start elasticsearch with yarn es snapshot --license=trial and kibana with yarn start
  2. Change this line so that it negates the first part of the if expression that checks for isCloudEnabled. This will force to load the cloud backup step while working locally.
  3. Navigate to Stack Management -> Upgrade Assistant
  4. Verify that the network request for cloud_backup_status failed and that the backupstep is for on prem

Note: when this PR is merged, I'll create a new one for getting this change into main and 8.x

Screenshots

Error message

image

@sabarasaba sabarasaba added Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more release_note:skip Skip the PR/issue when compiling release notes Feature:Upgrade Assistant backport:skip This commit does not require backporting v7.16.2 labels Dec 13, 2021
@sabarasaba sabarasaba self-assigned this Dec 13, 2021
@sabarasaba sabarasaba changed the title [Upgrade Assistant] Show on prem backupstep if snapshots are disabled [Upgrade Assistant] Show on prem backupstep when found-snapshots repository not found Dec 13, 2021
@sabarasaba sabarasaba changed the title [Upgrade Assistant] Show on prem backupstep when found-snapshots repository not found [Upgrade Assistant] Show on prem backup step when found-snapshots repository not found Dec 13, 2021
@sabarasaba sabarasaba requested a review from yuliacech December 13, 2021 11:48
@sabarasaba sabarasaba marked this pull request as ready for review December 13, 2021 11:48
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-stack-management (Team:Stack Management)

}

const isMissingFoundSnapshotsRepo = (error: ResponseError) => {
return error.statusCode === 404 && error.message === `[${CLOUD_SNAPSHOT_REPOSITORY}] missing`;
Copy link
Contributor

@cjcenizal cjcenizal Dec 13, 2021

Choose a reason for hiding this comment

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

Nit: can we future-proof this by checking that the message includes the CLOUD_SNAPSHOT_REPOSITORY instead of comparing against the entire string? If it's a 404 then I think this would be sufficient to infer that the repository is missing, without depending upon the specific language ES is using to communicate this.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think even safer would be to add a test for how missing repo error is returned to UA api integration tests here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks both for having a look! I've updated this function to check if the message includes the repo name instead of matching against the entire string as suggested.

Copy link
Contributor

@yuliacech yuliacech left a comment

Choose a reason for hiding this comment

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

Thanks a lot for fixing this step for ECE, @sabarasaba!
I tested locally with xpack.cloud.id: 'test' in kibana.dev.yml file. The missing repo error was shown in the network tab and the correct on prem backup was displayed in the UI, great job 👍

@sabarasaba
Copy link
Member Author

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
upgradeAssistant 127.9KB 128.1KB +187.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
upgradeAssistant 18.2KB 18.3KB +54.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @sabarasaba

@sabarasaba sabarasaba merged commit c0f2974 into elastic:7.16 Dec 16, 2021
sabarasaba added a commit to sabarasaba/kibana that referenced this pull request Dec 16, 2021
…ository not found (elastic#121060)

* Show on prem stem when in cloud and missing found snapshots

* Remove test code

* Lets match against the error containing the missing repository instead of the full message

Co-authored-by: Kibana Machine <[email protected]>
sabarasaba added a commit that referenced this pull request Dec 16, 2021
…shots repository not found (#121375)

* [Upgrade Assistant] Show on prem backup step when found-snapshots repository not found (#121060)

* Show on prem stem when in cloud and missing found snapshots

* Remove test code

* Lets match against the error containing the missing repository instead of the full message

Co-authored-by: Kibana Machine <[email protected]>

* commit using @elastic.co

Co-authored-by: Kibana Machine <[email protected]>
kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Dec 16, 2021
…shots repository not found (elastic#121375)

* [Upgrade Assistant] Show on prem backup step when found-snapshots repository not found (elastic#121060)

* Show on prem stem when in cloud and missing found snapshots

* Remove test code

* Lets match against the error containing the missing repository instead of the full message

Co-authored-by: Kibana Machine <[email protected]>

* commit using @elastic.co

Co-authored-by: Kibana Machine <[email protected]>
kibanamachine added a commit that referenced this pull request Dec 17, 2021
…shots repository not found (#121375) (#121450)

* [Upgrade Assistant] Show on prem backup step when found-snapshots repository not found (#121060)

* Show on prem stem when in cloud and missing found snapshots

* Remove test code

* Lets match against the error containing the missing repository instead of the full message

Co-authored-by: Kibana Machine <[email protected]>

* commit using @elastic.co

Co-authored-by: Kibana Machine <[email protected]>

Co-authored-by: Ignacio Rivas <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Upgrade Assistant NeededFor:Cloud release_note:skip Skip the PR/issue when compiling release notes Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more v7.16.2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants