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
apiVersion: argoproj.io/v1alpha1kind: ApplicationSetmetadata:name: guestbookspec:generators:- list:elements:- cluster: engineering-devurl: https://kubernetes.default.svcenv: staging- cluster: engineering-produrl: https://kubernetes.default.svcenv: prodselector:matchLabels:env: stagingtemplate:metadata:name: '{{cluster}}-guestbook'spec:project: defaultsource:repoURL: https://github.com/argoproj-labs/applicationset.gittargetRevision: HEADpath: examples/list-generator/guestbook/{{cluster}}destination:server: '{{url}}'namespace: guestbook
The List generator + Post Selector generates a single set of parameters:
- cluster: engineering-devurl: https://kubernetes.default.svcenv: staging
It is also possible to use matchExpressions for more powerful selectors.
spec:generators:- clusters: {}selector:matchExpressions:- key: serveroperator: Invalues:- https://kubernetes.default.svc- https://some-other-cluster