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

[ILM] Update show/hide data tier logic on cloud #81455

Merged

Conversation

jloleysens
Copy link
Contributor

@jloleysens jloleysens commented Oct 22, 2020

Summary

See #80023

Only show data tier options on cloud if the cluster is not using the deprecated node.data config and there is a data_* role present in the cluster. This could be a role like data_content which will ensure that the cluster is configured with the new data tier roles.

CC @jasontedor

Checklist

Delete any items that are not applicable to this PR.

only show data tier options on cloud if the cluster is not using
the deprecated node.data config and there is a data_* role
present. this will likely be a role like data_content which will
ensure that the cluster is configured with the new data tier
roles.
@jloleysens jloleysens added Feature:ILM v8.0.0 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 v7.10.0 v7.10.1 labels Oct 22, 2020
@jloleysens jloleysens requested a review from cjcenizal October 22, 2020 09:33
@jloleysens jloleysens requested a review from a team as a code owner October 22, 2020 09:33
@elasticmachine
Copy link
Contributor

Pinging @elastic/es-ui (Team:Elasticsearch UI)

Copy link
Contributor

@cjcenizal cjcenizal left a comment

Choose a reason for hiding this comment

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

Code LGTM! Didn't test locally. Just had a few suggestions.

* The "data" role can store data on any tier and the "data_content" role can store
* all data the ES stack uses for feature functionality like security related indices.
*/
export type NodeDataRoleWithCatchAll = 'data' | 'data_content' | NodeDataRole;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: not sure the name makes sense now. Perhaps it would make more sense to call this AnyNodeRole and rename NodeDataRole to DataTierNodeRole?

@@ -55,14 +55,18 @@ export const DataTierAllocationField: FunctionComponent<Props> = ({
return (
<NodesDataProvider>
{({ nodesByRoles, nodesByAttributes, isUsingDeprecatedDataRoleConfig }) => {
const hasDataNodeRoles = Object.keys(nodesByRoles).some((nodeRole) =>
nodeRole.trim().startsWith('data_')
Copy link
Contributor

Choose a reason for hiding this comment

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

I can imagine someone reading this and being unsure if it's intentional that this evaluates to true for data_content, too. How about we make the intention more explicit by using a type guard?

Building off my other suggestion, types/index.ts would become this:

/**
 * These roles reflect how nodes are stratified into different data tiers.
 *
 */
export type DataTierNodeRole = 'data_hot' | 'data_warm' | 'data_cold';

/**
 * The "data_content" role can store all data the ES stack uses for feature functionality
 * like security related indices.
 */
export type DataNodeRole = 'data_content' | DataTierNodeRole;

/**
 * The "data" role can store data on any tier.
 */
export type AnyNodeRole = 'data' | DataNodeRole;

export const isDataNodeRole = (nodeRole: string): value is DataNodeRole => {
  const dataNodeRoles: string[] = ['data_hot', 'data_warm', 'data_cold', 'data_content'];
  return dataNodeRoles.includes(nodeRole);
};

And then this becomes:

const hasDataNodeRoles = Object.keys(nodesByRoles).some(isDataNodeRole);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like the refactor suggestion regarding the data role types! Have implemented a refactor.

I'm not sure I share the same concern regarding intent, but I added a comment for clarity to the existing startsWith code 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

The reason I mentioned it was because I was personally unclear on whether that was the intention, until I read the PR description. :) Thanks for adding the comment.

@jloleysens
Copy link
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

async chunks size

id before after diff
indexLifecycleManagement 269.7KB 269.9KB +160.0B

History

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

@jloleysens jloleysens merged commit 0a0773a into elastic:master Oct 26, 2020
@jloleysens jloleysens deleted the ilm/stricter-check-for-use-of-node-roles branch October 26, 2020 10:37
jloleysens added a commit to jloleysens/kibana that referenced this pull request Oct 26, 2020
* Update show/hide data tier logic

only show data tier options on cloud if the cluster is not using
the deprecated node.data config and there is a data_* role
present. this will likely be a role like data_content which will
ensure that the cluster is configured with the new data tier
roles.

* refactor node role types for clarity

* added comment

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
jloleysens added a commit to jloleysens/kibana that referenced this pull request Oct 26, 2020
* Update show/hide data tier logic

only show data tier options on cloud if the cluster is not using
the deprecated node.data config and there is a data_* role
present. this will likely be a role like data_content which will
ensure that the cluster is configured with the new data tier
roles.

* refactor node role types for clarity

* added comment

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
# Conflicts:
#	x-pack/plugins/index_lifecycle_management/server/routes/api/nodes/register_list_route.ts
jloleysens added a commit that referenced this pull request Oct 26, 2020
* Update show/hide data tier logic

only show data tier options on cloud if the cluster is not using
the deprecated node.data config and there is a data_* role
present. this will likely be a role like data_content which will
ensure that the cluster is configured with the new data tier
roles.

* refactor node role types for clarity

* added comment

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
jloleysens added a commit to jloleysens/kibana that referenced this pull request Oct 26, 2020
…arm-phase-to-formlib

* 'master' of github.com:elastic/kibana:
  [Trigger Actions UI] Properly unmount app (elastic#81436)
  skip flaky suite (elastic#81576)
  skip flaky suite (elastic#78373)
  [Security Solution] Fix styling of EditDataProvider content (elastic#81456)
  [Search] Error Alignment 2 (elastic#80965)
  [APM] Unskip test (elastic#81574)
  [ML] Fix partition value selection on the Single Metric Viewer (elastic#81585)
  cleaning up expression service types (elastic#80643)
  Fix suggestions dropdown for query input (elastic#80990)
  [Usage collection] Make `schema` mandatory (elastic#79999)
  [ILM] Update show/hide data tier logic on cloud (elastic#81455)
  added brace import to advanced settings (elastic#81458)
  chore(NA): add spec-to-console and plugin-helpers as devOnly dependencies
jloleysens added a commit that referenced this pull request Oct 26, 2020
* [ILM] Update show/hide data tier logic on cloud (#81455)

* Update show/hide data tier logic

only show data tier options on cloud if the cluster is not using
the deprecated node.data config and there is a data_* role
present. this will likely be a role like data_content which will
ensure that the cluster is configured with the new data tier
roles.

* refactor node role types for clarity

* added comment

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
# Conflicts:
#	x-pack/plugins/index_lifecycle_management/server/routes/api/nodes/register_list_route.ts

* Replace `r` with `(r)`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:ILM 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.10.0 v7.10.1 v7.11.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants