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

[DPE-4251][DPE-4196][DPE-3603] Plugin Management Re-work (1/3): Plugin Manager handles the config changed before started #282

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

phvalguima
Copy link
Contributor

@phvalguima phvalguima commented May 2, 2024

Introduction

This is part of a bigger set of changes happening across the plugin management modules.

The main goal is to: (1) curb the requirements for restart from any configuration changes; and (2) get a faster response time using cached entries wherever possible.

We ensure that any configuration changes that come from plugin management are applied via API before being persisted on config files. If the API responds with a 200 status, then we should only write the new value to the configuration and finish without a need for restart.

In case the service is down and API is not available, we can assume we will eventually start the service back up. In this case, it suffices to write the config entries to the files and leave to the next start to pick them up.

This task is going to be divided into 3x parts:

  1. Addresses low ranging fruits where we reduce the number of restarts and add caching support
  2. Merge {add,delete}_plugin together and its equivalents in OpenSearchPluginConfig class: from now on, we receive one big dictionary where a key: None means we want to simply delete that entry
  3. Returns unit tests: this is going to be commented out whilst Parts 1 and 2 happen, given this part of the code was covered with extensive testing

Part 1/3

The current implementation of plugin_manager.run waits for the cluster to be started before processing its config changed. We relax this demand and open to the option where the cluster is not yet ready, so we can modify the configuration without issuing a restart request.

#252 is closed with OpenSearchPluginRelationsHandler interface. It allows plugins to define how they will handle its relation(s). opensearch_backup module extends this interface and defines a checker to process either small or large deployments details.

Other relevant changes:

  1. Renaming method check_plugin_manager_ready to check_plugin_manager_ready_for_api
  2. Any plugin that needs to manage things via API call should check the health of the cluster using check_plugin_manager_ready_for_api
  3. Moving opensearch_distro.version to load the workload_version file we have present instead of an API call: this is two fold, 1. removes the dependency to a cluster to be ready and 2. makes this method in-sync with recent changes for upgrades logic
  4. Waive the need of loading the default settings if this particular unit is powered down: which makes sense, in this moment we can do any config changes as we will eventually powered it back up later
  5. If /_cluster/settings is available: apply the configs via API and do not add a restart request
  6. On config-changed handler, the upgrade_in_progress check gets precedence and will continuously defer config-changed event until upgrade is finished before calling the plugin manager
  7. Create a OpenSearchKeyStoreNotReadyYetError: responsible to identify the keystore has not been initialized yet across the cluster and hence, we cannot manage any plugins that use it; however, we always apply the config changes from that plugin.

That still frees the config_changed to just call plugin_manager.run() before everything is set, as the run() method changes hard configuration only.

Closes #252, #280

@phvalguima
Copy link
Contributor Author

@carlcsaposs-canonical I have reshuffled the self.upgrade_in_progress here. Now, we check and defer before even doing the plugin_manager.run() (hence, no options will change until the upgrade is finished). Is this the right way? In another sense, it holds the user from doing any changes while the upgrade is in progress.

@carlcsaposs-canonical
Copy link
Contributor

@phvalguima from the current diff, it seems like if there's an IP change and no config change, a warning message will be logged

ip change should be supported during in-progress upgrade (so if only ip change, there shouldn't be a warning)

@carlcsaposs-canonical carlcsaposs-canonical removed their request for review May 2, 2024 09:10
@phvalguima phvalguima marked this pull request as draft June 3, 2024 20:44
@phvalguima phvalguima removed the request for review from Mehdi-Bendriss June 3, 2024 20:45
@phvalguima phvalguima force-pushed the DPE-4251-plugin-manager-change-before-started-set branch from 39ddb84 to 3edb4d6 Compare June 9, 2024 22:13
pipx install tox
pipx install poetry
- name: Run tests
run: tox run -e unit
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Temp.: Will revert it once the main integration tests pass and we are sure of the changes below (there are a lot of unit tests that will need to be updated here)

@phvalguima phvalguima changed the title [DPE-4251] Plugin Manager handles the config changed before started [DPE-4251][DPE-4196][DPE-3603] Plugin Management Re-work (1/3): Plugin Manager handles the config changed before started Jun 11, 2024
@phvalguima phvalguima marked this pull request as ready for review June 12, 2024 04:51
@phvalguima phvalguima requested review from Mehdi-Bendriss and reneradoi and removed request for reneradoi June 12, 2024 04:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RFE] Extend plugin manager
2 participants