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

[Snapshot restore] Add support for feature_states #131310

Merged

Conversation

sabarasaba
Copy link
Member

@sabarasaba sabarasaba commented May 2, 2022

Fixes #120314 and #95128

Summary

This PR adds support for feature states in both policy creation and snapshot restoration and also thanks to elastic/elasticsearch#82671 we can now hide system indices from policy creation.

There is a few small oddities with the way the ES API's work with this feature:

Release Note

With elastic/elasticsearch#63513 feature states were added to elasticsearch allowing users to backup system indices and other related state of certain features. Previously the user could only backup/restore all features or none by using the include global state feature. This PR adds support in kibana for allowing the user to select which features they want to backup/restore.

How to test

  1. Start elasticsearch with yarn es snapshot --license=trial -E path.repo=/tmp/es-backups and kibana with yarn start
  2. Navigate to Stack Management -> Snapshot and Restore -> Policies and create a new one
  3. Verify that:
    • IncludeGlobalState and includeFeatureState toggles are enabled by default
    • If both toggles are disabled and includeGlobalState is enabled, includeFeatureState toggle should also be enabled
    • The state from those two toggles is reflected in the review summary and request tabs
    • Create two policies through the API and that each has either globalState or featureState and make sure state is reflected properly in both details flyout and edit form.
  4. Run two policies, one that will contain featureStates and one that will contain none
  5. Verify that:
    • State for both is well reflected in the flyout
    • In restore form, both options appear not enabled by default
    • In restore form for the policy that contain no featureStates, the toggle should be disabled and a callout should be shown
    • In restore form the state from those two toggles is reflected in the review summary and request tabs
Screenshots policy creation

Screenshot 2022-05-10 at 11 05 39
Screenshot 2022-05-10 at 11 06 23
Screenshot 2022-05-10 at 11 06 14
Screenshot 2022-05-10 at 11 06 03

Screenshots snapshot restore

Screenshot 2022-05-10 at 11 08 36
Screenshot 2022-05-10 at 11 08 27
Screenshot 2022-05-10 at 11 08 17

@sabarasaba sabarasaba self-assigned this May 2, 2022
@sabarasaba sabarasaba added Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more Feature:Snapshot and Restore Elasticsearch snapshots and repositories UI v8.3.0 backport:skip This commit does not require backporting release_note:feature Makes this part of the condensed release notes labels May 2, 2022
@sabarasaba sabarasaba requested a review from gchaps May 4, 2022 12:07
@sabarasaba sabarasaba marked this pull request as ready for review May 4, 2022 12:09
@sabarasaba sabarasaba requested a review from a team as a code owner May 4, 2022 12:09
@elasticmachine
Copy link
Contributor

Pinging @elastic/platform-deployment-management (Team:Deployment Management)

@sabarasaba
Copy link
Member Author

@elasticmachine merge upstream

@sabarasaba
Copy link
Member Author

Thanks for having a look everyone! I’ve met with @cristina-eleonora to discuss more in details how we thought this feature should work and we ended up coming to the decision to keep both include global state and feature states as separate options in the UI. This not only makes it more explicit to the user and improves discoverability, but also helps address some of the issues that @yuliacech mentioned about users perhaps creating policies using the API. We also went through the copy in a live session with @debadair to double check that everything is alright on that end.

I've also created a few ES issues to track some of the anomalies that were discovered while building this feature and listed them in the summary of this PR.

Copy link
Contributor

@alisonelizabeth alisonelizabeth left a comment

Choose a reason for hiding this comment

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

Great work @sabarasaba! I left a couple minor comments in the code.

When we retrieve the list of feature states from the installation it returns all of them even if they have no data to backup, which could be confusing for the user when they see no feature states in the resulting snapshot when they try to restore it. I've created the following issue for tracking that elastic/elasticsearch#86606

Thanks for opening this issue! I found this behavior quite confusing.

A few other things I noticed:

  • When creating a new policy, and global state is enabled, I do not see it represented in the request. Technically, I think this is OK because global state is enabled by default. However, I think it'd be helpful to be explicit about this.

Screen Shot 2022-05-10 at 9 57 38 AM

Screen Shot 2022-05-10 at 9 57 46 AM

  • From a design perspective, it seemed a little strange to have almost a double heading for feature states. Do we need the "Only from" part, or can it be incorporated into the top-level heading?

Screen Shot 2022-05-10 at 9 50 03 AM


testBed = await setup(httpSetup);
await nextTick();
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for cleaning this up!

@@ -67,6 +67,11 @@ export const PolicyForm: React.FunctionComponent<Props> = ({
const [policy, setPolicy] = useState<SlmPolicyPayload>({
...originalPolicy,
config: {
// When creating a new policy includesGlobalState is enabled by default and the API will also
Copy link
Contributor

Choose a reason for hiding this comment

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

thanks for adding this comment 👍

@sabarasaba
Copy link
Member Author

Thanks for having a look @alisonelizabeth! I've addressed your feedback with 5b3dc19
Screenshot 2022-05-10 at 18 40 07

Copy link
Contributor

@alisonelizabeth alisonelizabeth left a comment

Choose a reason for hiding this comment

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

Thanks for addressing my feedback! Didn't retest, but code changes LGTM. Great work 🎉

Copy link
Contributor

@debadair debadair left a comment

Choose a reason for hiding this comment

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

Left a suggestion for changing the stacked toggle & menu based on a convo with @gchaps, and her suggested label lets us drop the "from" language entirely.

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.

Great work, @sabarasaba 🎉
Thanks a lot for addressing my feedback and also for creating issues to follow up with ES. For the list of all features that might not have any data to backup, we can maybe just mention that in the description. Otherwise, LGTM!

@sabarasaba
Copy link
Member Author

@elasticmachine merge upstream

@sabarasaba
Copy link
Member Author

After speaking to @cristina-eleonora we ended up finding a couple of things that need to be improved UX wise, but they seem a bit out of scope for this PR. I created a new issue for tackling those #132211

@sabarasaba
Copy link
Member Author

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
snapshotRestore 184 196 +12

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
snapshotRestore 21 22 +1

Async chunks

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

id before after diff
snapshotRestore 258.8KB 266.4KB +7.6KB

Page load bundle

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

id before after diff
snapshotRestore 26.5KB 27.5KB +962.0B
Unknown metric groups

API count

id before after diff
snapshotRestore 21 22 +1

History

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

cc @sabarasaba

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:Snapshot and Restore Elasticsearch snapshots and repositories UI release_note:feature Makes this part of the condensed release notes Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more ui-copy Review of UI copy with docs team is recommended v8.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Snapshot & Restore] Snapshot flow for system indices is broken in 8.0+
9 participants