Near RT RIC Platform new-installer initial release
[ric-plt/ric-dep.git] / new-installer / helm / charts / nearrtric / appmgr / 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 {{- $topCtx :=  . }}
18 {{- $secretPath := .Values.appmgr.appsecretpath | default "/opt/ric/secret" }}
19 {{- $imagectx := dict "ctx" . "defaultregistry" .Values.appmgr.image.appmgr.registry }}
20 apiVersion: apps/v1
21 kind: Deployment
22 metadata:
23   name: {{ include "common.deploymentname.appmgr" . }}
24   namespace: {{ include "common.namespace.platform" . }}
25   labels:
26     app: {{ include "common.namespace.platform" . }}-{{ include "common.name.appmgr" . }}
27     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
28     release: {{ .Release.Name }}
29     heritage: {{ .Release.Service }}
30 spec:
31   replicas: {{ .Values.appmgr.replicaCount }}
32   selector:
33     matchLabels:
34       app: {{ include "common.namespace.platform" . }}-{{ include "common.name.appmgr" . }}
35       release: {{ .Release.Name }}
36   template:
37     metadata:
38       {{- if .Values.appmgr.annotations }}
39       annotations:
40         {{- .Values.appmgr.annotations | nindent 8 -}}
41       {{ end }}
42       labels:
43         app: {{ include "common.namespace.platform" . }}-{{ include "common.name.appmgr" . }}
44         release: {{ .Release.Name }}
45     spec:
46       hostname: {{ include "common.name.appmgr" . }}
47       serviceAccountName: {{ include "common.serviceaccountname.appmgr" . }}
48       imagePullSecrets:
49         - name: {{ include "common.dockerregistry.credential" $imagectx }}
50       containers:
51         - name: {{ include "common.containername.appmgr" . }}
52           {{- $newctx := dict "ctx" $topCtx "defaultregistry" .Values.appmgr.image.appmgr.registry }}
53           image: {{ include "common.dockerregistry.url" $newctx }}/{{ .Values.appmgr.image.appmgr.name }}:{{ .Values.appmgr.image.appmgr.tag }}
54           {{- $newctx := dict "ctx" $topCtx "defaultpullpolicy" .Values.appmgr.imagePullPolicy }}
55           imagePullPolicy: {{ include "common.dockerregistry.pullpolicy" $newctx }}
56           ports:
57             - name: http
58               containerPort: {{ include "common.serviceport.appmgr.http" . }}
59               protocol: TCP
60             - name: rmrroute
61               containerPort: {{ include "common.serviceport.appmgr.rmr.route" . }}
62               protocol: TCP
63             - name: rmrdata
64               containerPort: {{ include "common.serviceport.appmgr.rmr.data" . }}
65               protocol: TCP
66           volumeMounts:
67             - name: config-volume
68               mountPath: {{ .Values.appmgr.appconfigpath }}/appmgr.yaml
69               subPath: appmgr.yaml
70             - name: helm-secret-volume
71               mountPath: {{ $secretPath }}
72               readOnly: false
73             - name: secret-volume
74               mountPath: {{ $secretPath }}/helm_repo_username
75               subPath: helm_repo_username
76             - name: secret-volume
77               mountPath: {{ $secretPath }}/helm_repo_password
78               subPath: helm_repo_password
79           envFrom:
80             - configMapRef:
81                 name: {{ include "common.configmapname.appmgr" . }}-env
82             - configMapRef:
83                 name: {{ include "common.configmapname.dbaas" . }}-appconfig
84           livenessProbe:
85             #exec:
86             #  command:
87             #    - /bin/bash
88             #    - -c
89             #    - ps -ef | grep {{ .Values.livenessprocessname }}| grep -v "grep"
90             #initialDelaySeconds: 120
91             #periodSeconds: 30
92           readinessProbe:
93           #  httpGet:
94           #    path: /
95           #    port: http
96           securityContext:
97             # ubuntu
98             #runAsUser: 1000
99             #allowPrivilegeEscalation: false
100       restartPolicy: Always
101       volumes:
102         - name: config-volume
103           configMap:
104             name: {{ include "common.configmapname.appmgr" . }}-appconfig
105         - name: secret-volume
106           secret:
107             secretName: {{ include "common.secretname.appmgr" . }}
108         - name: helm-secret-volume
109           emptyDir: {}
110         - name: appmgr-bin-volume
111           configMap:
112             name: {{ include "common.configmapname.appmgr" . }}-bin
113             defaultMode: 0755