blob: 2d4e21360dd3ec658bed7d66be83e60682923620 [file] [log] [blame]
Mandeep Khindab1f9efe2018-03-28 19:01:55 +00001# Copyright © 2017 Amdocs, Bell Canada
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
Mandeep Khindaa1047f42018-03-22 02:12:15 +000015apiVersion: extensions/v1beta1
16kind: Deployment
17metadata:
18 name: {{ include "common.fullname" . }}
19 namespace: {{ include "common.namespace" . }}
20 labels:
21 app: {{ include "common.name" . }}
22 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
23 release: {{ .Release.Name }}
24 heritage: {{ .Release.Service }}
25spec:
26 replicas: {{ .Values.replicaCount }}
27 template:
28 metadata:
29 labels:
30 app: {{ include "common.name" . }}
31 release: {{ .Release.Name }}
32 spec:
33 initContainers:
34 - name: {{ include "common.name" . }}-readiness
35 command:
36 - /root/ready.py
37 args:
38 - --container-name
39 - "sdc-be"
40 env:
41 - name: NAMESPACE
42 valueFrom:
43 fieldRef:
44 apiVersion: v1
45 fieldPath: metadata.namespace
46 image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
47 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
48 containers:
49 - name: {{ include "common.name" . }}
50 image: "{{ .Values.global.repository | default .Values.repository }}/{{ .Values.image }}"
51 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
52 ports:
53 - containerPort: {{ .Values.service.internalPort }}
54 - containerPort: {{ .Values.service.internalPort2 }}
55 # disable liveness probe when breakpoints set in debugger
56 # so K8s doesn't restart unresponsive container
Mandeep Khinda403c1c12018-04-19 23:15:43 +000057 {{ if eq .Values.liveness.enabled true }}
Mandeep Khindaa1047f42018-03-22 02:12:15 +000058 livenessProbe:
59 tcpSocket:
60 port: {{ .Values.service.internalPort }}
61 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
62 periodSeconds: {{ .Values.liveness.periodSeconds }}
Mandeep Khinda403c1c12018-04-19 23:15:43 +000063 {{ end }}
Mandeep Khindaa1047f42018-03-22 02:12:15 +000064 readinessProbe:
65 tcpSocket:
66 port: {{ .Values.service.internalPort }}
67 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
68 periodSeconds: {{ .Values.readiness.periodSeconds }}
69 env:
70 - name: ENVNAME
71 value: {{ .Values.global.env.name }}
72 - name: HOST_IP
73 valueFrom:
74 fieldRef:
75 fieldPath: status.podIP
76 - name: JAVA_OPTIONS
Mandeep Khinda403c1c12018-04-19 23:15:43 +000077 value: {{ .Values.config.javaOptions }}
Mandeep Khindaa1047f42018-03-22 02:12:15 +000078 volumeMounts:
79 - name: {{ include "common.fullname" . }}-environments
80 mountPath: /root/chef-solo/environments/
81 - name: {{ include "common.fullname" . }}-localtime
82 mountPath: /etc/localtime
83 readOnly: true
84 - name: {{ include "common.fullname" . }}-logs
85 mountPath: /var/log/onap
86 - name: {{ include "common.fullname" . }}-logback
87 mountPath: /tmp/logback.xml
88 lifecycle:
89 postStart:
90 exec:
91 command: ["/bin/sh", "-c", "export LOG=wait_logback.log; touch $LOG; export SRC=/tmp/logback.xml; export DST=/var/lib/jetty/config/catalog-fe/; while [ ! -e $DST ]; do echo 'Waiting for $DST...' >> $LOG; sleep 5; done; sleep 2; /bin/cp -f $SRC $DST; echo 'Done' >> $LOG"]
92 resources:
93{{ toYaml .Values.resources | indent 12 }}
94 {{- if .Values.nodeSelector }}
95 nodeSelector:
96{{ toYaml .Values.nodeSelector | indent 10 }}
97 {{- end -}}
98 {{- if .Values.affinity }}
99 affinity:
100{{ toYaml .Values.affinity | indent 10 }}
101 {{- end }}
102
103 # side car containers
104 - name: {{ include "common.name" . }}-filebeat-onap
105 image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
106 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
107 volumeMounts:
108 - name: {{ include "common.fullname" . }}-filebeat-conf
109 mountPath: /usr/share/filebeat/filebeat.yml
110 subPath: filebeat.yml
111 - name: {{ include "common.fullname" . }}-logs
112 mountPath: /var/log/onap
113 - name: {{ include "common.fullname" . }}-data-filebeat
114 mountPath: /usr/share/filebeat/data
115 volumes:
116 - name: {{ include "common.fullname" . }}-localtime
117 hostPath:
118 path: /etc/localtime
119 - name: {{ include "common.fullname" . }}-filebeat-conf
120 configMap:
121 name: {{ .Release.Name }}-sdc-filebeat-configmap
122 - name: {{ include "common.fullname" . }}-data-filebeat
123 emptyDir: {}
124 - name: {{ include "common.fullname" . }}-logback
125 configMap:
126 name : {{ include "common.fullname" . }}-logging-configmap
127 - name: {{ include "common.fullname" . }}-environments
128 configMap:
129 name: {{ .Release.Name }}-sdc-environments-configmap
130 defaultMode: 0755
131 - name: {{ include "common.fullname" . }}-logs
132 emptyDir: {}
133 imagePullSecrets:
134 - name: "{{ include "common.namespace" . }}-docker-registry-key"