Merge "[AAI] Add model-loader tracing config"
[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: /usr/local/etc/conductor/conductor.conf
55             name: {{ .Values.global.commonConfigPrefix }}-config
56             subPath: conductor.conf
57           - mountPath: /usr/local/bin/log.conf
58             name: {{ .Values.global.commonConfigPrefix  }}-config
59             subPath: log.conf
60           resources: {{ include "common.resources" . | nindent 12 }}
61         - name: {{ include "common.name" . }}-nginx
62           image: {{ include "repositoryGenerator.image.nginx" . }}
63           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
64           command:
65           - /bin/sh
66           args:
67           - "-c"
68           - |
69             /opt/bitnami/scripts/nginx/entrypoint.sh /opt/bitnami/scripts/nginx/run.sh
70           ports:
71           - containerPort: {{ .Values.service.internalPort }}
72             name: http
73           {{- if .Values.liveness.enabled }}
74           livenessProbe:
75             tcpSocket:
76               port: {{ .Values.service.internalPort }}
77             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
78             periodSeconds: {{ .Values.liveness.periodSeconds }}
79           {{ end -}}
80           readinessProbe:
81             tcpSocket:
82               port: {{ .Values.service.internalPort }}
83             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
84             periodSeconds: {{ .Values.readiness.periodSeconds }}
85           volumeMounts:
86           - mountPath: /opt/bitnami/nginx/conf/nginx.conf
87             name: {{ .Values.global.commonConfigPrefix  }}-config
88             subPath: nginx.conf
89           resources: {{ include "common.resources" . | nindent 12 }}
90         {{- if .Values.nodeSelector }}
91         nodeSelector:
92 {{ toYaml .Values.nodeSelector | indent 10 }}
93         {{- end -}}
94         {{- if .Values.affinity }}
95         affinity:
96 {{ toYaml .Values.affinity | indent 10 }}
97         {{- end }}
98       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
99       volumes:
100         - name: {{ .Values.global.commonConfigPrefix }}-config
101           configMap:
102             name: {{ .Values.global.commonConfigPrefix  }}-configmap
103             items:
104             - key: nginx.conf
105               path: nginx.conf
106             - key: conductor.conf
107               path: conductor.conf
108             - key: log.conf
109               path: log.conf
110       {{- include "common.imagePullSecrets" . | nindent 6 }}