Skip to content

Commit

Permalink
fix: fixed doc formatting and sidecar plugin info
Browse files Browse the repository at this point in the history
Signed-off-by: Soumya Ghosh Dastidar <[email protected]>
  • Loading branch information
gdsoumya committed Dec 8, 2022
1 parent bd56c40 commit b504e50
Showing 1 changed file with 52 additions and 51 deletions.
103 changes: 52 additions & 51 deletions docs/user-guide/config-management-plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ spec:
```

!!! note
The `discover.command` command only has access to the above environment starting with v2.4.
The `discover.command` command only has access to the above environment starting with v2.4.

Before reaching the `init.command`, `generate.command`, and `discover.command` commands, Argo CD prefixes all
user-supplied environment variables (#3 above) with `ARGOCD_ENV_`. This prevents users from directly setting
Expand All @@ -275,36 +275,36 @@ for 2.4.

4. (Starting in v2.4) Parameters in the Application spec:

```yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
spec:
source:
plugin:
parameters:
- name: values-files
array: [values-dev.yaml]
- name: helm-parameters
map:
image.tag: v1.2.3
```

The parameters are available as JSON in the `ARGOCD_APP_PARAMETERS` environment variable. The example above would
produce this JSON:

```json
[{"name": "values-files", "array": ["values-dev.yaml"]}, {"name": "helm-parameters", "map": {"image.tag": "v1.2.3"}}]
```

!!! note
Parameter announcements, even if they specify defaults, are _not_ sent to the plugin in `ARGOCD_APP_PARAMETERS`.
Only parameters explicitly set in the Application spec are sent to the plugin. It is up to the plugin to apply
the same defaults as the ones announced to the UI.

The same parameters are also available as individual environment variables. The names of the environment variables
follows this convention:

```yaml
```yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
spec:
source:
plugin:
parameters:
- name: values-files
array: [values-dev.yaml]
- name: helm-parameters
map:
image.tag: v1.2.3
```

The parameters are available as JSON in the `ARGOCD_APP_PARAMETERS` environment variable. The example above would
produce this JSON:

```json
[{"name": "values-files", "array": ["values-dev.yaml"]}, {"name": "helm-parameters", "map": {"image.tag": "v1.2.3"}}]
```

!!! note
Parameter announcements, even if they specify defaults, are _not_ sent to the plugin in `ARGOCD_APP_PARAMETERS`.
Only parameters explicitly set in the Application spec are sent to the plugin. It is up to the plugin to apply
the same defaults as the ones announced to the UI.

The same parameters are also available as individual environment variables. The names of the environment variables
follows this convention:

```yaml
- name: some-string-param
string: some-string-value
# PARAM_SOME_STRING_PARAM=some-string-value
Expand All @@ -318,11 +318,11 @@ for 2.4.
map:
image.tag: v1.2.3
# PARAM_SOME_MAP_PARAM_IMAGE_TAG=v1.2.3
```
```

!!! warning Sanitize/escape user input
As part of Argo CD's manifest generation system, config management plugins are treated with a level of trust. Be
sure to escape user input in your plugin to prevent malicious input from causing unwanted behavior.
!!! warning
Sanitize/escape user input. As part of Argo CD's manifest generation system, config management plugins are treated with a level of trust. Be
sure to escape user input in your plugin to prevent malicious input from causing unwanted behavior.


## Using a config management plugin with an Application
Expand Down Expand Up @@ -446,9 +446,9 @@ spec:
args: ["sample args"]
```

!!!note
The `lockRepo` key is not relevant for sidecar plugins, because sidecar plugins do not share a single source repo
directory when generating manifests.
!!! note
The `lockRepo` key is not relevant for sidecar plugins, because sidecar plugins do not share a single source repo
directory when generating manifests.

### 2. Write discovery rules for your plugin

Expand All @@ -457,20 +457,21 @@ Sidecar plugins use discovery rules instead of a plugin name to match Applicatio
Write rules applicable to your plugin [using the instructions above](#1-write-the-plugin-configuration-file) and add
them to your configuration file.

!!!important
After installing your sidecar plugin, you'll need to remove the `name` field from the plugin config in your
Application specs. For example:
!!! note
After installing your sidecar plugin, you may remove the `name` field from the plugin config in your
Application specs for auto-discovery or update the name to `<metadata.name>-<spec.version>`
if version was mentioned in the `ConfigManagementPlugin` spec or else just use `<metadata.name>`. For example:

```yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: guestbook
spec:
source:
plugin:
name: pluginName # Delete this (and set `plugin: {}` if `name` was the only value).
```
```yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: guestbook
spec:
source:
plugin:
name: pluginName # Delete this for auto-discovery (and set `plugin: {}` if `name` was the only value) or use proper sidecar plugin name
```

### 3. Make sure the plugin has access to the tools it needs

Expand Down

0 comments on commit b504e50

Please sign in to comment.