@@ -3,38 +3,123 @@ kind: Deployment
33metadata :
44 name : {{ include "provenance.fullname" . }}
55 labels :
6- app.kubernetes.io/name : {{ include "provenance.name" . }}
7- helm.sh/chart : {{ include "provenance.chart" . }}
8- app.kubernetes.io/instance : {{ .Release.Name }}
9- app.kubernetes.io/managed-by : {{ .Release.Service }}
6+ {{- include "provenance.labels" . | nindent 4 }}
107spec :
11- replicas : {{ .Values.replicas | default 1 }}
8+ {{- if not .Values.autoscaling.enabled }}
9+ replicas : {{ .Values.replicaCount }}
10+ {{- end }}
1211 selector :
1312 matchLabels :
14- app.kubernetes.io/name : {{ include "provenance.name" . }}
15- app.kubernetes.io/instance : {{ .Release.Name }}
13+ {{- include "provenance.selectorLabels" . | nindent 6 }}
1614 template :
1715 metadata :
1816 labels :
19- app.kubernetes.io/name : {{ include "provenance.name" . }}
20- app.kubernetes.io/instance : {{ .Release.Name }}
17+ {{- include "provenance.selectorLabels" . | nindent 8 }}
18+ {{- with .Values.podLabels }}
19+ {{- toYaml . | nindent 8 }}
20+ {{- end }}
21+ {{- with .Values.podAnnotations }}
22+ annotations :
23+ {{- toYaml . | nindent 8 }}
24+ {{- end }}
2125 spec :
26+ serviceAccountName : {{ include "provenance.serviceAccountName" . }}
27+ {{- with .Values.imagePullSecrets }}
28+ imagePullSecrets :
29+ {{- toYaml . | nindent 8 }}
30+ {{- end }}
31+ {{- with .Values.podSecurityContext }}
32+ securityContext :
33+ {{- toYaml . | nindent 8 }}
34+ {{- end }}
35+ {{- if .Values.redis.enabled }}
36+ initContainers :
37+ - name : wait-for-redis
38+ image : busybox:1.36
39+ command :
40+ - sh
41+ - -c
42+ - >
43+ until nc -z {{ include "provenance.redisFullname" . }} {{ .Values.redis.service.port }};
44+ do echo "waiting for redis";
45+ sleep 2;
46+ done
47+ {{- end }}
2248 containers :
2349 - name : provenance
2450 image : " {{ .Values.image.repository }}:{{ .Values.image.tag }}"
2551 imagePullPolicy : {{ .Values.image.pullPolicy }}
52+ {{- with .Values.securityContext }}
53+ securityContext :
54+ {{- toYaml . | nindent 12 }}
55+ {{- end }}
2656 ports :
2757 - name : http
2858 containerPort : 8000
59+ {{- $envMap := .Values.env | default dict }}
60+ {{- $extraEnvList := .Values.extraEnv | default (list) }}
61+ {{- $hasExtraEnv := gt (len $extraEnvList) 0 }}
62+ {{- $needsRedisEnv := and .Values.redis.enabled (not (hasKey $envMap "PROVENANCE_REDIS_URL")) }}
63+ {{- if or (gt (len $envMap) 0) $hasExtraEnv $needsRedisEnv }}
2964 env :
30- {{- range $key, $value := .Values.env }}
65+ {{- range $key, $value := $envMap }}
3166 - name : {{ $key }}
3267 value : " {{ $value }}"
3368 {{- end }}
34- resources : {{ toYaml .Values.resources | nindent 12 }}
35- {{- if .Values.redis.enabled }}
36- initContainers :
37- - name : wait-for-redis
38- image : busybox
39- command : ['sh', '-c', 'until nc -z redis 6379; do sleep 1; done']
69+ {{- if $needsRedisEnv }}
70+ - name : PROVENANCE_REDIS_URL
71+ value : " redis://{{ include " provenance.redisFullname" . }}:{{ .Values.redis.service.port }}/0"
72+ {{- end }}
73+ {{- range $extraEnvList }}
74+ - name : {{ .name }}
75+ value : " {{ .value }}"
76+ {{- end }}
77+ {{- end }}
78+ {{- with .Values.extraEnvFrom }}
79+ envFrom :
80+ {{- toYaml . | nindent 12 }}
81+ {{- end }}
82+ {{- if .Values.livenessProbe.enabled }}
83+ livenessProbe :
84+ httpGet :
85+ path : {{ .Values.livenessProbe.path }}
86+ port : http
87+ initialDelaySeconds : {{ .Values.livenessProbe.initialDelaySeconds }}
88+ periodSeconds : {{ .Values.livenessProbe.periodSeconds }}
89+ timeoutSeconds : {{ .Values.livenessProbe.timeoutSeconds }}
90+ failureThreshold : {{ .Values.livenessProbe.failureThreshold }}
91+ {{- end }}
92+ {{- if .Values.readinessProbe.enabled }}
93+ readinessProbe :
94+ httpGet :
95+ path : {{ .Values.readinessProbe.path }}
96+ port : http
97+ initialDelaySeconds : {{ .Values.readinessProbe.initialDelaySeconds }}
98+ periodSeconds : {{ .Values.readinessProbe.periodSeconds }}
99+ timeoutSeconds : {{ .Values.readinessProbe.timeoutSeconds }}
100+ failureThreshold : {{ .Values.readinessProbe.failureThreshold }}
101+ {{- end }}
102+ {{- with .Values.extraVolumeMounts }}
103+ volumeMounts :
104+ {{- toYaml . | nindent 12 }}
105+ {{- end }}
106+ {{- with .Values.resources }}
107+ resources :
108+ {{- toYaml . | nindent 12 }}
109+ {{- end }}
110+ {{- with .Values.extraVolumes }}
111+ volumes :
112+ {{- toYaml . | nindent 8 }}
113+ {{- end }}
114+ {{- with .Values.nodeSelector }}
115+ nodeSelector :
116+ {{- toYaml . | nindent 8 }}
117+ {{- end }}
118+ {{- with .Values.affinity }}
119+ affinity :
120+ {{- toYaml . | nindent 8 }}
121+ {{- end }}
122+ {{- with .Values.tolerations }}
123+ tolerations :
124+ {{- toYaml . | nindent 8 }}
40125 {{- end }}
0 commit comments