1+ {{ $cfCommonTplSemver := printf "cf-common-%s" (index .Subcharts "cf-common").Chart.Version }}
12apiVersion : batch/v1
23kind : Job
34metadata :
@@ -6,64 +7,87 @@ metadata:
67 labels :
78 {{- include "csdp-add-cluster.labels" . | nindent 4 }}
89spec :
9- ttlSecondsAfterFinished : 600 # stick around for 10m
10+ {{- with .Values.ttlSecondsAfterFinished }}
11+ ttlSecondsAfterFinished : {{ . }}
12+ {{- end }}
13+ {{- with .Values.backoffLimit }}
14+ backoffLimit : {{ .}}
15+ {{- end }}
1016 template :
1117 metadata :
1218 name : {{ include "csdp-add-cluster.fullname" . }}-pod
19+ labels :
20+ {{- include "csdp-add-cluster.labels" . | nindent 8 }}
1321 spec :
14- serviceAccount : {{ include "csdp-add-cluster.serviceAccount" . }}
15- restartPolicy : Never
22+ {{- include (printf "%s.image.pullSecrets" $cfCommonTplSemver ) . | nindent 8 }}
23+ serviceAccount : {{ include "csdp-add-cluster.serviceAccountName" . }}
24+ securityContext :
25+ {{- toYaml .Values.podSecurityContext | nindent 8 }}
1626 containers :
1727 - name : main
18- image : " quay.io/codefresh/csdp-add-cluster: {{ .Chart.AppVersion }} "
19- imagePullPolicy : Always
28+ image : {{ include (printf "%v.tplrender" $cfCommonTplSemver) (dict "Values" (include (printf "%s.image.name" $cfCommonTplSemver ) (dict "image" .Values.image "context" .)) "context" .) }}
29+ imagePullPolicy : {{ .Values.image.pullPolicy | default " Always" }}
2030 command :
2131 - bash
2232 args :
2333 - ./add-cluster.sh
2434 env :
25- - name : SERVICE_ACCOUNT_NAME
26- valueFrom :
27- fieldRef :
28- fieldPath : spec.serviceAccountName
29- - name : INGRESS_URL
30- valueFrom :
31- configMapKeyRef :
32- name : {{ include "csdp-add-cluster.fullname" . }}-cm
33- key : ingressUrl
34- - name : CSDP_TOKEN
35- valueFrom :
36- secretKeyRef :
37- name : {{ include "csdp-add-cluster.fullname" . }}-secret
38- key : csdpToken
39- - name : CONTEXT_NAME
40- valueFrom :
41- configMapKeyRef :
42- name : {{ include "csdp-add-cluster.fullname" . }}-cm
43- key : contextName
44- - name : SERVER
45- valueFrom :
46- configMapKeyRef :
47- name : {{ include "csdp-add-cluster.fullname" . }}-cm
48- key : server
49- - name : CSDP_TOKEN_SECRET
50- value : {{ include "csdp-add-cluster.fullname" . }}-secret
35+ - name : SERVICE_ACCOUNT_NAME
36+ valueFrom :
37+ fieldRef :
38+ fieldPath : spec.serviceAccountName
39+ - name : INGRESS_URL
40+ valueFrom :
41+ configMapKeyRef :
42+ name : {{ include "csdp-add-cluster.fullname" . }}-cm
43+ key : ingressUrl
44+ - name : CSDP_TOKEN
45+ {{- include "csdp-add-cluster.token-env-var-value" . | indent 12 }}
46+ - name : CONTEXT_NAME
47+ valueFrom :
48+ configMapKeyRef :
49+ name : {{ include "csdp-add-cluster.fullname" . }}-cm
50+ key : contextName
51+ - name : SERVER
52+ valueFrom :
53+ configMapKeyRef :
54+ name : {{ include "csdp-add-cluster.fullname" . }}-cm
55+ key : server
56+ - name : CSDP_TOKEN_SECRET
57+ value : {{ include "csdp-add-cluster.fullname" . }}-secret
58+ {{- include (printf "%s.env-vars" $cfCommonTplSemver) (dict "Values" .Values.env "context" .) | nindent 10 }}
5159 volumeMounts :
52- - name : config-volume
53- mountPath : /etc/config
60+ - name : config-volume
61+ mountPath : /etc/config
62+ {{- with .Values.extraVolumeMounts }}
63+ {{- toYaml . | nindent 10 }}
64+ {{- end }}
65+ {{- with .Values.resources }}
5466 resources :
55- limits :
56- memory : 512Mi
57- cpu : ' 1'
58- requests :
59- memory : 256Mi
60- cpu : ' 0.2'
67+ {{- toYaml . | nindent 12 }}
68+ {{- end }}
6169 volumes :
62- - name : config-volume
63- configMap :
64- name : {{ include "csdp-add-cluster.fullname" . }}-cm
65- items :
66- - key : annotations
67- path : annotations.yaml
68- - key : labels
69- path : labels.yaml
70+ - name : config-volume
71+ configMap :
72+ name : {{ include "csdp-add-cluster.fullname" . }}-cm
73+ items :
74+ - key : annotations
75+ path : annotations.yaml
76+ - key : labels
77+ path : labels.yaml
78+ {{- with .Values.extraVolumes }}
79+ {{- toYaml . | nindent 6 }}
80+ {{- end }}
81+ {{- with .Values.nodeSelector }}
82+ nodeSelector :
83+ {{- toYaml . | nindent 8 }}
84+ {{- end }}
85+ {{- with .Values.affinity }}
86+ affinity :
87+ {{- toYaml . | nindent 8 }}
88+ {{- end }}
89+ {{- with .Values.tolerations }}
90+ tolerations :
91+ {{- toYaml . | nindent 6 }}
92+ {{- end }}
93+ restartPolicy : OnFailure
0 commit comments