New standard GO project layout
[ric-plt/appmgr.git] / helm_chart / appmgr / templates / deployment.yaml
1 #   Copyright (c) 2019 AT&T Intellectual Property.
2 #   Copyright (c) 2019 Nokia.
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 apiVersion: apps/v1
17 kind: Deployment
18 metadata:
19   name: {{ include "appmgr.fullname" . }}
20   labels:
21     app.kubernetes.io/name: {{ include "appmgr.name" . }}
22     helm.sh/chart: {{ include "appmgr.chart" . }}
23     app.kubernetes.io/instance: {{ .Release.Name }}
24     app.kubernetes.io/managed-by: {{ .Release.Service }}
25 spec:
26   replicas: {{ .Values.replicaCount }}
27   selector:
28     matchLabels:
29       app.kubernetes.io/name: {{ include "appmgr.name" . }}
30       app.kubernetes.io/instance: {{ .Release.Name }}
31   template:
32     metadata:
33       labels:
34         app.kubernetes.io/name: {{ include "appmgr.name" . }}
35         app.kubernetes.io/instance: {{ .Release.Name }}
36     spec:
37       containers:
38         - name: {{ .Chart.Name }}
39           image: "{{ .Values.image.repository }}/{{ .Values.image.name }}:{{ .Values.image.tag }}"
40           imagePullPolicy: {{ .Values.image.pullPolicy }}
41           ports:
42             - name: http
43               containerPort: {{ .Values.image.containerPort }}
44               protocol: TCP
45           volumeMounts:
46             - name: config-volume
47               mountPath: {{ .Values.appconfigpath }}
48             - name: secret-volume
49               mountPath: {{ .Values.appsecretpath }}
50             - name: cert-volume
51               mountPath: {{ .Values.appcertpath }}
52           envFrom:
53             - configMapRef:
54                 name: {{ .Release.Name }}-appenv
55           livenessProbe:
56             httpGet:
57               path: {{ .Values.service.health_alive_check_endpoint }}
58               port: 8080
59             initialDelaySeconds: 5
60             periodSeconds: 5
61             failureThreshold: 3
62           readinessProbe:
63             httpGet:
64               path: {{ .Values.service.health_ready_check_endpoint }}
65               port: 8080
66             initialDelaySeconds: 5
67             periodSeconds: 5
68             failureThreshold: 3
69           restartPolicy: Always
70           resources:
71             {{- toYaml .Values.resources | nindent 12 }}
72           securityContext:
73             # ubuntu
74             #runAsUser: 1000
75             #allowPrivilegeEscalation: false
76       {{- with .Values.nodeSelector }}
77       nodeSelector:
78         {{- toYaml . | nindent 8 }}
79       {{- end }}
80     {{- with .Values.affinity }}
81       affinity:
82         {{- toYaml . | nindent 8 }}
83     {{- end }}
84     {{- with .Values.tolerations }}
85       tolerations:
86         {{- toYaml . | nindent 8 }}
87     {{- end }}
88
89       volumes:
90         - name: config-volume
91           configMap:
92             name: {{ .Release.Name }}-appconfig
93         - name: secret-volume
94           secret:
95             secretName: {{ .Values.appsecretobject }}
96         - name: cert-volume
97           configMap:
98             name: {{ .Values.appcertobject }}