-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[ILM] Update show/hide data tier logic on cloud #81455
Conversation
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.
Pinging @elastic/es-ui (Team:Elasticsearch UI) |
There was a problem hiding this 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; |
There was a problem hiding this comment.
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_') |
There was a problem hiding this comment.
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);
There was a problem hiding this comment.
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 👍
There was a problem hiding this comment.
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.
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]async chunks size
History
To update your PR or re-run it, just comment with: |
* 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>
* 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
* 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>
…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
* [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)`
Summary
See #80023
Only show data tier options on cloud if the cluster is not using the deprecated
node.data
config and there is adata_*
role present in the cluster. This could be a role likedata_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.