This repository has been archived by the owner on Jul 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 279
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tweak List and Git generator docs (#333)
* Update generator docs
- Loading branch information
Showing
3 changed files
with
44 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,54 @@ | ||
# List Generator | ||
|
||
The List generator generates parameters based on any list of key/value pairs as long as the values are string values. In this example, we're targeting a local cluster named `engineering-dev`: | ||
The List generator generates parameters based on an arbitrary list of key/value pairs (as long as the values are string values). In this example, we're targeting a local cluster named `engineering-dev`: | ||
```yaml | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: ApplicationSet | ||
metadata: | ||
name: guestbook | ||
name: guestbook | ||
spec: | ||
generators: | ||
- list: | ||
elements: | ||
- cluster: engineering-dev | ||
url: https://kubernetes.default.svc | ||
# - cluster: engineering-prod | ||
# url: https://kubernetes.default.svc | ||
# foo: bar | ||
template: | ||
metadata: | ||
name: '{{cluster}}-guestbook' | ||
spec: | ||
project: default | ||
source: | ||
repoURL: https://github.com/argoproj-labs/applicationset.git | ||
targetRevision: HEAD | ||
path: examples/list-generator/guestbook/{{cluster}} | ||
destination: | ||
server: '{{url}}' | ||
namespace: guestbook | ||
generators: | ||
- list: | ||
elements: | ||
- cluster: engineering-dev | ||
url: https://kubernetes.default.svc | ||
# - cluster: engineering-prod | ||
# url: https://kubernetes.default.svc | ||
# foo: bar | ||
template: | ||
metadata: | ||
name: '{{cluster}}-guestbook' | ||
spec: | ||
project: default | ||
source: | ||
repoURL: https://github.com/argoproj-labs/applicationset.git | ||
targetRevision: HEAD | ||
path: examples/list-generator/guestbook/{{cluster}} | ||
destination: | ||
server: '{{url}}' | ||
namespace: guestbook | ||
``` | ||
(*The full example can be found [here](https://github.com/argoproj-labs/applicationset/tree/master/examples/list-generator).*) | ||
The List generator passes the `url` and `cluster` fields as parameters into the template. In this example, if one wanted to add a second element, we could uncomment the second element and the ApplicationSet controller would automatically target it with the defined application. | ||
In this example, the List generator passes the `url` and `cluster` fields as parameters into the template. If we wanted to add a second environment, we could uncomment the second element and the ApplicationSet controller would automatically target it with the defined application. | ||
|
||
With the ApplicationSet v0.1.0 release, one could *only* specify `url` and `cluster` element fields (plus arbitrary `values`). As of ApplicationSet v0.2.0, any key/value `element` pair is supported (which is also fully backwards compatible with the v0.1.0 form): | ||
```yaml | ||
spec: | ||
generators: | ||
- list: | ||
elements: | ||
# v0.1.0 form - requires cluster/url keys: | ||
- cluster: engineering-dev | ||
url: https://kubernetes.default.svc | ||
values: | ||
additional: value | ||
# v0.2.0+ form - does not require cluster/URL keys | ||
# (but they are still supported). | ||
- staging: "true" | ||
gitRepo: https://kubernetes.default.svc | ||
# (...) | ||
``` | ||
|
||
!!! note "Clusters must be predefined in Argo CD" | ||
These clusters *must* already be defined within Argo CD, in order to generate applications for these values. The ApplicationSet controller does not create clusters within Argo CD (for instance, it does not have the credentials to do so). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters