8a013069bba4a351882680b8ba0c976b3646d3ae
[ric-plt/ric-dep.git] / helm / rsm / templates / deployment.yaml
1 ################################################################################
2 #   Copyright (c) 2019 AT&T Intellectual Property.                             #
3 #                                                                              #
4 #   Licensed under the Apache License, Version 2.0 (the "License");            #
5 #   you may not use this file except in compliance with the License.           #
6 #   You may obtain a copy of the License at                                    #
7 #                                                                              #
8 #       http://www.apache.org/licenses/LICENSE-2.0                             #
9 #                                                                              #
10 #   Unless required by applicable law or agreed to in writing, software        #
11 #   distributed under the License is distributed on an "AS IS" BASIS,          #
12 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
13 #   See the License for the specific language governing permissions and        #
14 #   limitations under the License.                                             #
15 ################################################################################
16 {{- $imagectx := dict "ctx" . "defaultregistry" .Values.rsm.image.main.registry }}
17 {{- $initimagectx := dict "ctx" . "defaultregistry" .Values.rsm.image.init.registry }}
18 {{- $pullpolicyctx := dict "ctx" . "defaultpullpolicy" .Values.rsm.imagePullPolicy }}
19 apiVersion: apps/v1
20 kind: Deployment
21 metadata:
22   name: {{ include "common.deploymentname.rsm" .}}
23   namespace: {{ include "common.namespace.platform" . }}
24   labels:
25     app: {{ include "common.namespace.platform" . }}-{{ include "common.name.rsm" . }}
26     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
27     release: {{ .Release.Name }}
28     heritage: {{ .Release.Service }}
29 spec:
30   replicas: {{ .Values.rsm.replicaCount }}
31   selector:
32     matchLabels:
33       app: {{ include "common.namespace.platform" . }}-{{ include "common.name.rsm" . }}
34       release: {{ .Release.Name }}
35   template:
36     metadata:
37       {{- if .Values.rsm.annotations }}
38       annotations:
39         {{- .Values.rsm.annotations | nindent 8 -}}
40       {{ end }}
41       labels:
42         app: {{ include "common.namespace.platform" . }}-{{ include "common.name.rsm" . }}
43         release: {{ .Release.Name }}
44     spec:
45       initContainers:
46       - name: redis-init
47         image: {{ include "common.dockerregistry.url" $initimagectx }}/{{ .Values.rsm.image.init.name }}:{{ .Values.rsm.image.init.tag }}
48         imagePullPolicy: {{ include "common.dockerregistry.pullpolicy" $pullpolicyctx }}
49         command: ['sh', '-c', 'redis-cli -h service-ricplt-dbaas-tcp -p 6379 set "{rsm},CFG:GENERAL:v1.0.0"  "{\"enableResourceStatus\":true,\"partialSuccessAllowed\":true,\"prbPeriodic\":true,\"tnlLoadIndPeriodic\":true,\"wwLoadIndPeriodic\":true,\"absStatusPeriodic\":true,\"rsrpMeasurementPeriodic\":true,\"csiPeriodic\":true,\"periodicityMs\":1,\"periodicityRsrpMeasurementMs\":3,\"periodicityCsiMs\":4}" nx']
50       hostname: {{ include "common.name.rsm" . }} 
51       imagePullSecrets:
52         - name: {{ include "common.dockerregistry.credential" $imagectx }}
53       containers:
54         - name: {{ include "common.containername.rsm" . }}
55           image: {{ include "common.dockerregistry.url" $imagectx }}/{{ .Values.rsm.image.main.name }}:{{ .Values.rsm.image.main.tag }}
56           imagePullPolicy: {{ include "common.dockerregistry.pullpolicy" $pullpolicyctx }}
57           volumeMounts:
58           - mountPath: /opt/RSM/router.txt
59             name: local-router-file
60             subPath: router.txt
61           - mountPath: /opt/RSM/resources/configuration.yaml
62             name: local-configuration-file
63             subPath: configuration.yaml
64           envFrom:
65             - configMapRef:
66                 name: {{ include "common.configmapname.rsm" . }}-env
67           ports:
68             - name: "http"
69               containerPort: {{ include "common.serviceport.rsm.http" . }}
70             - name: "rmrroute"
71               containerPort: {{ include "common.serviceport.rsm.rmr.route" . }}
72             - name: "rmrdata"
73               containerPort: {{ include "common.serviceport.rsm.rmr.data" . }}
74           stdin: true
75           tty: true
76           securityContext:
77             privileged: {{ .Values.rsm.privilegedmode}}
78       volumes:
79         - name: local-router-file
80           configMap:
81             name: {{ include "common.configmapname.rsm" . }}-router-configmap
82         - name: local-configuration-file
83           configMap:
84             name: {{ include "common.configmapname.rsm" . }}