charts: fix the images format
[pti/o2.git] / charts / templates / deployment.yaml
index 2e8ebf1..98dc174 100644 (file)
-# Copyright (C) 2021 Wind River Systems, Inc.\r
-#\r
-#  Licensed under the Apache License, Version 2.0 (the "License");\r
-#  you may not use this file except in compliance with the License.\r
-#  You may obtain a copy of the License at\r
-#\r
-#      http://www.apache.org/licenses/LICENSE-2.0\r
-#\r
-#  Unless required by applicable law or agreed to in writing, software\r
-#  distributed under the License is distributed on an "AS IS" BASIS,\r
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-#  See the License for the specific language governing permissions and\r
-#  limitations under the License.\r
-\r
----\r
-apiVersion: apps/v1\r
-kind: Deployment\r
-metadata:\r
-  name: o2api\r
-  namespace: {{ .Values.global.namespace }}\r
-  labels:\r
-    app: o2api\r
-spec:\r
-  replicas: 1\r
-  selector:\r
-    matchLabels:\r
-      app: o2api\r
-  template:\r
-    metadata:\r
-      labels:\r
-        app: o2api\r
-    spec:\r
-      imagePullSecrets:\r
-        - name: {{ .Values.o2ims.imagePullSecrets }}\r
-{{- if .Values.o2ims.affinity }}\r
-      affinity:\r
-{{ toYaml .Values.o2ims.affinity | indent 8 }}\r
-{{- end }}\r
-      containers:\r
-        - name: postgres\r
-          image: postgres:9.6\r
-          ports:\r
-            - containerPort: 5432\r
-          env:\r
-            - name: POSTGRES_PASSWORD\r
-              value: o2ims123\r
-            - name: POSTGRES_USER\r
-              value: o2ims\r
-          command: ["/bin/bash", "/opt/postgres_start.sh"]\r
-          volumeMounts:\r
-            - name: scripts\r
-              mountPath: /opt\r
-        - name: o2api\r
-          image: "{{ .Values.o2ims.image.repository }}:{{ .Values.o2ims.image.tag }}"\r
-          ports:\r
-            - containerPort: 80\r
-          env:\r
-            - name: API_HOST\r
-              value: api\r
-            - name: DB_HOST\r
-              value: postgres\r
-            - name: DB_PASSWORD\r
-              value: o2ims123\r
-            - name: FLASK_APP\r
-              value: /root/o2/o2ims/entrypoints/flask_application.py\r
-            - name: FLASK_DEBUG\r
-              value: "1"\r
-            - name: LOGGING_CONFIG_LEVEL\r
-              value: DEBUG\r
-            - name: OS_AUTH_URL\r
-            - name: OS_PASSWORD\r
-            - name: OS_USERNAME\r
-            - name: PYTHONDONTWRITEBYTECODE\r
-              value: "1"\r
-            - name: PYTHONUNBUFFERED\r
-              value: "1"\r
-            - name: REDIS_HOST\r
-              value: redis\r
-          command: ["/bin/bash", "/opt/o2api_start.sh"]\r
-          volumeMounts:\r
-            - name: scripts\r
-              mountPath: /opt\r
-        - name: redis\r
-          image: redis:alpine\r
-          ports:\r
-            - containerPort: 6379\r
-        - name: watcher\r
-          image: "{{ .Values.o2ims.image.repository }}:{{ .Values.o2ims.image.tag }}"\r
-          command: ["/bin/bash", "/opt/o2watcher_start.sh"]\r
-          env:\r
-            - name: DB_HOST\r
-              value: postgres\r
-            - name: DB_PASSWORD\r
-              value: o2ims123\r
-            - name: LOGGING_CONFIG_LEVEL\r
-              value: DEBUG\r
-            - name: OS_AUTH_URL\r
-            - name: OS_PASSWORD\r
-            - name: OS_USERNAME\r
-            - name: PYTHONDONTWRITEBYTECODE\r
-              value: "1"\r
-            - name: REDIS_HOST\r
-              value: redis\r
-          volumeMounts:\r
-            - name: scripts\r
-              mountPath: /opt\r
-        - name: o2pubsub\r
-          image: "{{ .Values.o2ims.image.repository }}:{{ .Values.o2ims.image.tag }}"\r
-          command: ["/bin/bash", "/opt/o2pubsub_start.sh"]\r
-          env:\r
-            - name: DB_HOST\r
-              value: postgres\r
-            - name: DB_PASSWORD\r
-              value: o2ims123\r
-            - name: LOGGING_CONFIG_LEVEL\r
-              value: DEBUG\r
-            - name: OS_AUTH_URL\r
-            - name: OS_PASSWORD\r
-            - name: OS_USERNAME\r
-            - name: PYTHONDONTWRITEBYTECODE\r
-              value: "1"\r
-            - name: REDIS_HOST\r
-              value: redis\r
-          volumeMounts:\r
-            - name: scripts\r
-              mountPath: /opt\r
-      volumes:\r
-        - name: scripts\r
-          configMap:\r
-            name: {{ .Chart.Name }}-scripts-configmap\r
----\r
+# Copyright (C) 2021 Wind River Systems, Inc.
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: o2api
+  namespace: {{ .Values.global.namespace }}
+  labels:
+    app: o2api
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      app: o2api
+  template:
+    metadata:
+      labels:
+        app: o2api
+    spec:
+      serviceAccountName: {{ .Values.o2ims.serviceaccountname }}
+      {{- if .Values.imagePullSecrets }}
+      imagePullSecrets:
+        {{- range .Values.imagePullSecrets }}
+        - name: {{ . }}
+        {{- end }}
+      {{- end }}
+{{- if .Values.o2ims.affinity }}
+      affinity:
+{{ toYaml .Values.o2ims.affinity | indent 8 }}
+{{- end }}
+      containers:
+        - name: postgres
+          image: "{{ .Values.o2ims.images.tags.postgres }}"
+          ports:
+            - containerPort: 5432
+          env:
+            - name: POSTGRES_PASSWORD
+              value: o2ims123
+            - name: POSTGRES_USER
+              value: o2ims
+            - name: PGDATA
+              value: /var/lib/postgresql/data/pgdata
+          command: ["/bin/bash", "/opt/postgres_start.sh"]
+          volumeMounts:
+            - name: scripts
+              mountPath: /opt
+            - name: db-pv
+              mountPath: /var/lib/postgresql/data
+        - name: redis
+          image: "{{ .Values.o2ims.images.tags.redis }}"
+          ports:
+            - containerPort: 6379
+        - name: o2pubsub
+          image: "{{ .Values.o2ims.images.tags.o2service }}"
+          command: ["/bin/bash", "/opt/o2pubsub_start.sh"]
+          env:
+            - name: DB_HOST
+              value: postgres
+            - name: DB_PASSWORD
+              value: o2ims123
+            - name: LOGGING_CONFIG_LEVEL
+              value: {{ .Values.o2ims.logginglevel }}
+            - name: OS_AUTH_URL
+              value: {{ .Values.ocloud.OS_AUTH_URL }}
+            - name: OS_PASSWORD
+              value: {{ .Values.ocloud.OS_PASSWORD }}
+            - name: OS_USERNAME
+              value: {{ .Values.ocloud.OS_USERNAME }}
+            - name: PYTHONDONTWRITEBYTECODE
+              value: "1"
+            - name: REDIS_HOST
+              value: redis
+            - name: K8S_KUBECONFIG
+              value: {{ .Values.ocloud.K8S_KUBECONFIG }}
+          volumeMounts:
+            - name: scripts
+              mountPath: /opt
+            - name: applicationconfig
+              mountPath: /configs/o2app.conf
+              subPath: config.json
+              readOnly: true
+            - name: smocacrt
+              mountPath: /configs/smoca.crt
+              subPath: config.json
+        - name: watcher
+          image: "{{ .Values.o2ims.images.tags.o2service }}"
+          command: ["/bin/bash", "/opt/o2watcher_start.sh"]
+          env:
+            - name: API_HOST_EXTERNAL_FLOATING
+              value: {{ .Values.ocloud.API_HOST_EXTERNAL_FLOATING }}
+            - name: DB_HOST
+              value: postgres
+            - name: DB_PASSWORD
+              value: o2ims123
+            - name: LOGGING_CONFIG_LEVEL
+              value: {{ .Values.o2ims.logginglevel }}
+            - name: OS_AUTH_URL
+              value: {{ .Values.ocloud.OS_AUTH_URL }}
+            - name: OS_PASSWORD
+              value: {{ .Values.ocloud.OS_PASSWORD }}
+            - name: OS_USERNAME
+              value: {{ .Values.ocloud.OS_USERNAME }}
+            - name: PYTHONDONTWRITEBYTECODE
+              value: "1"
+            - name: REDIS_HOST
+              value: redis
+          volumeMounts:
+            - name: scripts
+              mountPath: /opt
+            - name: applicationconfig
+              mountPath: /configs/o2app.conf
+              subPath: config.json
+              readOnly: true
+        - name: o2api
+          image: "{{ .Values.o2ims.images.tags.o2service }}"
+          ports:
+            - containerPort: 80
+          env:
+            - name: API_HOST_EXTERNAL_FLOATING
+              value: {{ .Values.ocloud.API_HOST_EXTERNAL_FLOATING }}
+            - name: DB_HOST
+              value: postgres
+            - name: DB_PASSWORD
+              value: o2ims123
+            - name: FLASK_APP
+              value: /src/o2app/entrypoints/flask_application.py
+            - name: FLASK_DEBUG
+              value: {{ .Values.o2ims.logginglevel }}
+            - name: LOGGING_CONFIG_LEVEL
+              value: {{ .Values.o2ims.logginglevel }}
+            - name: OS_AUTH_URL
+            - name: OS_PASSWORD
+            - name: OS_USERNAME
+            - name: PYTHONDONTWRITEBYTECODE
+              value: "1"
+            - name: PYTHONUNBUFFERED
+              value: "1"
+            - name: REDIS_HOST
+              value: redis
+            - name: HELM_USER_PASSWD
+              value: {{ .Values.ocloud.HELM_USER_PASSWD }}
+          command: ["/bin/bash", "/opt/o2api_start.sh"]
+          volumeMounts:
+            - name: scripts
+              mountPath: /opt
+            # - name: configs
+            #   mountPath: /configs
+            - name: applicationconfig
+              mountPath: /configs/o2app.conf
+              subPath: config.json
+              readOnly: true
+            - name: servercrt
+              mountPath: /configs/server.crt
+              subPath: config.json
+              readOnly: true
+            - name: serverkey
+              mountPath: /configs/server.key
+              subPath: config.json
+              readOnly: true
+        {{- if .Values.o2dms.helm_cli_enable }}
+        - name: helmcli
+          image: "{{ .Values.o2ims.images.tags.o2service }}"
+          ports:
+            - containerPort: 22
+          env:
+            - name: API_HOST_EXTERNAL_FLOATING
+              value: {{ .Values.ocloud.API_HOST_EXTERNAL_FLOATING }}
+            - name: HELM_USER_PASSWD
+              value: {{ .Values.ocloud.HELM_USER_PASSWD }}
+          command: ["/bin/bash", "/opt/o2_helmcli_start.sh"]
+          volumeMounts:
+            - name: scripts
+              mountPath: /opt
+        {{- end }}
+      volumes:
+        - name: scripts
+          configMap:
+            name: {{ .Chart.Name }}-scripts-configmap
+        # - name: configs
+        #   emptyDir: {}
+        - configMap:
+            name: {{ .Chart.Name }}-application-config
+          name: applicationconfig
+        - configMap:
+            name: {{ .Chart.Name }}-serverkey
+          name: serverkey
+        - configMap:
+            name: {{ .Chart.Name }}-servercrt
+          name: servercrt
+        - configMap:
+            name: {{ .Chart.Name }}-smocacrt
+          name: smocacrt
+        - name: db-pv
+          persistentVolumeClaim:
+            claimName: {{ .Chart.Name }}-db-pv
+---