Add standalone R3 RIC platform helm charts and deployment scripts.
[ric-plt/ric-dep.git] / helm / e2term / templates / deployment.yaml
1 ################################################################################
2 #   Copyright (c) 2019 AT&T Intellectual Property.                             #
3 #   Copyright (c) 2019 Nokia.                                                  #
4 #                                                                              #
5 #   Licensed under the Apache License, Version 2.0 (the "License");            #
6 #   you may not use this file except in compliance with the License.           #
7 #   You may obtain a copy of the License at                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
11 #   Unless required by applicable law or agreed to in writing, software        #
12 #   distributed under the License is distributed on an "AS IS" BASIS,          #
13 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
14 #   See the License for the specific language governing permissions and        #
15 #   limitations under the License.                                             #
16 ################################################################################
17 {{- $imagectx := dict "ctx" . "defaultregistry" .Values.e2term.image.registry }}
18 {{- $pullpolicyctx := dict "ctx" . "defaultpullpolicy" .Values.e2term.imagePullPolicy }}
19 apiVersion: apps/v1
20 kind: Deployment
21 metadata:
22   name: {{ include "common.deploymentname.e2term" . }}
23   namespace: {{ include "common.namespace.platform" . }}
24   labels:
25     app: {{ include "common.namespace.platform" . }}-{{ include "common.name.e2term" . }}
26     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
27     release: {{ .Release.Name }}
28     heritage: {{ .Release.Service }}
29 spec:
30   replicas: {{ .Values.e2term.replicaCount }}
31   selector:
32     matchLabels:
33       app: {{ include "common.namespace.platform" . }}-{{ include "common.name.e2term" . }}
34       release: {{ .Release.Name }}
35   template:
36     metadata:
37       {{- if .Values.e2term.annotations }}
38       annotations:
39         {{- .Values.e2term.annotations | nindent 8 -}}
40       {{ end }}
41       labels:
42         app: {{ include "common.namespace.platform" . }}-{{ include "common.name.e2term" . }}
43         release: {{ .Release.Name }}
44     spec:
45       hostname: {{ include "common.name.e2term" . }}
46       hostNetwork: {{ .Values.e2term.hostnetworkmode }}
47       dnsPolicy: ClusterFirstWithHostNet
48       imagePullSecrets:
49         - name: {{ include "common.dockerregistry.credential" $imagectx }}
50       {{- with .Values.e2term.nodeselector }}
51       nodeSelector: {{ toYaml . | trim | nindent 8 -}}
52       {{- end }}
53       containers:
54         - name: {{ include "common.containername.e2term" . }}
55           image: {{ include "common.dockerregistry.url" $imagectx }}/{{ .Values.e2term.image.name }}:{{ .Values.e2term.image.tag }}
56           imagePullPolicy: {{ include "common.dockerregistry.pullpolicy" $pullpolicyctx }}
57           volumeMounts:
58           - mountPath: /opt/e2/router.txt
59             name: local-router-file
60             subPath: router.txt
61           - mountPath: /tmp/rmr_verbose
62             name: local-router-file
63             subPath: rmr_verbose
64 {{ if .Values.e2term.pizpub.enabled }}
65           - mountPath: "{{ .Values.e2term.env.messagecollectorfile }}"
66             name: vol-shared
67             readOnly: false
68             subPath: "{{ .Values.e2term.pizpub.scanDirectory }}"
69 {{ else }}
70           - mountPath: "{{ .Values.e2term.env.messagecollectorfile }}"
71             name: vol-shared
72             readOnly: false
73 {{ end }}
74           envFrom:
75             - configMapRef:
76                 name: {{ include "common.configmapname.e2term" . }}-env
77           ports:
78             - name: "rmrroute"
79               containerPort: {{ include "common.serviceport.e2term.rmr.route" . }}
80             - name: "rmrdata"
81               containerPort: {{ include "common.serviceport.e2term.rmr.data" . }}
82           stdin: true
83           tty: true
84           securityContext:
85             privileged: {{ .Values.e2term.privilegedmode }}
86
87 {{ if .Values.e2term.pizpub.enabled }}
88         - name: {{ include "common.containername.e2term" . }}-pizpub
89           image: {{ include "common.repository" . }}/{{ .Values.e2term.pizpub.imageName }}:{{ .Values.e2term.pizpub.imageVersion }}
90           imagePullPolicy: {{ include "common.pullPolicy" . }}
91           volumeMounts:
92           - mountPath: /etc/localtime
93             name: localtime
94             readOnly: true
95           - mountPath: "{{ .Values.e2term.pizpub.dataRootDir }}"
96             name: vol-shared
97             readOnly: false
98           - name: pizpub-config
99             mountPath: /opt/app/config/conf/
100           lifecycle:
101             postStart:
102               exec:
103                 command: ["/bin/sh", "/opt/app/config/conf/cleaner.sh", "{{ .Values.e2term.pizpub.dataRootDir }}/{{ .Values.e2term.pizpub.processedDirectory }}", "3"]
104 {{ end }}
105       volumes:
106         - name: local-router-file
107           configMap:
108             name: {{ include "common.configmapname.e2term" . }}-router-configmap
109 {{ if .Values.e2term.pizpub.enabled }}
110         - name: localtime
111           hostPath:
112             path: /etc/localtime
113         - name: pizpub-config
114           configMap:
115             name: {{ include "common.configmapname.e2term" . }}-pizpub
116 {{ end }}
117         - name: vol-shared
118           persistentVolumeClaim:
119             claimName: {{ include "common.pvcname.e2term" . }}
120