Add back secret with built-in user for o2 service
[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: watcher
86           image: "{{ .Values.o2ims.image.repository }}:{{ .Values.o2ims.image.tag }}"
87           command: ["/bin/bash", "/opt/o2watcher_start.sh"]
88           env:
89             - name: API_HOST_EXTERNAL_FLOATING
90               value: {{ .Values.ocloud.API_HOST_EXTERNAL_FLOATING }}
91             - name: DB_HOST
92               value: postgres
93             - name: DB_PASSWORD
94               value: o2ims123
95             - name: LOGGING_CONFIG_LEVEL
96               value: {{ .Values.o2ims.logginglevel }}
97             - name: OS_AUTH_URL
98               value: {{ .Values.ocloud.OS_AUTH_URL }}
99             - name: OS_PASSWORD
100               value: {{ .Values.ocloud.OS_PASSWORD }}
101             - name: OS_USERNAME
102               value: {{ .Values.ocloud.OS_USERNAME }}
103             - name: PYTHONDONTWRITEBYTECODE
104               value: "1"
105             - name: REDIS_HOST
106               value: redis
107           volumeMounts:
108             - name: scripts
109               mountPath: /opt
110         - name: o2api
111           image: "{{ .Values.o2ims.image.repository }}:{{ .Values.o2ims.image.tag }}"
112           ports:
113             - containerPort: 80
114           env:
115             - name: API_HOST_EXTERNAL_FLOATING
116               value: {{ .Values.ocloud.API_HOST_EXTERNAL_FLOATING }}
117             - name: DB_HOST
118               value: postgres
119             - name: DB_PASSWORD
120               value: o2ims123
121             - name: FLASK_APP
122               value: /src/o2app/entrypoints/flask_application.py
123             - name: FLASK_DEBUG
124               value: {{ .Values.o2ims.logginglevel }}
125             - name: LOGGING_CONFIG_LEVEL
126               value: {{ .Values.o2ims.logginglevel }}
127             - name: OS_AUTH_URL
128             - name: OS_PASSWORD
129             - name: OS_USERNAME
130             - name: PYTHONDONTWRITEBYTECODE
131               value: "1"
132             - name: PYTHONUNBUFFERED
133               value: "1"
134             - name: REDIS_HOST
135               value: redis
136             - name: HELM_USER_PASSWD
137               value: {{ .Values.ocloud.HELM_USER_PASSWD }}
138           command: ["/bin/bash", "/opt/o2api_start.sh"]
139           volumeMounts:
140             - name: scripts
141               mountPath: /opt
142             - name: configs
143               mountPath: /configs
144         - name: helmcli
145           image: "{{ .Values.o2ims.image.repository }}:{{ .Values.o2ims.image.tag }}"
146           ports:
147             - containerPort: 22
148           env:
149             - name: API_HOST_EXTERNAL_FLOATING
150               value: {{ .Values.ocloud.API_HOST_EXTERNAL_FLOATING }}
151             - name: HELM_USER_PASSWD
152               value: {{ .Values.ocloud.HELM_USER_PASSWD }}
153           command: ["/bin/bash", "/opt/o2_helmcli_start.sh"]
154           volumeMounts:
155             - name: scripts
156               mountPath: /opt
157             - name: configs
158               mountPath: /configs
159       volumes:
160         - name: scripts
161           configMap:
162             name: {{ .Chart.Name }}-scripts-configmap
163         - name: configs
164           emptyDir: {}
165 ---