10793cafc6cf2c148a704f246a4997b822e1566b
[oom.git] / kubernetes / oof / components / oof-has / components / oof-has-api / templates / deployment.yaml
1 {{/*
2 # Copyright © 2017 Amdocs, Bell Canada
3 # Copyright (C) 2020 Wipro Limited.
4 # Modifications Copyright © 2018 AT&T,VMware
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 #       http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 */}}
18
19 apiVersion: apps/v1
20 kind: Deployment
21 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
22 spec:
23   selector: {{- include "common.selectors" . | nindent 4 }}
24   replicas: {{ .Values.replicaCount }}
25   template:
26     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
27     spec:
28       initContainers:
29       {{ include "common.readinessCheck.waitFor" . | nindent 6 }}
30       containers:
31         - name: {{ include "common.name" . }}
32           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.global.image.optf_has }}
33           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
34           command: ["/bin/sh","-c"]
35           args: ["/usr/local/bin/uwsgi -s /run/conductor/uwsgi.sock --chmod-socket=777 --wsgi-file /etc/nginx/conductor.wsgi --callable application --set port={{ .Values.uwsgi.internalPort }} --die-on-term --exit-on-reload --pidfile /run/conductor/conductor-uwsgi.pid --enable-threads --workers 6 --master --vacuum --single-interpreter --socket-timeout 10 --max-worker-lifetime 300 --max-requests 100 --no-defer-accept --protocol=uwsgi --socket 0.0.0.0:{{ .Values.uwsgi.internalPort }}"]
36           ports:
37           - containerPort: {{ .Values.uwsgi.internalPort }}
38           # disable liveness probe when breakpoints set in debugger
39           # so K8s doesn't restart unresponsive container
40           {{- if .Values.liveness.enabled }}
41           livenessProbe:
42             tcpSocket:
43               port: {{ .Values.uwsgi.internalPort }}
44             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
45             periodSeconds: {{ .Values.liveness.periodSeconds }}
46           {{ end -}}
47           readinessProbe:
48             tcpSocket:
49               port: {{ .Values.uwsgi.internalPort }}
50             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
51             periodSeconds: {{ .Values.readiness.periodSeconds }}
52           env: {{ include "oof.etcd.env" . | nindent 10 }}
53           volumeMounts:
54           - mountPath: /etc/localtime
55             name: localtime
56             readOnly: true
57           - mountPath: /usr/local/etc/conductor/conductor.conf
58             name: {{ .Values.global.commonConfigPrefix }}-config
59             subPath: conductor.conf
60           - mountPath: /usr/local/bin/log.conf
61             name: {{ .Values.global.commonConfigPrefix  }}-config
62             subPath: log.conf
63           resources:
64 {{ include "common.resources" . | indent 12 }}
65         - name: {{ include "common.name" . }}-nginx
66           image: {{ include "repositoryGenerator.image.nginx" . }}
67           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
68           command:
69           - /bin/sh
70           args:
71           - "-c"
72           - |
73             /opt/bitnami/scripts/nginx/entrypoint.sh /opt/bitnami/scripts/nginx/run.sh
74           ports:
75           - containerPort: {{ .Values.service.internalPort }}
76             name: http
77           {{- if .Values.liveness.enabled }}
78           livenessProbe:
79             tcpSocket:
80               port: {{ .Values.service.internalPort }}
81             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
82             periodSeconds: {{ .Values.liveness.periodSeconds }}
83           {{ end -}}
84           readinessProbe:
85             tcpSocket:
86               port: {{ .Values.service.internalPort }}
87             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
88             periodSeconds: {{ .Values.readiness.periodSeconds }}
89           volumeMounts:
90           - mountPath: /etc/localtime
91             name: localtime
92             readOnly: true
93           - mountPath: /opt/bitnami/nginx/conf/nginx.conf
94             name: {{ .Values.global.commonConfigPrefix  }}-config
95             subPath: nginx.conf
96           resources:
97 {{ include "common.resources" . | indent 12 }}
98         {{- if .Values.nodeSelector }}
99         nodeSelector:
100 {{ toYaml .Values.nodeSelector | indent 10 }}
101         {{- end -}}
102         {{- if .Values.affinity }}
103         affinity:
104 {{ toYaml .Values.affinity | indent 10 }}
105         {{- end }}
106       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
107       volumes:
108         - name: localtime
109           hostPath:
110             path: /etc/localtime
111         - name: {{ .Values.global.commonConfigPrefix }}-config
112           configMap:
113             name: {{ .Values.global.commonConfigPrefix  }}-configmap
114             items:
115             - key: nginx.conf
116               path: nginx.conf
117             - key: conductor.conf
118               path: conductor.conf
119             - key: log.conf
120               path: log.conf
121       imagePullSecrets:
122       - name: "{{ include "common.namespace" . }}-docker-registry-key"