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

[Index lifecycle management] Add deprecated policy warnings #174150

Merged
merged 14 commits into from
Jan 11, 2024

Conversation

sabarasaba
Copy link
Member

@sabarasaba sabarasaba commented Jan 3, 2024

Partially addresses #170805

Summary

With elastic/elasticsearch#101148 we now can alert the users when an ILM policy will soon be deprecated and shouldnt be relied upon. This PR adds a badge and a callout to the ILM UI to alert the users about this.

How to test
  • Start up kibana and es
  • Create a deprecated policy using devtools
  • Navigate to Stack management -> ILM
  • Verify that:
    • Deprecated policies are hidden by default
    • Upon enabling filtering to see them they should pop up on the table with a badge
    • Verify that deprecated policies are highlighted and when editing, we also show a warning callout.
Create deprecated policy
PUT _ilm/policy/my_policy
{
  "policy": {
      "deprecated": true,
    "_meta": {
      "description": "used for nginx log",
      "project": {
        "name": "myProject",
        "department": "myDepartment"
      }
    },
    "phases": {
      "warm": {
        "min_age": "10d",
        "actions": {
          "forcemerge": {
            "max_num_segments": 1
          }
        }
      },
      "delete": {
        "min_age": "30d",
        "actions": {
          "delete": {}
        }
      }
    }
  }
}
Screenshots Screenshot 2024-01-03 at 11 09 58

Screenshot 2024-01-10 at 11 34 00
Screenshot 2024-01-10 at 11 34 07

@sabarasaba sabarasaba added Feature:ILM 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 backport:skip This commit does not require backporting v8.13.0 labels Jan 3, 2024
@sabarasaba sabarasaba self-assigned this Jan 3, 2024
@sabarasaba
Copy link
Member Author

/ci

@sabarasaba
Copy link
Member Author

@elasticmachine merge upstream

@sabarasaba
Copy link
Member Author

/ci

Copy link
Contributor

@florent-leborgne florent-leborgne left a comment

Choose a reason for hiding this comment

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

Suggesting to tweak a little the message description to:

  • not repeat the title
  • be slightly more explicit about what this deprecation means (the policy might/will be removed eventually, which is different than just stay without being maintained)
  • say what should a user using it do?

@sabarasaba sabarasaba marked this pull request as ready for review January 8, 2024 15:50
@sabarasaba sabarasaba requested a review from a team as a code owner January 8, 2024 15:50
@elasticmachine
Copy link
Contributor

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

@ElenaStoeva ElenaStoeva self-requested a review January 8, 2024 16:21
@alisonelizabeth
Copy link
Contributor

Thanks for working on this @sabarasaba! I just took a look at your screenshots and read some more of the background. I noticed this comment in this ES issue:

We could hide deprecated component templates by default and issue a deprecation warning when using a deprecated component template.

What do you think about doing something like this (ie, hide the deprecated policies by default behind a toggle or something)? While I think the "Deprecated" badge is helpful, it does still seem potentially confusing to see both 30-days-default and 30-days@lifecycle show up in the list by default.


On another note, I'm wondering if we should reconsider showing the error banner "Editing a managed policy can break Kibana", especially with the comments on #172683. This is outside the scope of your PR, just something I noticed while reviewing the screenshots 😄

Copy link
Contributor

@ElenaStoeva ElenaStoeva 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 working on this @sabarasaba! Tested locally and code changes LGTM 👍

I only have a question on the index template changes as I was wondering why they are needed.

Edit: Sorry, I just noticed that @alisonelizabeth added some good suggestions. I will review again if further changes are made.

x-pack/plugins/index_management/common/types/templates.ts Outdated Show resolved Hide resolved
@sabarasaba
Copy link
Member Author

@elasticmachine merge upstream

@sabarasaba
Copy link
Member Author

@elasticmachine merge upstream

@sabarasaba
Copy link
Member Author

Thanks for the review @ElenaStoeva and @alisonelizabeth! I've updated the PR to have the deprecated polcies hidden by default and with a table filter we can toggle them on/off, so things seem a little bit tidier now.

On another note, I'm wondering if we should reconsider showing the error banner "Editing a managed policy can break Kibana", especially with the comments on #172683. This is outside the scope of your PR, just something I noticed while reviewing the screenshots 😄

Yeah I think we should think about that a bit more, I've created a separate issue for dealing with that #174579

@sabarasaba
Copy link
Member Author

@elasticmachine merge upstream


// Now we should see all deprecated policies
deprecatedPolicies = findTestSubject(rendered, 'deprecatedPolicyBadge');
expect(deprecatedPolicies.length).toBe(10);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I'm wondering if it would be a good idea to expect the length to be greater than 0 rather than exactly 10 (so that we future proof the test in case some managed policies are added/removed in the test environment)?

Also nit, could we test that actually clicking the "Deprecated" button shows the deprecated policies?

Copy link
Member Author

Choose a reason for hiding this comment

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

The table filters dont have a property for adding a data-test-subj, so the only way I could find how to test it was by inputting a filter in the search bar!

@ElenaStoeva
Copy link
Contributor

ElenaStoeva commented Jan 10, 2024

Thanks for updating the PR @sabarasaba. I tested locally again and verified that the deprecated policies are hidden by default and that the "Deprecated" button works correctly. New code changes also LGTM (with a minor comment on the tests). 👍

@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
indexLifecycleManagement 144.8KB 146.6KB +1.7KB

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:ILM 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 v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants