-
Notifications
You must be signed in to change notification settings - Fork 45
/
applications.yaml
42 lines (42 loc) · 2.01 KB
/
applications.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{{- range $key,$val := .Values.applications }}
{{- /*
in order to use tpl within a range, _and_ have the key/val available to sub-templates,
need to add some variables to the root context.
*/ -}}
{{- $_ := set $ "curAppName" (print $.Values.envName "-" $key) }}
{{- if $val.enabled }}
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: {{ required "A valid envName is required" $.Values.envName }}-{{ $key }}
spec:
destination:
namespace: {{ $val.destination.namespace | default $.Values.default.app.destination.namespace | required (printf "No destination.namespace specified for %s" $key ) }}
server: {{ $val.destination.server | default $.Values.default.app.destination.server | required (printf "No destination.server specified for %s" $key ) }}
{{- if $.Values.projectOverride }}
project: {{ $.Values.projectOverride }}
{{- else }}
project: {{ $.Values.envName }}-{{ $val.project | default $.Values.default.app.project | required (printf "No project specified for %s" $key ) }}
{{- end }}
{{- if $val.enableAutoSync | default $.Values.default.app.enableAutoSync }}
syncPolicy:
automated:
prune: {{ $val.autoSyncPrune | default $.Values.default.app.autoSyncPrune | default true }}
{{- end }}
source:
path: {{ tpl $val.source.path $ }}
repoURL: {{ $val.source.repoURL | default $.Values.default.app.source.repoURL | required (printf "No source.repoURL specified for %s" $key ) }}
targetRevision: {{ $val.source.targetRevision | default $.Values.default.app.source.targetRevision | required (printf "No source.targetRevision specified for %s" $key ) }}
{{- if $val.source.extraSourceFields }}
{{ tpl $val.source.extraSourceFields $ | indent 4 }}
{{- else if $.Values.default.app.source.extraSourceFields }}
{{ tpl $.Values.default.app.source.extraSourceFields $ | indent 4 }}
{{- end }}
{{- if $val.extraFields }}
{{ tpl $val.extraFields $ | indent 2 }}
{{- else if $.Values.default.app.extraFields }}
{{ tpl $.Values.default.app.extraFields $ | indent 2 }}
{{- end }}
{{- end }}
{{- end }}