-
Notifications
You must be signed in to change notification settings - Fork 119
feature: extensions #523
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
Merged
Merged
feature: extensions #523
Changes from 4 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
d6e7c67
feature: extensions
shwstppr 28a41cc
another fix
shwstppr 02ed1f3
entrypoint -> path
shwstppr f893194
update images
shwstppr 8670cf7
Added content on Built-in extensions
abh1sar acf154f
update image, add note on executable owner
shwstppr 358a655
notes on writing extensions
shwstppr b3c8784
Add details about winrm for hyperv
abh1sar e409e72
minor change
shwstppr f600591
vmname
shwstppr 92161e2
information about user-data
abh1sar 7f749fb
maintenance mode note
shwstppr c236f24
note on host capacities
shwstppr cc083c1
note on unsupported features
shwstppr a0041c2
step to verify proxmox token, secret
shwstppr 0db9492
fix
shwstppr 41c4c53
Update source/adminguide/extensions.rst
shwstppr cd99a83
add missing license
shwstppr 584fc2c
fix license formatting
shwstppr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
.. Licensed to the Apache Software Foundation (ASF) under one | ||
or more contributor license agreements. See the NOTICE file | ||
distributed with this work for additional information# | ||
regarding copyright ownership. The ASF licenses this file | ||
to you under the Apache License, Version 2.0 (the | ||
"License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, | ||
software distributed under the License is distributed on an | ||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations | ||
under the License. | ||
|
||
|
||
Extensions | ||
========== | ||
|
||
Extensions are a new mechanism introduced in Apache CloudStack to allow administrators to extend the platform's functionality by integrating external systems or custom workflows. Currently, CloudStack supports a single extension type called Orchestrator. | ||
|
||
In the UI, extensions can be managed under *Extensions* menu. | ||
|
||
|extensions.png| | ||
|
||
Overview | ||
^^^^^^^^ | ||
|
||
An extension in CloudStack is defined as an external binary (written in any programming language) that implements specific actions CloudStack can invoke. This allows operators to manage resource lifecycle operations outside CloudStack, such as provisioning VMs in third-party systems or triggering external automation pipelines. | ||
|
||
Extensions are managed through the API and UI, with support for configuration, resource mappings, and action execution. | ||
|
||
|create-extension.png| | ||
|
||
Configuration | ||
^^^^^^^^^^^^^ | ||
|
||
Administrators can define and manage the following components of an extension: | ||
|
||
- Path: A path to a file or script that will be executed during extension operations. | ||
|
||
- Configuration Details: Key-value properties used by the extension at runtime. | ||
|
||
- Resource Mappings: Association between extensions and CloudStack resources such as clusters, etc. | ||
|
||
Path and Availabilty | ||
^^^^^^^^^^^^^^^^^^^^ | ||
|
||
The path for an extension can point to any binary or executable script. If no explicit path is provided, CloudStack uses a default base Bash script. The state of the path is validated across all management servers. In the UI, the Availabilty is displayed as Not Ready if the file is missing, inaccessible, or differs across management servers. | ||
|
||
All extension files are stored under a directory named after the extension within `/usr/share/cloudstack-management/extensions`. | ||
|
||
Payload | ||
^^^^^^^ | ||
|
||
CloudStack sends structured JSON payloads to the extension binary during each operation. These payloads are written to .json files stored under `/var/lib/cloudstack/management/extensions`. The extension binary is expected to read the file and return an appropriate result. CloudStack automatically attempts to clean up payload files older than one day. | ||
|
||
Orchestrator Extension | ||
---------------------- | ||
|
||
An Orchestrator extension enables CloudStack to delegate VM orchestration to an external system. Key features include: | ||
|
||
- Cluster Mapping: Orchestrator extensions can be associated with one or more CloudStack clusters. | ||
|
||
- Hosts: Multiple hosts can be added to such clusters, ideally pointing to different physical or external hosts. | ||
|
||
- Instance Lifecycle Support: Extensions can handle basic VM actions like prepare, deploy, start, stop, reboot, status and delete. | ||
|
||
- Configuration Details: Key-value configuration details can be specified at different levels - extension, cluster mapping, host, template, service offering, instance. | ||
|
||
- Custom Actions: Admins can define custom actions beyond the standard VM operations. | ||
|
||
- Instance Preparation: Orchestrator extensions can optionally perform a preparation step during instance deployment. This step is executed before the instance is started on the external system. It allows the extension to update certain instance details in CloudStack. CloudStack sends a structured JSON containing the instance configuration, and the extension can respond with the values it wishes to modify. Currently, only a limited set of fields can be updated: the instance’s VNC password, MAC address, and the IPv4/IPv6 addresses of its NICs. | ||
|
||
|
||
|extension.png| | ||
|
||
|
||
CloudStack provides sample built-in orchestrator extensions for demonstration and testing purposes. | ||
|
||
.. include:: extensions/custom_actions.rst | ||
|
||
.. include:: extensions/troubleshooting.rst | ||
|
||
.. Images | ||
|
||
|
||
.. |extensions.png| image:: /_static/images/extensions.png | ||
.. |create-extension.png| image:: /_static/images/create-extension.png | ||
.. |extension.png| image:: /_static/images/extension.png |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
.. Licensed to the Apache Software Foundation (ASF) under one | ||
or more contributor license agreements. See the NOTICE file | ||
distributed with this work for additional information# | ||
regarding copyright ownership. The ASF licenses this file | ||
to you under the Apache License, Version 2.0 (the | ||
"License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, | ||
software distributed under the License is distributed on an | ||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations | ||
under the License. | ||
|
||
|
||
Custom Actions | ||
-------------- | ||
|
||
In addition to standard instance operations, extensions support custom actions. These can be configured via UI in the extension details view or the addCustomAction API. The extension binary or script must implement handlers for these action names and process any provided parameters. | ||
|
||
|add-custom-action.png| | ||
|
||
Description, allowed role types, parameters, success/error messages, configuration details, timeout can be defined during creation or update. | ||
Alowed role types can be one or more of Admin, Resource Admin, Domain Admin, User. | ||
Success and error messages will be used and returned during action execution. They allow string expansion and the following can be used to customise messages: | ||
|
||
- {{actionName}} for showing name of the action | ||
- {{extensionName}} for showing name of the extension | ||
- {{resourceName}} for showing name of the resource | ||
|
||
An example usage can be - "Successfully completed {{actionName}} for {{resourceName}} using {{extensionName}}". | ||
Configuration details can be key-value pairs which will be passed to the extension during action execution. | ||
Timeout value can be configured to adjust wait time for action completion. | ||
|
||
A single parameter can have the following details: | ||
|
||
- **name**: Name of the parameter. | ||
|
||
- **type**: Type of the parameter. It can be one of the following: BOOLEAN, DATE, NUMBER, STRING | ||
|
||
- **validationformat**: Validation format for the parameter value. Supported only for NUMBER and STRING type. For NUMBER, it can be NONE or DECIMAL. For STRING, it can be NONE, EMAIL, PASSWORD, URL, UUID. | ||
|
||
- **valueoptions**: Options for the value of the parameter. This is allowed only for NUMBER and STRING type. | ||
|
||
|
||
Running Custom Action | ||
^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
All enabled custom actions can then be triggered for a resource of the type the action is defined for or provided while running, using the **Run Action** view or runCustomAction API. | ||
|
||
|run-custom-action-instance.png| | ||
|
||
|run-custom-action.png| | ||
|
||
|
||
.. Images | ||
|
||
|
||
.. |add-custom-action.png| image:: /_static/images/add-custom-action.png | ||
.. |run-custom-action-instance.png| image:: /_static/images/run-custom-action-instance.png | ||
.. |run-custom-action.png| image:: /_static/images/run-custom-action.png |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
.. Licensed to the Apache Software Foundation (ASF) under one | ||
or more contributor license agreements. See the NOTICE file | ||
distributed with this work for additional information# | ||
regarding copyright ownership. The ASF licenses this file | ||
to you under the Apache License, Version 2.0 (the | ||
"License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, | ||
software distributed under the License is distributed on an | ||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations | ||
under the License. | ||
|
||
|
||
Troubleshooting Extensions | ||
-------------------------- | ||
|
||
Validate the Extension Path | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
- Ensure that the path is correctly defined and accessible on all management servers. | ||
|
||
- The script or binary must be executable and have appropriate permissions. | ||
|
||
- If the binary differs across management servers, the extension will be marked as Not Ready. | ||
|
||
- Ensure files are stored at: `/usr/share/cloudstack-management/extensions/<extension_name>` | ||
|
||
- CloudStack runs a background task at regular intervals to verify path readiness. If the path is not ready, its state will appear as Not Ready in the UI or API responses. | ||
|
||
- Alerts are generated if the extension path is not ready. | ||
|
||
- The check interval can be configured using the global configuration - `extension.path.state.check.interval`. The default is 5 minutes. | ||
|
||
Verify Payload Handling | ||
^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
- Ensure the extension binary can correctly read and parse the incoming JSON payload. | ||
|
||
- Payload files are placed at: `/var/lib/cloudstack/management/extensions/<extension_name>/` | ||
|
||
- These payload files are automatically cleaned up after 24 hours. | ||
|
||
- Improper parsing of the payload is a common cause of failure—log any parsing errors in your extension binary for debugging. | ||
|
||
Refer to Base Extension Scripts | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
- For guidance on implementing supported actions, refer to the base scripts present for each extension type. | ||
|
||
- For Orchestrator-type extensions, see: `/usr/share/cloudstack-common/scripts/vm/hypervisor/external/provisioner/provisioner.sh` | ||
|
||
- These scripts provide examples of how to handle standard actions like start, stop, status, etc. | ||
|
||
Check Logs for Errors | ||
^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
- If the extension does not respond or returns an error, check the management server logs. | ||
|
||
- Logs include details of: | ||
|
||
1. Invocation of the extension binary | ||
|
||
2. Payload hand-off | ||
|
||
3. Output parsing | ||
|
||
- Any exceptions or exit code issues. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.