[MODELING]Modify the owner of static directory to onap instead of root
[oom.git] / kubernetes / modeling / charts / modeling-etsicatalog / 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: {{ include "common.release" . }}
24     heritage: {{ .Release.Service }}
25 spec:
26   replicas: {{ .Values.replicaCount }}
27   template:
28     metadata:
29       labels:
30         app: {{ include "common.name" . }}
31         release: {{ include "common.release" . }}
32       annotations:
33         sidecar.istio.io/inject: "{{.Values.istioSidecar}}"
34     spec:
35       initContainers:
36       - command:
37         - /root/ready.py
38         args:
39         - --container-name
40         - modeling-mariadb
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       - command:
51         - /bin/sh
52         - -c
53         - chown -R 1000:1000 /service/modeling/etsicatalog/static
54         image: "{{ include "common.repository" . }}/{{ .Values.initImage }}"
55         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
56         name: {{ include "common.name" . }}-init
57         volumeMounts:
58         - name: {{ include "common.fullname" . }}-etsicatalog
59           mountPath: /service/modeling/etsicatalog/static
60       containers:
61         - name: {{ include "common.name" . }}
62           command:
63             - bash
64           args:
65             - -c
66             - 'MYSQL_AUTH=root:${MYSQL_ROOT_PASSWORD} ./docker-entrypoint.sh'
67           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
68           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
69           ports:
70           - containerPort: {{ .Values.service.internalPort }}
71           # disable liveness probe when breakpoints set in debugger
72           # so K8s doesn't restart unresponsive container
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           env:
86           - name: MSB_PROTO
87             value: "{{ .Values.global.config.msbProtocol }}"
88           - name: SSL_ENABLED
89             value: "{{ .Values.global.config.ssl_enabled }}"
90           - name: MSB_ADDR
91             value: "{{ .Values.global.config.msbServiceName }}:{{ .Values.global.config.msbPort }}"
92           - name: MYSQL_ADDR
93             value: {{ (index .Values "mariadb-galera" "service" "name") }}:{{ (index .Values "mariadb-galera" "service" "internalPort") }}
94           - name: MYSQL_ROOT_PASSWORD
95             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-root-pass" "key" "password") | indent 12}}
96           volumeMounts:
97           - name: {{ include "common.fullname" . }}-etsicatalog
98             mountPath: /service/modeling/etsicatalog/static
99           - name: {{ include "common.fullname" . }}-localtime
100             mountPath: /etc/localtime
101             readOnly: true
102           - name: {{ include "common.fullname" . }}-logs
103             mountPath: /var/log/onap
104           - name: {{ include "common.fullname" . }}-logconfig
105             mountPath: /opt/modeling/etsicatalog/config/log.yml
106             subPath: log.yml
107           resources:
108 {{ include "common.resources" . | indent 12 }}
109         {{- if .Values.nodeSelector }}
110         nodeSelector:
111 {{ toYaml .Values.nodeSelector | indent 10 }}
112         {{- end -}}
113         {{- if .Values.affinity }}
114         affinity:
115 {{ toYaml .Values.affinity | indent 10 }}
116         {{- end }}
117
118         # side car containers
119         - name: {{ include "common.name" . }}-filebeat-onap
120           image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
121           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
122           volumeMounts:
123           - name: {{ include "common.fullname" . }}-filebeat-conf
124             mountPath: /usr/share/filebeat/filebeat.yml
125             subPath: filebeat.yml
126           - name: {{ include "common.fullname" . }}-logs
127             mountPath: /var/log/onap
128           - name: {{ include "common.fullname" . }}-data-filebeat
129             mountPath: /usr/share/filebeat/data
130
131       volumes:
132         - name: {{ include "common.fullname" . }}-etsicatalog
133         {{- if .Values.persistence.enabled }}
134           persistentVolumeClaim:
135             claimName: {{ include "common.fullname" . }}
136         {{- else }}
137           emptyDir: {}
138         {{- end }}
139         - name: {{ include "common.fullname" . }}-localtime
140           hostPath:
141             path: /etc/localtime
142         - name:  {{ include "common.fullname" . }}-logs
143           emptyDir: {}
144         - name: {{ include "common.fullname" . }}-logconfig
145           configMap:
146             name : {{ include "common.fullname" . }}-logging-configmap
147
148         - name: {{ include "common.fullname" . }}-filebeat-conf
149           configMap:
150             name: {{ include "common.release" . }}-modeling-filebeat-configmap
151         - name: {{ include "common.fullname" . }}-data-filebeat
152           emptyDir: {}
153       imagePullSecrets:
154       - name: "{{ include "common.namespace" . }}-docker-registry-key"