|
1 | 1 | # Plugin Generator |
2 | 2 |
|
3 | | -Plugins allow you to provide your own generator. |
| 3 | +The Plugin generator is a generator type which allows you to provide your own custom generator through a plugin. In contrast to other generators with predetermined logic (the [Cluster generator](Generators-Cluster.md) fetching clusters using a selector on ArgoCD secrets, [Git generator](Generators-Git.md) using a Git repository, etc.), a Plugin generator can use any custom code with input and output parameters. |
4 | 4 |
|
5 | 5 | - You can write in any language |
6 | 6 | - Simple: a plugin just responds to RPC HTTP requests. |
7 | 7 | - You can use it in a sidecar, or standalone deployment. |
8 | 8 | - You can get your plugin running today, no need to wait 3-5 months for review, approval, merge and an Argo software |
9 | 9 | release. |
10 | | -- You can combine it with Matrix or Merge. |
| 10 | +- You can combine it with [Matrix generator](Generators-Matrix.md) or [Merge generator](Generators-Merge.md) |
| 11 | + |
| 12 | +In general, the flow of an ApplicationSet with a Plugin generator is as follows: |
| 13 | + |
| 14 | +- The ApplicationSet controller sends an HTTP POST to `baseUrl` every `requeueAfterSeconds`. The request includes `input.parameters` defined in the ApplicationSet. |
| 15 | +- Your custom plugin service receives the request, reads the input parameters and executes its custom logic to fetch any necessary data and construct a list of output parameter objects. |
| 16 | +- The plugin service returns the parameter list in a response to the ApplicationSet controller. |
| 17 | +- The ApplicationSet controller iterates through the parameter objects and uses each one to fill out the template (defined in the ApplicationSet object) to create an Application. |
| 18 | +- This allows for dynamic creation of Argo CD Applications based on custom user-created defined templates, parameters, and logic. |
11 | 19 |
|
12 | 20 | To start working on your own plugin, you can generate a new repository based on the example |
13 | 21 | [applicationset-hello-plugin](https://github.com/argoproj-labs/applicationset-hello-plugin). |
@@ -221,7 +229,7 @@ Some things to note here: |
221 | 229 | - The input parameters are included in the request body and can be accessed using the `input.parameters` variable. |
222 | 230 | - The output must always be a list of object maps nested under the `output.parameters` key in a map. |
223 | 231 | - `generator.input.parameters` and `values` are reserved keys. If present in the plugin output, these keys will be overwritten by the |
224 | | - contents of the `input.parameters` and `values` keys in the ApplicationSet's plugin generator spec. |
| 232 | + contents of the `input.parameters` and `values` keys in the ApplicationSet's Plugin generator spec. |
225 | 233 |
|
226 | 234 | ## With matrix and pull request example |
227 | 235 |
|
@@ -285,7 +293,7 @@ To illustrate : |
285 | 293 |
|
286 | 294 | - The generator pullRequest would return, for example, 2 branches: `feature-branch-1` and `feature-branch-2`. |
287 | 295 |
|
288 | | -- The generator plugin would then perform 2 requests as follows : |
| 296 | +- The Plugin generator would then perform 2 requests as follows : |
289 | 297 |
|
290 | 298 | ```shell |
291 | 299 | curl http://localhost:4355/api/v1/getparams.execute -H "Authorization: Bearer strong-password" -d \ |
|
0 commit comments