Merge "Support register to smo with https/tls protocol."
[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       # imagePullSecrets:
35       #   - name: {{ .Values.o2ims.imagePullSecrets }}
36       imagePullSecrets:
37         - name: {{ .Values.o2ims.serviceaccountname }}-registry-secret
38 {{- if .Values.o2ims.affinity }}
39       affinity:
40 {{ toYaml .Values.o2ims.affinity | indent 8 }}
41 {{- end }}
42       containers:
43         - name: postgres
44           image: postgres:9.6
45           ports:
46             - containerPort: 5432
47           env:
48             - name: POSTGRES_PASSWORD
49               value: o2ims123
50             - name: POSTGRES_USER
51               value: o2ims
52           command: ["/bin/bash", "/opt/postgres_start.sh"]
53           volumeMounts:
54             - name: scripts
55               mountPath: /opt
56         - name: redis
57           image: redis:alpine
58           ports:
59             - containerPort: 6379
60         - name: o2pubsub
61           image: "{{ .Values.o2ims.image.repository }}:{{ .Values.o2ims.image.tag }}"
62           command: ["/bin/bash", "/opt/o2pubsub_start.sh"]
63           env:
64             - name: DB_HOST
65               value: postgres
66             - name: DB_PASSWORD
67               value: o2ims123
68             - name: LOGGING_CONFIG_LEVEL
69               value: {{ .Values.o2ims.logginglevel }}
70             - name: OS_AUTH_URL
71               value: {{ .Values.ocloud.OS_AUTH_URL }}
72             - name: OS_PASSWORD
73               value: {{ .Values.ocloud.OS_PASSWORD }}
74             - name: OS_USERNAME
75               value: {{ .Values.ocloud.OS_USERNAME }}
76             - name: PYTHONDONTWRITEBYTECODE
77               value: "1"
78             - name: REDIS_HOST
79               value: redis
80             - name: K8S_KUBECONFIG
81               value: {{ .Values.ocloud.K8S_KUBECONFIG }}
82           volumeMounts:
83             - name: scripts
84               mountPath: /opt
85             - name: applicationconfig
86               mountPath: /configs/o2app.conf
87               subPath: config.json
88               readOnly: true
89             - name: smocacrt
90               mountPath: /configs/smoca.crt
91               subPath: config.json
92         - name: watcher
93           image: "{{ .Values.o2ims.image.repository }}:{{ .Values.o2ims.image.tag }}"
94           command: ["/bin/bash", "/opt/o2watcher_start.sh"]
95           env:
96             - name: API_HOST_EXTERNAL_FLOATING
97               value: {{ .Values.ocloud.API_HOST_EXTERNAL_FLOATING }}
98             - name: DB_HOST
99               value: postgres
100             - name: DB_PASSWORD
101               value: o2ims123
102             - name: LOGGING_CONFIG_LEVEL
103               value: {{ .Values.o2ims.logginglevel }}
104             - name: OS_AUTH_URL
105               value: {{ .Values.ocloud.OS_AUTH_URL }}
106             - name: OS_PASSWORD
107               value: {{ .Values.ocloud.OS_PASSWORD }}
108             - name: OS_USERNAME
109               value: {{ .Values.ocloud.OS_USERNAME }}
110             - name: PYTHONDONTWRITEBYTECODE
111               value: "1"
112             - name: REDIS_HOST
113               value: redis
114           volumeMounts:
115             - name: scripts
116               mountPath: /opt
117             - name: applicationconfig
118               mountPath: /configs/o2app.conf
119               subPath: config.json
120               readOnly: true
121         - name: o2api
122           image: "{{ .Values.o2ims.image.repository }}:{{ .Values.o2ims.image.tag }}"
123           ports:
124             - containerPort: 80
125           env:
126             - name: API_HOST_EXTERNAL_FLOATING
127               value: {{ .Values.ocloud.API_HOST_EXTERNAL_FLOATING }}
128             - name: DB_HOST
129               value: postgres
130             - name: DB_PASSWORD
131               value: o2ims123
132             - name: FLASK_APP
133               value: /src/o2app/entrypoints/flask_application.py
134             - name: FLASK_DEBUG
135               value: {{ .Values.o2ims.logginglevel }}
136             - name: LOGGING_CONFIG_LEVEL
137               value: {{ .Values.o2ims.logginglevel }}
138             - name: OS_AUTH_URL
139             - name: OS_PASSWORD
140             - name: OS_USERNAME
141             - name: PYTHONDONTWRITEBYTECODE
142               value: "1"
143             - name: PYTHONUNBUFFERED
144               value: "1"
145             - name: REDIS_HOST
146               value: redis
147             - name: HELM_USER_PASSWD
148               value: {{ .Values.ocloud.HELM_USER_PASSWD }}
149           command: ["/bin/bash", "/opt/o2api_start.sh"]
150           volumeMounts:
151             - name: scripts
152               mountPath: /opt
153             # - name: configs
154             #   mountPath: /configs
155             - name: applicationconfig
156               mountPath: /configs/o2app.conf
157               subPath: config.json
158               readOnly: true
159             - name: servercrt
160               mountPath: /configs/server.crt
161               subPath: config.json
162               readOnly: true
163             - name: serverkey
164               mountPath: /configs/server.key
165               subPath: config.json
166               readOnly: true
167         - name: helmcli
168           image: "{{ .Values.o2ims.image.repository }}:{{ .Values.o2ims.image.tag }}"
169           ports:
170             - containerPort: 22
171           env:
172             - name: API_HOST_EXTERNAL_FLOATING
173               value: {{ .Values.ocloud.API_HOST_EXTERNAL_FLOATING }}
174             - name: HELM_USER_PASSWD
175               value: {{ .Values.ocloud.HELM_USER_PASSWD }}
176           command: ["/bin/bash", "/opt/o2_helmcli_start.sh"]
177           volumeMounts:
178             - name: scripts
179               mountPath: /opt
180       volumes:
181         - name: scripts
182           configMap:
183             name: {{ .Chart.Name }}-scripts-configmap
184         # - name: configs
185         #   emptyDir: {}
186         - configMap:
187             name: {{ .Chart.Name }}-application-config
188           name: applicationconfig
189         - configMap:
190             name: {{ .Chart.Name }}-serverkey
191           name: serverkey
192         - configMap:
193             name: {{ .Chart.Name }}-servercrt
194           name: servercrt
195         - configMap:
196             name: {{ .Chart.Name }}-smocacrt
197           name: smocacrt
198 ---