Skip to content

Commit

Permalink
docs: Post Selector moved to Generators section (argoproj#11109)
Browse files Browse the repository at this point in the history
  • Loading branch information
flickers authored Mar 14, 2023
1 parent 4c1bb61 commit 9b682f8
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 37 deletions.
43 changes: 43 additions & 0 deletions docs/operator-manual/applicationset/Generators-Post-Selector.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Post Selector all generators

The Selector allows to post-filter based on generated values using the kubernetes common labelSelector format. In the example, the list generator generates a set of two application which then filter by the key value to only select the `env` with value `staging`:

## Example: List generator + Post Selector
```yaml
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: guestbook
spec:
generators:
- list:
elements:
- cluster: engineering-dev
url: https://kubernetes.default.svc
env: staging
- cluster: engineering-prod
url: https://kubernetes.default.svc
env: prod
selector:
matchLabels:
env: staging
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 List generator + Post Selector generates a single set of parameters:
```yaml
- cluster: engineering-dev
url: https://kubernetes.default.svc
env: staging
```
2 changes: 2 additions & 0 deletions docs/operator-manual/applicationset/Generators.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ As of this writing there are eight generators:
- [Pull Request generator](Generators-Pull-Request.md): The Pull Request generator uses the API of an SCMaaS provider (eg GitHub) to automatically discover open pull requests within an repository.
- [Cluster Decision Resource generator](Generators-Cluster-Decision-Resource.md): The Cluster Decision Resource generator is used to interface with Kubernetes custom resources that use custom resource-specific logic to decide which set of Argo CD clusters to deploy to.

All generators can be filtered by using the [Post Selector](Generators-Post-Selector.md)

If you are new to generators, begin with the **List** and **Cluster** generators. For more advanced use cases, see the documentation for the remaining generators above.
38 changes: 1 addition & 37 deletions docs/user-guide/application-set.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,40 +48,4 @@ Within ApplicationSet there exist other more powerful generators in addition to

To learn more about the ApplicationSet controller, check out [ApplicationSet documentation](../operator-manual/applicationset/index.md) to install the ApplicationSet controller alongside Argo CD.

**Note:** Starting `v2.3` of Argo CD, we don't need to install ApplicationSet Controller separately. It would be instead as part of Argo CD installation.

#### Post Selector all generators

The Selector allows to post-filter based on generated values using the kubernetes common labelSelector format. In the example, the list generator generates a set of two application which then filter by the key value to only select the `env` with value `staging`:

```yaml
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: guestbook
spec:
generators:
- list:
elements:
- cluster: engineering-dev
url: https://kubernetes.default.svc
env: staging
- cluster: engineering-prod
url: https://kubernetes.default.svc
env: prod
selector:
matchLabels:
env: staging
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
```
**Note:** Starting `v2.3` of Argo CD, we don't need to install ApplicationSet Controller separately. It would be instead as part of Argo CD installation.
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ nav:
- operator-manual/applicationset/Generators-SCM-Provider.md
- operator-manual/applicationset/Generators-Cluster-Decision-Resource.md
- operator-manual/applicationset/Generators-Pull-Request.md
- operator-manual/applicationset/Generators-Post-Selector.md
- Template fields:
- operator-manual/applicationset/Template.md
- operator-manual/applicationset/GoTemplate.md
Expand Down

0 comments on commit 9b682f8

Please sign in to comment.