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

Configure operator's peering via centralised settings #572

Merged
merged 5 commits into from
Nov 2, 2020

Conversation

nolar
Copy link
Owner

@nolar nolar commented Oct 31, 2020

The settings include:

  • Peering object name, i.e. peering "neighbourhood".
  • Default peering lifetime, i.e. how often to send keepalives.
  • The operator's explicit mode overrides: mandatory or standalone (the default remains to auto-detection).
  • New: stealth mode — to disable the keep-alive log messages to reduce logs.

The values passed to operator()/run() via kwargs or CLI options override the default settings. But the values set in the startup handlers override the kwargs/options.

The essential change here is that we get rid of an pseudo-peer "ourselves" that is used to store the configuration of the current operator, confused with other Peer objects of other operators as detected at runtime. That was one class for two distinct purposes. It is no more.

Internally, also extract the Identity type (a string) for operators' ids — so that they are not fixed with other strings by accident, and do some renames.

This is an extraction from a bigger PR for the reactor refactoring for multi-dimensional cluster observation — to separate the semantically distinct changes and reduce the size of the PR. There might be no direct value in this change alone.

nolar added 5 commits October 31, 2020 15:57
The legacy peering mode is now 1.5 years since it was deprecated in the early stages. There is no need to support it anymore, as barely anyone still use it in their clusters (taking into account that peering per se it not used often at all). But the legacy mode complicates the coming features with dynamic cluster scanning. So, the time has come to drop it — without releasing the major version of the framework.
Previously, the peering setup was stored in a pseudo-peer, so called "ourselves" — as detected at startup. This also included the "legacy peering mode" (which is now removed), and the whole peering configuration — namespace, peering object name, priority, our own identity, etc.

Now, this is split: the peering settings are moved to settings; the dynamic runtime identity is used directly; so as the namespace (with potentially multiple namespaces for multiple peering tasks in mind).

The `Peer` class is only left for the actual peers as read from the peering object, and solely for the purpose of doing the math with lifetime & deadlines.
With the default values, they override the default values defined in the settings object. Which is not a big deal until they match, but can be an issue if the configuration defaults are changed later. It is better to have one and only one source of truth for the default values.

A downside: the defaults will not be seen in `--help`. But these values can be misleading anyway, as the operator can override the values in the startup handlers.
@nolar nolar added the enhancement New feature or request label Oct 31, 2020
@nolar nolar merged commit 8023ea4 into master Nov 2, 2020
@nolar nolar deleted the peering-settings branch November 2, 2020 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant