Rename ssl related files and variable names to make it more clear.
[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: watcher
90           image: "{{ .Values.o2ims.image.repository }}:{{ .Values.o2ims.image.tag }}"
91           command: ["/bin/bash", "/opt/o2watcher_start.sh"]
92           env:
93             - name: API_HOST_EXTERNAL_FLOATING
94               value: {{ .Values.ocloud.API_HOST_EXTERNAL_FLOATING }}
95             - name: DB_HOST
96               value: postgres
97             - name: DB_PASSWORD
98               value: o2ims123
99             - name: LOGGING_CONFIG_LEVEL
100               value: {{ .Values.o2ims.logginglevel }}
101             - name: OS_AUTH_URL
102               value: {{ .Values.ocloud.OS_AUTH_URL }}
103             - name: OS_PASSWORD
104               value: {{ .Values.ocloud.OS_PASSWORD }}
105             - name: OS_USERNAME
106               value: {{ .Values.ocloud.OS_USERNAME }}
107             - name: PYTHONDONTWRITEBYTECODE
108               value: "1"
109             - name: REDIS_HOST
110               value: redis
111           volumeMounts:
112             - name: scripts
113               mountPath: /opt
114             - name: applicationconfig
115               mountPath: /configs/o2app.conf
116               subPath: config.json
117               readOnly: true
118         - name: o2api
119           image: "{{ .Values.o2ims.image.repository }}:{{ .Values.o2ims.image.tag }}"
120           ports:
121             - containerPort: 80
122           env:
123             - name: API_HOST_EXTERNAL_FLOATING
124               value: {{ .Values.ocloud.API_HOST_EXTERNAL_FLOATING }}
125             - name: DB_HOST
126               value: postgres
127             - name: DB_PASSWORD
128               value: o2ims123
129             - name: FLASK_APP
130               value: /src/o2app/entrypoints/flask_application.py
131             - name: FLASK_DEBUG
132               value: {{ .Values.o2ims.logginglevel }}
133             - name: LOGGING_CONFIG_LEVEL
134               value: {{ .Values.o2ims.logginglevel }}
135             - name: OS_AUTH_URL
136             - name: OS_PASSWORD
137             - name: OS_USERNAME
138             - name: PYTHONDONTWRITEBYTECODE
139               value: "1"
140             - name: PYTHONUNBUFFERED
141               value: "1"
142             - name: REDIS_HOST
143               value: redis
144             - name: HELM_USER_PASSWD
145               value: {{ .Values.ocloud.HELM_USER_PASSWD }}
146           command: ["/bin/bash", "/opt/o2api_start.sh"]
147           volumeMounts:
148             - name: scripts
149               mountPath: /opt
150             # - name: configs
151             #   mountPath: /configs
152             - name: applicationconfig
153               mountPath: /configs/o2app.conf
154               subPath: config.json
155               readOnly: true
156             - name: servercrt
157               mountPath: /configs/server.crt
158               subPath: config.json
159               readOnly: true
160             - name: serverkey
161               mountPath: /configs/server.key
162               subPath: config.json
163               readOnly: true
164             - name: smocacrt
165               mountPath: /configs/smoca.crt
166               subPath: config.json
167               readOnly: true
168         - name: helmcli
169           image: "{{ .Values.o2ims.image.repository }}:{{ .Values.o2ims.image.tag }}"
170           ports:
171             - containerPort: 22
172           env:
173             - name: API_HOST_EXTERNAL_FLOATING
174               value: {{ .Values.ocloud.API_HOST_EXTERNAL_FLOATING }}
175             - name: HELM_USER_PASSWD
176               value: {{ .Values.ocloud.HELM_USER_PASSWD }}
177           command: ["/bin/bash", "/opt/o2_helmcli_start.sh"]
178           volumeMounts:
179             - name: scripts
180               mountPath: /opt
181       volumes:
182         - name: scripts
183           configMap:
184             name: {{ .Chart.Name }}-scripts-configmap
185         # - name: configs
186         #   emptyDir: {}
187         - configMap:
188             name: {{ .Chart.Name }}-application-config
189           name: applicationconfig
190         - configMap:
191             name: {{ .Chart.Name }}-serverkey
192           name: serverkey
193         - configMap:
194             name: {{ .Chart.Name }}-servercrt
195           name: servercrt
196         - configMap:
197             name: {{ .Chart.Name }}-smocacrt
198           name: smocacrt
199 ---