Skip to content

Commit

Permalink
docs(applicationset): fix layout matrix/merge generator restrictions
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Crenshaw <michael@crenshaw.dev>

Signed-off-by: Sverre Boschman <1142569+sboschman@users.noreply.github.com>
  • Loading branch information
sboschman committed Aug 9, 2022
1 parent 22ea51d commit 93e70cc
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 83 deletions.
114 changes: 57 additions & 57 deletions docs/operator-manual/applicationset/Generators-Matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,68 +169,68 @@ with the label `kubernetes.io/environment: dev` will have only dev-specific conf
## Restrictions

1. The Matrix generator currently only supports combining the outputs of only two child generators (eg does not support generating combinations for 3 or more).

1. You should specify only a single generator per array entry, eg this is not valid:
```yaml
- matrix:
generators:
- list: # (...)
git: # (...)
```

- matrix:
generators:
- list: # (...)
git: # (...)

- While this *will* be accepted by Kubernetes API validation, the controller will report an error on generation. Each generator should be specified in a separate array element, as in the examples above.

1. The Matrix generator does not currently support [`template` overrides](Template.md#generator-templates) specified on child generators, eg this `template` will not be processed:
```yaml
- matrix:
generators:
- list:
elements:
- # (...)
template: { } # Not processed
```

- matrix:
generators:
- list:
elements:
- # (...)
template: { } # Not processed

1. Combination-type generators (matrix or merge) can only be nested once. For example, this will not work:
```yaml
- matrix:
generators:
- matrix:
generators:
- matrix: # This third level is invalid.
generators:
- list:
elements:
- # (...)
```

- matrix:
generators:
- matrix:
generators:
- matrix: # This third level is invalid.
generators:
- list:
elements:
- # (...)

1. When using parameters from one child generator inside another child generator, the child generator that *consumes* the parameters **must come after** the child generator that *produces* the parameters.
For example, the below example would be invalid (cluster-generator must come after the git-files generator):
```yaml
- matrix:
generators:
# cluster generator, 'child' #1
- clusters:
selector:
matchLabels:
argocd.argoproj.io/secret-type: cluster
kubernetes.io/environment: '{{path.basename}}' # {{path.basename}} is produced by git-files generator
# git generator, 'child' #2
- git:
repoURL: https://github.com/argoproj/applicationset.git
revision: HEAD
files:
- path: "examples/git-generator-files-discovery/cluster-config/**/config.json"
```

- matrix:
generators:
# cluster generator, 'child' #1
- clusters:
selector:
matchLabels:
argocd.argoproj.io/secret-type: cluster
kubernetes.io/environment: '{{path.basename}}' # {{path.basename}} is produced by git-files generator
# git generator, 'child' #2
- git:
repoURL: https://github.com/argoproj/applicationset.git
revision: HEAD
files:
- path: "examples/git-generator-files-discovery/cluster-config/**/config.json"

1. You cannot have both child generators consuming parameters from each another. In the example below, the cluster generator is consuming the `{{path.basename}}` parameter produced by the git-files generator, whereas the git-files generator is consuming the `{{name}}` parameter produced by the cluster generator. This will result in a circular dependency, which is invalid.
```yaml
- matrix:
generators:
# cluster generator, 'child' #1
- clusters:
selector:
matchLabels:
argocd.argoproj.io/secret-type: cluster
kubernetes.io/environment: '{{path.basename}}' # {{path.basename}} is produced by git-files generator
# git generator, 'child' #2
- git:
repoURL: https://github.com/argoproj/applicationset.git
revision: HEAD
files:
- path: "examples/git-generator-files-discovery/cluster-config/engineering/{{name}}**/config.json" # {{name}} is produced by cluster generator
```

- matrix:
generators:
# cluster generator, 'child' #1
- clusters:
selector:
matchLabels:
argocd.argoproj.io/secret-type: cluster
kubernetes.io/environment: '{{path.basename}}' # {{path.basename}} is produced by git-files generator
# git generator, 'child' #2
- git:
repoURL: https://github.com/argoproj/applicationset.git
revision: HEAD
files:
- path: "examples/git-generator-files-discovery/cluster-config/engineering/{{name}}**/config.json" # {{name}} is produced by cluster generator
50 changes: 25 additions & 25 deletions docs/operator-manual/applicationset/Generators-Merge.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,31 +114,31 @@ When merged with the updated base parameters, the `values.redis` value for the p
## Restrictions

1. You should specify only a single generator per array entry. This is not valid:
```yaml
- merge:
generators:
- list: # (...)
git: # (...)
```

- merge:
generators:
- list: # (...)
git: # (...)

- While this *will* be accepted by Kubernetes API validation, the controller will report an error on generation. Each generator should be specified in a separate array element, as in the examples above.

1. The Merge generator does not support [`template` overrides](Template.md#generator-templates) specified on child generators. This `template` will not be processed:
```yaml
- merge:
generators:
- list:
elements:
- # (...)
template: { } # Not processed
```

- merge:
generators:
- list:
elements:
- # (...)
template: { } # Not processed

1. Combination-type generators (Matrix or Merge) can only be nested once. For example, this will not work:
```yaml
- merge:
generators:
- merge:
generators:
- merge: # This third level is invalid.
generators:
- list:
elements:
- # (...)
```

- merge:
generators:
- merge:
generators:
- merge: # This third level is invalid.
generators:
- list:
elements:
- # (...)
2 changes: 1 addition & 1 deletion docs/operator-manual/applicationset/Generators.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Generators are responsible for generating *parameters*, which are then rendered

Generators are primarily based on the data source that they use to generate the template parameters. For example: the List generator provides a set of parameters from a *literal list*, the Cluster generator uses the *Argo CD cluster list* as a source, the Git generator uses files/directories from a *Git repository*, and so.

As of this writing there are seven generators:
As of this writing there are eight generators:

- [List generator](Generators-List.md): The List generator allows you to target Argo CD Applications to clusters based on a fixed list of cluster name/URL values.
- [Cluster generator](Generators-Cluster.md): The Cluster generator allows you to target Argo CD Applications to clusters, based on the list of clusters defined within (and managed by) Argo CD (which includes automatically responding to cluster addition/removal events from Argo CD).
Expand Down

0 comments on commit 93e70cc

Please sign in to comment.