Merge "Ensure sdnctl user/schema created on master MySQL"
[oom.git] / kubernetes / aai / charts / aai-data-router / 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   selector:
28     matchLabels:
29       app: {{ include "common.name" . }}
30   template:
31     metadata:
32       labels:
33         app: {{ include "common.name" . }}
34         release: {{ .Release.Name }}
35       name: {{ include "common.name" . }}
36     spec:
37       initContainers:
38       - command:
39         - /bin/sh
40         - -c
41         - |
42           mkdir -p /logroot/data-router/logs
43           chmod -R 777 /logroot/data-router/logs
44           chown -R root:root /logroot
45         env:
46         - name: NAMESPACE
47           valueFrom:
48             fieldRef:
49               apiVersion: v1
50               fieldPath: metadata.namespace
51         securityContext:
52           privileged: true
53         image: {{ .Values.global.dockerhubRepository | default .Values.dockerhubRepository }}/{{ .Values.global.busyboxImage | default .Values.busyboxImage }}
54         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
55         name: init-sysctl
56         volumeMounts:
57         - name: {{ include "common.fullname" . }}-logs
58           mountPath: /logroot/
59       - name: {{ include "common.name" . }}-inject-models
60         command:
61         - /bin/bash
62         - "-c"
63         - |
64           git clone -b {{ .Values.config.gerritBranch }} --single-branch {{ .Values.config.gerritProject }} /tmp/gerrit
65           cp -rp /tmp/gerrit/data-router/appconfig/model/* /model-dir
66         image: "{{ .Values.global.repository | default .Values.dockerHubRepository }}/{{ .Values.ubuntuInitImage }}"
67         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
68         volumeMounts:
69         - name: modeldir
70           mountPath: "/model-dir"
71       containers:
72       - name: {{ include "common.name" . }}
73         image: "{{ .Values.global.repository | default .Values.repository }}/{{ .Values.image }}"
74         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
75         env:
76         - name: SERVICE_BEANS
77           value: /opt/app/data-router/dynamic/conf
78         - name: CONFIG_HOME
79           value: /opt/app/data-router/config/
80         - name: KEY_STORE_PASSWORD
81           value: {{ .Values.config.keyStorePassword }}
82         - name: DYNAMIC_ROUTES
83           value: /opt/app/data-router/dynamic/routes
84         - name: KEY_MANAGER_PASSWORD
85           value: {{ .Values.config.keyManagerPassword }}
86         - name: PATH
87           value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
88         - name: JAVA_HOME
89           value: usr/lib/jvm/java-8-openjdk-amd64
90         volumeMounts:
91         - mountPath: /etc/localtime
92           name: localtime
93           readOnly: true
94         - mountPath:  /opt/app/data-router/config/auth
95           name: {{ include "common.fullname" . }}-auth
96         - mountPath:  /opt/app/data-router/config/data-router.properties
97           name: {{ include "common.fullname" . }}-properties
98           subPath: data-router.properties
99         - mountPath: /opt/app/data-router/dynamic/routes/entity-event.route
100           subPath: entity-event.route
101           name: {{ include "common.fullname" . }}-dynamic-route
102         - mountPath: /opt/app/data-router/dynamic/conf/entity-event-policy.xml
103           subPath: entity-event-policy.xml
104           name: {{ include "common.fullname" . }}-dynamic-policy
105         - mountPath: /logs/
106           name: {{ include "common.fullname" . }}-logs
107         - name: modeldir
108           mountPath: /opt/app/data-router/config/model
109         ports:
110         - containerPort: {{ .Values.service.internalPort }}
111         {{- if eq .Values.liveness.enabled true }}
112         livenessProbe:
113           tcpSocket:
114             port: {{ .Values.service.internalPort }}
115           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
116           periodSeconds: {{ .Values.liveness.periodSeconds }}
117         {{ end -}}
118         readinessProbe:
119           tcpSocket:
120             port: {{ .Values.service.internalPort }}
121           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
122           periodSeconds: {{ .Values.readiness.periodSeconds }}
123       volumes:
124       - name: localtime
125         hostPath:
126           path: /etc/localtime
127       - name: {{ include "common.fullname" . }}-auth
128         secret:
129           secretName: {{ include "common.fullname" . }}
130       - name: {{ include "common.fullname" . }}-properties
131         configMap:
132           name: {{ include "common.fullname" . }}-prop
133       - name: {{ include "common.fullname" . }}-dynamic-route
134         configMap:
135           name: {{ include "common.fullname" . }}-dynamic
136       - name: {{ include "common.fullname" . }}-dynamic-policy
137         configMap:
138           name: {{ include "common.fullname" . }}-dynamic
139       - name: {{ include "common.fullname" . }}-logs
140         hostPath:
141           path: {{ .Values.persistence.mountPath }}/{{ include "common.namespace" . }}/{{ .Values.persistence.mountSubPath }}
142       - name: modeldir
143         emptyDir: {}
144       restartPolicy: {{ .Values.global.restartPolicy | default .Values.restartPolicy }}
145       imagePullSecrets:
146       - name: "{{ include "common.namespace" . }}-docker-registry-key"