forked from KohlsTechnology/eunomia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
job.yaml
106 lines (106 loc) · 3.81 KB
/
job.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
apiVersion: batch/v1
kind: Job
metadata:
name: gitopsconfig-{{ .Config.ObjectMeta.Name }}-{{ getID }}
namespace: {{ .Config.ObjectMeta.Namespace }}
labels:
action: {{ .Action }}
spec:
template:
spec:
containers:
- name: template-processor
imagePullPolicy: IfNotPresent
image: {{ .Config.Spec.TemplateProcessorImage }}
env:
- name: HOME
value: /tmp
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: GITOPSCONFIG_NAME
value: {{ .Config.ObjectMeta.Name }}
- name: TEMPLATE_GIT_URI
value: {{ .Config.Spec.TemplateSource.URI }}
- name: TEMPLATE_GIT_REF
value: {{ .Config.Spec.TemplateSource.Ref }}
{{ if .Config.Spec.TemplateSource.HTTPProxy }}
- name: TEMPLATE_GIT_HTTP_PROXY
value: {{ .Config.Spec.TemplateSource.HTTPProxy }}
{{ end }}
{{ if .Config.Spec.TemplateSource.HTTPSProxy }}
- name: TEMPLATE_GIT_HTTPS_PROXY
value: {{ .Config.Spec.TemplateSource.HTTPSProxy }}
{{ end }}
{{ if .Config.Spec.TemplateSource.NOProxy }}
- name: TEMPLATE_GIT_NO_PROXY
value: {{ .Config.Spec.TemplateSource.NOProxy }}
{{ end }}
- name: TEMPLATE_GIT_DIR
value: "/git/templates"
- name: PARAMETER_GIT_URI
value: {{ .Config.Spec.ParameterSource.URI }}
- name: PARAMETER_GIT_REF
value: {{ .Config.Spec.ParameterSource.Ref }}
{{ if .Config.Spec.ParameterSource.HTTPProxy }}
- name: PARAMETER_GIT_HTTP_PROXY
value: {{ .Config.Spec.ParameterSource.HTTPProxy }}
{{ end }}
{{ if .Config.Spec.ParameterSource.HTTPSProxy }}
- name: PARAMETER_GIT_HTTPS_PROXY
value: {{ .Config.Spec.ParameterSource.HTTPSProxy }}
{{ end }}
{{ if .Config.Spec.ParameterSource.NOProxy }}
- name: PARAMETER_GIT_NO_PROXY
value: {{ .Config.Spec.ParameterSource.NOProxy }}
{{ end }}
- name: PARAMETER_GIT_DIR
value: "/git/parameters"
- name: CLONED_TEMPLATE_GIT_DIR
value: "/git/templates/{{ .Config.Spec.TemplateSource.ContextDir }}"
- name: CLONED_PARAMETER_GIT_DIR
value: "/git/parameters/{{ .Config.Spec.ParameterSource.ContextDir }}"
- name: MANIFEST_DIR
value: "/git/manifests"
- name: CREATE_MODE
value: {{ .Config.Spec.ResourceHandlingMode }}
- name: DELETE_MODE
value: {{ .Config.Spec.ResourceDeletionMode }}
- name: ACTION
value: {{ .Action }}
{{ if .Config.Spec.TemplateSource.SecretRef }}
- name: TEMPLATE_GITCONFIG
value: /template-gitconfig
{{ end }}
{{ if .Config.Spec.ParameterSource.SecretRef }}
- name: PARAMETER_GITCONFIG
value: /parameter-gitconfig
{{ end }}
volumeMounts:
- name: workspace
mountPath: /git
{{ if .Config.Spec.TemplateSource.SecretRef }}
- name: template-gitconfig
mountPath: /template-gitconfig
{{ end }}
{{ if .Config.Spec.ParameterSource.SecretRef }}
- name: parameter-gitconfig
mountPath: /parameter-gitconfig
{{ end }}
volumes:
- name: workspace
emptyDir: {}
{{ if .Config.Spec.TemplateSource.SecretRef }}
- name: template-gitconfig
secret:
secretName: {{ .Config.Spec.TemplateSource.SecretRef }}
{{ end }}
{{ if .Config.Spec.ParameterSource.SecretRef }}
- name: parameter-gitconfig
secret:
secretName: {{ .Config.Spec.ParameterSource.SecretRef }}
{{ end }}
restartPolicy: Never
serviceAccountName: {{ .Config.Spec.ServiceAccountRef }}
backoffLimit: 4