From 652518ed3a0e1b8cccc1411fe893133e7d52b2e5 Mon Sep 17 00:00:00 2001 From: Sverre Boschman <1142569+sboschman@users.noreply.github.com> Date: Tue, 9 Aug 2022 16:04:43 +0200 Subject: [PATCH] docs(applicationset): fix layout matrix/merge generator restrictions (#10246) Co-authored-by: Michael Crenshaw Signed-off-by: Sverre Boschman <1142569+sboschman@users.noreply.github.com> --- .../applicationset/Generators-Matrix.md | 114 +++++++++--------- .../applicationset/Generators-Merge.md | 50 ++++---- .../applicationset/Generators.md | 2 +- 3 files changed, 83 insertions(+), 83 deletions(-) diff --git a/docs/operator-manual/applicationset/Generators-Matrix.md b/docs/operator-manual/applicationset/Generators-Matrix.md index 270643a616bbb..326f9515be436 100644 --- a/docs/operator-manual/applicationset/Generators-Matrix.md +++ b/docs/operator-manual/applicationset/Generators-Matrix.md @@ -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 diff --git a/docs/operator-manual/applicationset/Generators-Merge.md b/docs/operator-manual/applicationset/Generators-Merge.md index fd2501d26e17a..eb32343accbf4 100644 --- a/docs/operator-manual/applicationset/Generators-Merge.md +++ b/docs/operator-manual/applicationset/Generators-Merge.md @@ -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: + - # (...) diff --git a/docs/operator-manual/applicationset/Generators.md b/docs/operator-manual/applicationset/Generators.md index 12e6440818fe7..cd61db5da7918 100644 --- a/docs/operator-manual/applicationset/Generators.md +++ b/docs/operator-manual/applicationset/Generators.md @@ -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).