369c4f1ae966b4579b4e325c12a131f23750f72b
[it/otf.git] / otf-ssh-test-head / helm / otf-ssh-test-head / templates / deployment.yaml
1 apiVersion: extensions/v1beta1\r
2 kind: Deployment\r
3 metadata:\r
4   name: {{ .Values.appName}}\r
5   namespace: {{.Values.namespace}}\r
6   labels:\r
7     app: {{ .Values.appName}}\r
8     version: {{.Values.version}}\r
9 spec:\r
10   revisionHistoryLimit: 1\r
11   minReadySeconds: 10\r
12   strategy:\r
13   # indicate which strategy we want for rolling update\r
14     type: RollingUpdate\r
15     rollingUpdate:\r
16       maxSurge: 0\r
17       maxUnavailable: 1\r
18   replicas: {{ .Values.replicas}}\r
19   selector:\r
20     matchLabels:\r
21       app: {{ .Values.appName}}\r
22       version: {{.Values.version}}\r
23   template:\r
24     metadata:\r
25       labels:\r
26         app: {{ .Values.appName}}\r
27         version: {{.Values.version}}\r
28     spec:\r
29       serviceAccount: default\r
30       volumes:\r
31       - name: {{ .Values.appName}}-cert-volume\r
32         secret:\r
33           secretName: {{.Values.sharedCert}}\r
34           optional: true\r
35           items:\r
36           - key: PEM_CERT\r
37             path: otf.pem\r
38           - key: PEM_KEY\r
39             path: privateKey.pem\r
40       - name: {{ .Values.appName}}-ssh-volume\r
41         secret:\r
42           secretName: {{.Values.appName}}\r
43           optional: true\r
44           items:\r
45           - key: id_private_key\r
46             path: id_otf.key\r
47       {{ if or (eq .Values.env "st") (eq .Values.env "prod-dr")}}\r
48       {{else}}\r
49       - name: logging-pvc\r
50         persistentVolumeClaim:\r
51           {{if eq .Values.env "prod"}}\r
52           claimName: {{ .Values.pvc.prod | quote }}\r
53           {{ else }}\r
54           claimName: {{ .Values.pvc.dev | quote }}\r
55           {{ end }}\r
56       {{end}}\r
57       containers:\r
58       - name: {{ .Values.appName}}\r
59         image: {{ .Values.image}}\r
60         imagePullPolicy: Always\r
61         ports:\r
62         - name: http\r
63           containerPort: 5000\r
64           nodePort: {{.Values.nodePort}}\r
65           protocol: TCP\r
66         {{ if eq .Values.env "st"}}\r
67         resources:\r
68           limits: \r
69             memory: "2Gi"\r
70             cpu: "1"\r
71           requests:\r
72             memory: "1Gi"\r
73             cpu: "500m"\r
74         {{else}}   \r
75         resources:\r
76           limits:\r
77             memory: "4Gi"\r
78             cpu: "2"\r
79           requests:\r
80             memory: "1Gi"\r
81             cpu: "1"\r
82         {{end}}\r
83         env:\r
84         - name: NAMESPACE\r
85           value: {{.Values.namespace}}\r
86         - name: APP_NAME\r
87           value: {{ .Values.appName}}\r
88         - name: APP_VERSION\r
89           value: {{.Values.version}}\r
90         - name: id_private_key_passphrase\r
91           valueFrom:\r
92             secretKeyRef:\r
93               name: {{ .Values.appName}}\r
94               key: id_private_key_passphrase\r
95               optional: true\r
96         volumeMounts:\r
97         - name: {{.Values.appName}}-cert-volume\r
98           mountPath: /opt/cert\r
99         - name: {{.Values.appName}}-ssh-volume\r
100           mountPath: /ssh      \r
101         {{ if or (eq .Values.env "st") (eq .Values.env "prod-dr")}}\r
102         {{else}}\r
103         - name: logging-pvc\r
104           mountPath: "/otf/logs"\r
105         {{end}}  \r
106         livenessProbe:\r
107           httpGet:\r
108             path: {{.Values.health}}\r
109             port: http\r
110             scheme: HTTPS\r
111             httpHeaders:\r
112               - name: X-Custom-Header\r
113                 value: Alive\r
114           initialDelaySeconds: 30\r
115           timeoutSeconds: 30\r
116           periodSeconds: 30\r
117         readinessProbe:\r
118           httpGet:\r
119             path: {{.Values.health}}\r
120             port: http\r
121             scheme: HTTPS\r
122             httpHeaders:\r
123               - name: X-Custom-Header\r
124                 value: Ready\r
125           initialDelaySeconds: 30\r
126           timeoutSeconds: 30\r
127           periodSeconds: 30\r
128       restartPolicy: Always\r