External dependencies config
[oom.git] / kubernetes / policy / charts / drools / templates / deployment.yaml
1 # 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
15 apiVersion: extensions/v1beta1
16 kind: Deployment
17 metadata:
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 }}
25 spec:
26   replicas: {{ .Values.replicaCount }}
27   template:
28     metadata:
29       labels:
30         app: {{ include "common.name" . }}
31         release: {{ .Release.Name }}
32     spec:
33       initContainers:
34       - command:
35         - /root/ready.py
36         args:
37         - --container-name
38         - {{ .Values.global.mariadb.nameOverride }}
39         - --container-name
40         - {{ .Values.global.nexus.nameOverride }}
41         env:
42         - name: NAMESPACE
43           valueFrom:
44             fieldRef:
45               apiVersion: v1
46               fieldPath: metadata.namespace
47         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
48         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
49         name: {{ include "common.name" . }}-readiness
50       hostAliases:
51       - ip: "{{ .Values.aaiServiceClusterIp }}"
52         hostnames:
53         - "aai.api.simpledemo.openecomp.org"
54       containers:
55         - name: {{ include "common.name" . }}
56           image: "{{ .Values.global.repository | default .Values.repository }}/{{ .Values.image }}"
57           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
58           ports:
59           - containerPort: {{ .Values.service.externalPort }}
60           - containerPort: {{ .Values.service.externalPort2 }}
61           command:
62           - /bin/bash
63           - -c
64           - ./do-start.sh
65           {{- if eq .Values.liveness.enabled true }}
66           livenessProbe:
67             tcpSocket:
68               port: {{ .Values.service.externalPort }}
69             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
70             periodSeconds: {{ .Values.liveness.periodSeconds }}
71           {{- end }}
72           readinessProbe:
73             tcpSocket:
74               port: {{ .Values.service.externalPort }}
75             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
76             periodSeconds: {{ .Values.readiness.periodSeconds }}
77           env:
78           - name: REPLICAS
79             value: "{{ .Values.replicaCount }}"
80           volumeMounts:
81           - mountPath: /etc/localtime
82             name: localtime
83             readOnly: true
84           - mountPath: /tmp/policy-install/config/policy-keystore
85             name: drools-secret
86             subPath: policy-keystore
87           - mountPath: /tmp/policy-install/config/feature-healthcheck.conf
88             name: drools-secret
89             subPath: feature-healthcheck.conf
90           - mountPath: /tmp/policy-install/config/base.conf
91             name: drools-config
92             subPath: base.conf
93           - mountPath: /tmp/policy-install/config/policy-management.conf
94             name: drools-config
95             subPath: policy-management.conf
96           - mountPath: /tmp/policy-install/config/drools-tweaks.sh
97             name: drools-config
98             subPath: drools-tweaks.sh
99           - mountPath: /usr/share/maven/conf/settings.xml
100             name: drools-settingsxml
101             subPath: settings.xml
102           - mountPath: /var/log/onap
103             name: policy-logs
104           - mountPath: /tmp/logback.xml
105             name: policy-logback
106             subPath: logback.xml
107           - mountPath: /tmp/policy-install/do-start.sh
108             name: pe-scripts
109             subPath: do-start.sh
110           lifecycle:
111             postStart:
112               exec:
113                 command: ["/bin/sh", "-c", "export LOG=wait_logback.log; touch $LOG; export SRC=/tmp/logback.xml; export DST=/opt/app/policy/config/; while [ ! -e $DST ]; do echo 'Waiting for $DST...' >> $LOG; sleep 5; done; sleep 2; /bin/cp -f $SRC $DST; echo 'Done' >> $LOG"]
114           resources:
115 {{ toYaml .Values.resources | indent 12 }}
116         {{- if .Values.nodeSelector }}
117         - image: "{{ .Values.global.loggingRepository | default .Values.loggingRepository }}/{{ .Values.loggingImage }}"
118           imagePullPolicy: {{ .Values.pullPolicy }}
119           name: filebeat-onap
120           volumeMounts:
121           - mountPath: /usr/share/filebeat/filebeat.yml
122             name: filebeat-conf
123             subPath: filebeat.yml
124           - mountPath: /var/log/onap
125             name: policy-logs
126           - mountPath: /usr/share/filebeat/data
127             name: policy-data-filebeat
128         nodeSelector:
129 {{ toYaml .Values.nodeSelector | indent 10 }}
130         {{- end -}}
131         {{- if .Values.affinity }}
132         affinity:
133 {{ toYaml .Values.affinity | indent 10 }}
134         {{- end }}
135       volumes:
136         - name: localtime
137           hostPath:
138             path: /etc/localtime
139         - name: filebeat-conf
140           configMap:
141             name: {{ .Release.Name }}-filebeat-configmap
142         - name: policy-logs
143           emptyDir: {}
144         - name: policy-data-filebeat
145           emptyDir: {}
146         - name: policy-logback
147           configMap:
148             name: {{ include "common.fullname" . }}-log-configmap
149         - name: drools-settingsxml
150           configMap:
151             name: {{ include "common.fullname" . }}-settings-configmap
152         - name: drools-config
153           configMap:
154             name: {{ include "common.fullname" . }}-configmap
155             items:
156             - key: base.conf
157               path: base.conf
158               mode: 0755
159             - key: policy-management.conf
160               path: policy-management.conf
161               mode: 0755
162             - key: drools-tweaks.sh
163               path: drools-tweaks.sh
164               mode: 0755
165         - name: drools-secret
166           secret:
167             secretName: {{ include "common.fullname" . }}-secret
168             items:
169             - key: policy-keystore
170               path: policy-keystore
171               mode: 0644
172             - key: feature-healthcheck.conf
173               path: feature-healthcheck.conf
174               mode: 0644
175         - name: pe-scripts
176           configMap:
177             name: {{ include "common.fullname" . }}-script-configmap
178             defaultMode: 0777
179       imagePullSecrets:
180       - name: "{{ include "common.namespace" . }}-docker-registry-key"