Skip to content

Commit

Permalink
docs(applicationset): explain impact of empty spec in templatePatch (a…
Browse files Browse the repository at this point in the history
…rgoproj#17042)

* docs: explain impact of empty spec in templatePatch

Signed-off-by: Nicholas Morey <nicholas@morey.tech>

* fix: not conditional helm values

Signed-off-by: Nicholas Morey <nicholas@morey.tech>

---------

Signed-off-by: Nicholas Morey <nicholas@morey.tech>
Signed-off-by: penglongli <pelenli@tencent.com>
  • Loading branch information
morey-tech authored and penglongli committed Mar 6, 2024
1 parent ce55746 commit 34b720e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions docs/operator-manual/applicationset/Template.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,15 @@ In this example, the ApplicationSet controller will generate an `Application` re

## Template Patch

Templating is only available on string type. However, some uses cases may require to apply templating on other types.
Templating is only available on string type. However, some use cases may require applying templating on other types.

Example:

- Set the automated sync policy
- Switch prune boolean to true
- Add multiple helm value files

Argo CD has a `templatePatch` feature to allow advanced templating. It supports both json and yaml.
- Conditionally set the automated sync policy.
- Conditionally switch prune boolean to `true`.
- Add multiple helm value files from a list.

The `templatePatch` feature enables advanced templating, with support for `json` and `yaml`.

```yaml
apiVersion: argoproj.io/v1alpha1
Expand Down Expand Up @@ -174,3 +173,6 @@ spec:

The `spec.project` field is not supported in `templatePatch`. If you need to change the project, you can use the
`spec.project` field in the `template` field.

!!! important
When writing a `templatePatch`, you're crafting a patch. So, if the patch includes an empty `spec: # nothing in here`, it will effectively clear out existing fields. See [#17040](https://github.com/argoproj/argo-cd/issues/17040) for an example of this behavior.

0 comments on commit 34b720e

Please sign in to comment.