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