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

Refactor node configuration and add role validation #3694

Merged

Conversation

charith-elastic
Copy link
Contributor

Adds validation of node roles. The checks are:

  • At least one master node must exist
  • node.roles are not supported before 7.7.0
  • node.roles and node.{role} settings should not be mixed

A couple of issues were discovered during this work:

  • There was no provision for handling the voting_only role
  • The original configuration provided by the user was not preserved -- making it difficult to make decisions based on whether the user had explicitly disabled a setting (e.g. whether node.transform was set to false by the user or by Go's zero value rules)

This includes a refactoring to address the above issues as well.

Fixes #3409

@charith-elastic charith-elastic added >enhancement Enhancement of existing functionality v1.3.0 labels Sep 1, 2020
Copy link
Contributor

@david-kow david-kow left a comment

Choose a reason for hiding this comment

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

LGTM, tested and it seems to work. One nit.

masterRequiredMsg = "Elasticsearch needs to have at least one master node"
parseVersionErrMsg = "Cannot parse Elasticsearch version. String format must be {major}.{minor}.{patch}[-{label}]"
mixedRoleConfigMsg = "Detected a combination of node.roles and %s. Use only node.roles"
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we just suggest to pick one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because there's no good term to describe node.{role} config settings, I chose to just list them so that the user understands what needs to be removed. Do you think it's not necessary?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, that's fine. I was referring to "Use only node.roles", I thought it might be better to just say that either one approach or the other should be used instead of pointing users to use node.roles specifically.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah I see. Presumably node.roles is the preferred method of defining roles going forward. I don't even see a mention of node.{role} settings in the 7.9 docs so I assume they'll be deprecated in the future.

Copy link
Contributor

Choose a reason for hiding this comment

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

If it is preferred then I'm fine leaving it as it is.

@charith-elastic charith-elastic merged commit eebe6aa into elastic:master Sep 4, 2020
@charith-elastic charith-elastic deleted the fix/validate-node-roles branch September 4, 2020 07:22
@david-kow david-kow changed the title Refactor node config and add role validation Refactor node configuration and add role validation Oct 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement Enhancement of existing functionality v1.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ES version validation for node.roles
2 participants