charts: fix the images format
[pti/o2.git] / charts / templates / deployment.yaml
1 # Copyright (C) 2021 Wind River Systems, Inc.
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 ---
16 apiVersion: apps/v1
17 kind: Deployment
18 metadata:
19   name: o2api
20   namespace: {{ .Values.global.namespace }}
21   labels:
22     app: o2api
23 spec:
24   replicas: 1
25   selector:
26     matchLabels:
27       app: o2api
28   template:
29     metadata:
30       labels:
31         app: o2api
32     spec:
33       serviceAccountName: {{ .Values.o2ims.serviceaccountname }}
34       {{- if .Values.imagePullSecrets }}
35       imagePullSecrets:
36         {{- range .Values.imagePullSecrets }}
37         - name: {{ . }}
38         {{- end }}
39       {{- end }}
40 {{- if .Values.o2ims.affinity }}
41       affinity:
42 {{ toYaml .Values.o2ims.affinity | indent 8 }}
43 {{- end }}
44       containers:
45         - name: postgres
46           image: "{{ .Values.o2ims.images.tags.postgres }}"
47           ports:
48             - containerPort: 5432
49           env:
50             - name: POSTGRES_PASSWORD
51               value: o2ims123
52             - name: POSTGRES_USER
53               value: o2ims
54             - name: PGDATA
55               value: /var/lib/postgresql/data/pgdata
56           command: ["/bin/bash", "/opt/postgres_start.sh"]
57           volumeMounts:
58             - name: scripts
59               mountPath: /opt
60             - name: db-pv
61               mountPath: /var/lib/postgresql/data
62         - name: redis
63           image: "{{ .Values.o2ims.images.tags.redis }}"
64           ports:
65             - containerPort: 6379
66         - name: o2pubsub
67           image: "{{ .Values.o2ims.images.tags.o2service }}"
68           command: ["/bin/bash", "/opt/o2pubsub_start.sh"]
69           env:
70             - name: DB_HOST
71               value: postgres
72             - name: DB_PASSWORD
73               value: o2ims123
74             - name: LOGGING_CONFIG_LEVEL
75               value: {{ .Values.o2ims.logginglevel }}
76             - name: OS_AUTH_URL
77               value: {{ .Values.ocloud.OS_AUTH_URL }}
78             - name: OS_PASSWORD
79               value: {{ .Values.ocloud.OS_PASSWORD }}
80             - name: OS_USERNAME
81               value: {{ .Values.ocloud.OS_USERNAME }}
82             - name: PYTHONDONTWRITEBYTECODE
83               value: "1"
84             - name: REDIS_HOST
85               value: redis
86             - name: K8S_KUBECONFIG
87               value: {{ .Values.ocloud.K8S_KUBECONFIG }}
88           volumeMounts:
89             - name: scripts
90               mountPath: /opt
91             - name: applicationconfig
92               mountPath: /configs/o2app.conf
93               subPath: config.json
94               readOnly: true
95             - name: smocacrt
96               mountPath: /configs/smoca.crt
97               subPath: config.json
98         - name: watcher
99           image: "{{ .Values.o2ims.images.tags.o2service }}"
100           command: ["/bin/bash", "/opt/o2watcher_start.sh"]
101           env:
102             - name: API_HOST_EXTERNAL_FLOATING
103               value: {{ .Values.ocloud.API_HOST_EXTERNAL_FLOATING }}
104             - name: DB_HOST
105               value: postgres
106             - name: DB_PASSWORD
107               value: o2ims123
108             - name: LOGGING_CONFIG_LEVEL
109               value: {{ .Values.o2ims.logginglevel }}
110             - name: OS_AUTH_URL
111               value: {{ .Values.ocloud.OS_AUTH_URL }}
112             - name: OS_PASSWORD
113               value: {{ .Values.ocloud.OS_PASSWORD }}
114             - name: OS_USERNAME
115               value: {{ .Values.ocloud.OS_USERNAME }}
116             - name: PYTHONDONTWRITEBYTECODE
117               value: "1"
118             - name: REDIS_HOST
119               value: redis
120           volumeMounts:
121             - name: scripts
122               mountPath: /opt
123             - name: applicationconfig
124               mountPath: /configs/o2app.conf
125               subPath: config.json
126               readOnly: true
127         - name: o2api
128           image: "{{ .Values.o2ims.images.tags.o2service }}"
129           ports:
130             - containerPort: 80
131           env:
132             - name: API_HOST_EXTERNAL_FLOATING
133               value: {{ .Values.ocloud.API_HOST_EXTERNAL_FLOATING }}
134             - name: DB_HOST
135               value: postgres
136             - name: DB_PASSWORD
137               value: o2ims123
138             - name: FLASK_APP
139               value: /src/o2app/entrypoints/flask_application.py
140             - name: FLASK_DEBUG
141               value: {{ .Values.o2ims.logginglevel }}
142             - name: LOGGING_CONFIG_LEVEL
143               value: {{ .Values.o2ims.logginglevel }}
144             - name: OS_AUTH_URL
145             - name: OS_PASSWORD
146             - name: OS_USERNAME
147             - name: PYTHONDONTWRITEBYTECODE
148               value: "1"
149             - name: PYTHONUNBUFFERED
150               value: "1"
151             - name: REDIS_HOST
152               value: redis
153             - name: HELM_USER_PASSWD
154               value: {{ .Values.ocloud.HELM_USER_PASSWD }}
155           command: ["/bin/bash", "/opt/o2api_start.sh"]
156           volumeMounts:
157             - name: scripts
158               mountPath: /opt
159             # - name: configs
160             #   mountPath: /configs
161             - name: applicationconfig
162               mountPath: /configs/o2app.conf
163               subPath: config.json
164               readOnly: true
165             - name: servercrt
166               mountPath: /configs/server.crt
167               subPath: config.json
168               readOnly: true
169             - name: serverkey
170               mountPath: /configs/server.key
171               subPath: config.json
172               readOnly: true
173         {{- if .Values.o2dms.helm_cli_enable }}
174         - name: helmcli
175           image: "{{ .Values.o2ims.images.tags.o2service }}"
176           ports:
177             - containerPort: 22
178           env:
179             - name: API_HOST_EXTERNAL_FLOATING
180               value: {{ .Values.ocloud.API_HOST_EXTERNAL_FLOATING }}
181             - name: HELM_USER_PASSWD
182               value: {{ .Values.ocloud.HELM_USER_PASSWD }}
183           command: ["/bin/bash", "/opt/o2_helmcli_start.sh"]
184           volumeMounts:
185             - name: scripts
186               mountPath: /opt
187         {{- end }}
188       volumes:
189         - name: scripts
190           configMap:
191             name: {{ .Chart.Name }}-scripts-configmap
192         # - name: configs
193         #   emptyDir: {}
194         - configMap:
195             name: {{ .Chart.Name }}-application-config
196           name: applicationconfig
197         - configMap:
198             name: {{ .Chart.Name }}-serverkey
199           name: serverkey
200         - configMap:
201             name: {{ .Chart.Name }}-servercrt
202           name: servercrt
203         - configMap:
204             name: {{ .Chart.Name }}-smocacrt
205           name: smocacrt
206         - name: db-pv
207           persistentVolumeClaim:
208             claimName: {{ .Chart.Name }}-db-pv
209 ---