In this changeset, I wrote down the documentation on how to implement a cluster data model collector plugin for Watcher. This documentation corresponds to part 1 of the associated specification. Change-Id: Iac72b933df95252163033cd559d13348075a9b16 Partially-Implements: blueprint cluster-model-objects-wrapper
3.2 KiB
Create a third-party plugin for Watcher
Watcher provides a plugin architecture which allows anyone to extend the existing functionalities by implementing third-party plugins. This process can be cumbersome so this documentation is there to help you get going as quickly as possible.
Pre-requisites
We assume that you have set up a working Watcher development
environment. So if this not already the case, you can check out our
documentation which explains how to set up a development environment
<watcher_developement_environment>
.
Third party project scaffolding
First off, we need to create the project structure. To do so, we can use cookiecutter and the OpenStack cookiecutter project scaffolder to generate the skeleton of our project:
$ virtualenv thirdparty
$ source thirdparty/bin/activate
$ pip install cookiecutter
$ cookiecutter https://github.com/openstack-dev/cookiecutter
The last command will ask you for many information, and If you set
module_name
and repo_name
as
thirdparty
, you should end up with a structure that looks
like this:
$ cd thirdparty
$ tree .
.
├── babel.cfg
├── CONTRIBUTING.rst
├── doc
│ └── source
│ ├── conf.py
│ ├── contributing.rst
│ ├── index.rst
│ ├── installation.rst
│ ├── readme.rst
│ └── usage.rst
├── HACKING.rst
├── LICENSE
├── MANIFEST.in
├── README.rst
├── requirements.txt
├── setup.cfg
├── setup.py
├── test-requirements.txt
├── thirdparty
│ ├── __init__.py
│ └── tests
│ ├── base.py
│ ├── __init__.py
│ └── test_thirdparty.py
└── tox.ini
Note: You should add python-watcher as a dependency in the requirements.txt file:
# Watcher-specific requirements
python-watcher
Implementing a plugin for Watcher
Now that the project skeleton has been created, you can start the implementation of your plugin. As of now, you can implement the following plugins for Watcher:
- A
goal plugin <implement_goal_plugin>
- A
strategy plugin <implement_strategy_plugin>
- An
action plugin <implement_action_plugin>
- A
planner plugin <implement_planner_plugin>
- A workflow engine plugin
- A
cluster data model collector plugin <implement_cluster_data_model_collector_plugin>
If you want to learn more on how to implement them, you can refer to their dedicated documentation.