This repository has been archived by the owner on Mar 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
/
cronjob.yaml
121 lines (121 loc) · 4.47 KB
/
cronjob.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: gitopsconfig-{{ .Config.ObjectMeta.Name }}
namespace: {{ .Config.ObjectMeta.Namespace }}
spec:
concurrencyPolicy: Forbid
startingDeadlineSeconds: 60
schedule: "{{ getCron .Config }}"
jobTemplate:
metadata:
labels:
gitopsconfig.eunomia.kohls.io/jobOwner: "{{ .Config.ObjectMeta.Name }}"
spec:
template:
spec:
containers:
- name: template-processor
imagePullPolicy: IfNotPresent
image: {{ .Config.Spec.TemplateProcessorImage }}
env:
- 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 }}
{{ if .Config.Spec.TemplateProcessorArgs }}
- name: TEMPLATE_PROCESSOR_ARGS
value: {{ .Config.Spec.TemplateProcessorArgs }}
{{ 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: create
{{ 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 }}
resources:
requests:
cpu: '200m'
memory: '256Mi'
limits:
cpu: '1'
memory: '256Mi'
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