Skip to content

Commit 61639b2

Browse files
committed
extension: import using manifest
For apache/cloudstack#12102 Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
1 parent aac9e8f commit 61639b2

File tree

3 files changed

+304
-0
lines changed

3 files changed

+304
-0
lines changed
62.4 KB
Loading

source/adminguide/extensions.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ CloudStack provides built-in Orchestrator Extensions for Proxmox, Hyper-V, and M
9696

9797
.. include:: extensions/limitations.rst
9898

99+
.. include:: extensions/import_extensions.rst
100+
99101
.. include:: extensions/troubleshooting.rst
100102

101103
.. include:: extensions/developer.rst
Lines changed: 302 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,302 @@
1+
.. Licensed to the Apache Software Foundation (ASF) under one
2+
or more contributor license agreements. See the NOTICE file
3+
distributed with this work for additional information#
4+
regarding copyright ownership. The ASF licenses this file
5+
to you under the Apache License, Version 2.0 (the
6+
"License"); you may not use this file except in compliance
7+
with the License. You may obtain a copy of the License at
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
Unless required by applicable law or agreed to in writing,
10+
software distributed under the License is distributed on an
11+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
12+
KIND, either express or implied. See the License for the
13+
specific language governing permissions and limitations
14+
under the License.
15+
16+
Importing Extensions using manifest files
17+
=========================================
18+
19+
CloudStack provides functionality to import extensions using manifest files. This allows administrators to quickly set up and configure built-in extensions without manually creating them through the UI or API.
20+
Either the ``importExtension`` API call can be used by providing a manifest file link, or the UI can be used to import extensions by providing the manifest file link directly.
21+
CloudStack supports importing extensions from Git repositories or direct archive links. The manifest file must reference a source that provides:
22+
23+
- A Git repository with archive download capability (e.g., GitHub), or
24+
- A direct URL to a downloadable archive (e.g., ``.zip``, ``.tar.gz``)
25+
26+
The archive must contain the required entrypoint file and any other needed scripts/files at the correct paths.
27+
28+
|import-extension.png|
29+
30+
31+
Git Repository Layout and Required Files
32+
----------------------------------------
33+
34+
For an extension to be installed by CloudStack, two files are required:
35+
36+
1. ``manifest.yaml``
37+
2. An entrypoint binary or script referenced from the manifest.
38+
39+
``manifest.yaml`` (required)
40+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
41+
42+
- Must be located at the root of the repository.
43+
- Must follow the extension schema (``apiVersion``, ``kind``, ``metadata``, ``spec``, etc.).
44+
- Must reference a valid entrypoint file under ``spec.entrypoint.path``.
45+
46+
Example layout::
47+
48+
cloudstack-orchestrator-extension/
49+
├── manifest.yaml # Required — must be at the root
50+
└── orchestrator.py # Required — entrypoint binary/script
51+
52+
Entrypoint Binary or Script (required)
53+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
54+
55+
The entrypoint file must exist at the exact relative path specified::
56+
57+
entrypoint:
58+
language: python
59+
path: orchestrator.py
60+
targetDir: /usr/share/cloudstack-management/extensions/orchestrator
61+
62+
Resulting installation path::
63+
64+
/usr/share/cloudstack-management/extensions/orchestrator/orchestrator.py
65+
66+
---
67+
68+
Manifest Structure Overview
69+
---------------------------
70+
71+
The ``manifest.yaml`` file describes how CloudStack should install, register, and run the extension.
72+
73+
At a high level, a manifest contains::
74+
75+
apiVersion
76+
kind
77+
metadata
78+
source
79+
spec
80+
enabled
81+
customActions
82+
83+
---
84+
85+
Required Fields
86+
---------------
87+
88+
apiVersion and kind
89+
~~~~~~~~~~~~~~~~~~~
90+
91+
- ``apiVersion``: API version for the extension manifest.
92+
- ``kind``: Extension type — for compute lifecycle handlers, this must be ``OrchestratorExtension``.
93+
94+
---
95+
96+
Metadata
97+
--------
98+
99+
Provides human-readable information stored in the Registry and shown in the UI.
100+
101+
+--------------+----------+---------------------------------------------+
102+
| Field | Required | Description |
103+
+==============+==========+=============================================+
104+
| name | Yes | Internal identifier |
105+
+--------------+----------+---------------------------------------------+
106+
| displayName | Yes | UI-visible name |
107+
+--------------+----------+---------------------------------------------+
108+
| description | Yes | Short explanation |
109+
+--------------+----------+---------------------------------------------+
110+
| version | Yes | Semantic version |
111+
+--------------+----------+---------------------------------------------+
112+
| maintainer | Yes | Contact information |
113+
+--------------+----------+---------------------------------------------+
114+
| homepage | Optional | Project URL |
115+
+--------------+----------+---------------------------------------------+
116+
117+
Example::
118+
119+
metadata:
120+
name: orchestrator
121+
displayName: Orchestrator Extension
122+
description: >
123+
Example orchestrator extension for CloudStack.
124+
version: 0.1.0
125+
maintainer: "Your Name <your.email@example.com>"
126+
homepage: "https://github.com/user/cloudstack-orchestrator-extension"
127+
128+
---
129+
130+
Source
131+
------
132+
133+
Defines where CloudStack fetches extension files from::
134+
135+
source:
136+
type: git
137+
url: "https://github.com/user/cloudstack-orchestrator-extension"
138+
refs: "main"
139+
140+
---
141+
142+
Spec
143+
----
144+
145+
Spec Type::
146+
147+
spec:
148+
type: Orchestrator
149+
150+
Compatibility (required)
151+
~~~~~~~~~~~~~~~~~~~~~~~~
152+
153+
Defines supported CloudStack versions::
154+
155+
spec:
156+
compatibility:
157+
cloudstack:
158+
minVersion: 4.23.0
159+
160+
Entrypoint (required)
161+
~~~~~~~~~~~~~~~~~~~~~
162+
163+
Specifies installation and execution settings::
164+
165+
spec:
166+
entrypoint:
167+
path: orchestrator.py
168+
targetDir: /usr/share/cloudstack-management/extensions/orchestrator
169+
170+
Execution path::
171+
172+
<targetDir>/<path>
173+
174+
Orchestrator Options (optional)
175+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
176+
177+
::
178+
179+
spec:
180+
orchestrator:
181+
requiresPrepareVm: false
182+
183+
Details (optional)
184+
~~~~~~~~~~~~~~~~~~
185+
186+
Free-form metadata passed through without interpretation::
187+
188+
spec:
189+
details:
190+
key1: value1
191+
key2: value2
192+
193+
---
194+
195+
Global Enabled Flag
196+
-------------------
197+
198+
Controls whether the extension becomes active after installation::
199+
200+
enabled: true
201+
202+
---
203+
204+
Custom Actions
205+
--------------
206+
207+
Extensions may expose UI actions.
208+
209+
If not required::
210+
211+
customActions: []
212+
213+
Example::
214+
215+
customActions:
216+
- name: BackupInstance
217+
displayName: "Backup Instance"
218+
description: "Trigger a backup using the external orchestrator."
219+
resourcetype: VirtualMachine
220+
enabled: true
221+
timeout: 600
222+
allowedroletypes: [Admin, DomainAdmin, User]
223+
successmessage: "Successfully completed {{actionName}} for {{resourceName}} with {{extensionName}}"
224+
errormessage: "Failed to complete {{actionName}} for {{resourceName}} with {{extensionName}}"
225+
details:
226+
vendor: "external-backup-system"
227+
retentionPolicy: "daily"
228+
229+
---
230+
231+
Parameters
232+
----------
233+
234+
Shown to the user when executing an action.
235+
236+
If unused::
237+
238+
parameters: []
239+
240+
Example::
241+
242+
parameters:
243+
- name: backup_type
244+
type: STRING
245+
required: true
246+
validationformat: NONE
247+
valueoptions: "full,incremental"
248+
249+
- name: retain_days
250+
type: NUMBER
251+
required: false
252+
validationformat: DECIMAL
253+
254+
Supported Parameter Types
255+
~~~~~~~~~~~~~~~~~~~~~~~~~
256+
257+
- BOOLEAN
258+
- DATE
259+
- NUMBER
260+
- STRING
261+
262+
Validation Formats
263+
~~~~~~~~~~~~~~~~~~
264+
265+
+------------+--------------------------------------+
266+
| Type | Formats |
267+
+============+======================================+
268+
| NUMBER | ``NONE``, ``DECIMAL`` |
269+
+------------+--------------------------------------+
270+
| STRING | ``NONE``, ``EMAIL``, ``PASSWORD``, |
271+
| | ``URL``, ``UUID`` |
272+
+------------+--------------------------------------+
273+
| BOOLEAN | No additional formats |
274+
+------------+--------------------------------------+
275+
| DATE | No additional formats |
276+
+------------+--------------------------------------+
277+
278+
---
279+
280+
Example Parameter Block
281+
-----------------------
282+
283+
::
284+
285+
parameters:
286+
- name: backup_type
287+
type: STRING
288+
required: true
289+
validationformat: NONE
290+
valueoptions: "full,incremental"
291+
292+
- name: retain_days
293+
type: NUMBER
294+
validationformat: DECIMAL
295+
296+
- name: notify
297+
type: BOOLEAN
298+
299+
.. Images
300+
301+
302+
.. |import-extension.png| image:: /_static/images/import-extension.png

0 commit comments

Comments
 (0)