This patch introduces a new structure of the it/dep repo.
[it/dep.git] / xapps / 90-xApps / helm / xapp-std / 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 apiVersion: apps/v1
18 kind: Deployment
19 metadata:
20   name: {{ include "ricapp.fullname" . }}
21   labels:
22     app.kubernetes.io/name: {{ include "ricapp.name" . }}
23     helm.sh/chart: {{ include "ricapp.chart" . }}
24     app.kubernetes.io/instance: {{ .Release.Name }}
25     app.kubernetes.io/managed-by: {{ .Release.Service }}
26 spec:
27   replicas: {{ .Values.ricapp.replicaCount }}
28   selector:
29     matchLabels:
30       app.kubernetes.io/name: {{ include "ricapp.name" . }}
31       app.kubernetes.io/instance: {{ .Release.Name }}
32   template:
33     metadata:
34       labels:
35         app.kubernetes.io/name: {{ include "ricapp.name" . }}
36         app.kubernetes.io/instance: {{ .Release.Name }}
37     spec:
38       imagePullSecrets:
39         - name: {{ .Release.Name }}-docker-registry-key
40       containers:
41         - name: {{ .Chart.Name }}
42           image: "{{ .Values.global.repository }}/{{ .Values.ricapp.image.name }}:{{ .Values.ricapp.image.tag }}"
43           imagePullPolicy: {{ .Values.global.image.pullPolicy }}
44           # enable the next two elements if wanting to test pod bypassing its own entrypoint
45           #command: ["sh"]
46           #args:
47           #  - -c
48           #  - "while sleep 2; do echo thinking; done" 
49           ports:
50             - name: http
51               containerPort: 8080
52               protocol: TCP
53           volumeMounts:
54             - name: config-volume
55               mountPath: {{ .Values.ricapp.appconfigpath }}
56             - name: secret-volume
57               mountPath: {{ .Values.ricapp.appsecretpath }}
58           envFrom:
59             - configMapRef:
60                 name: {{ .Release.Name }}-appenv
61           livenessProbe:
62             exec:
63               command:
64                 - /bin/bash
65                 - -c
66                 - ps -ef | grep {{ .Values.ricapp.livenessprocessname }}| grep -v "grep"
67             initialDelaySeconds: 120
68             periodSeconds: 30
69           readinessProbe:
70             httpGet:
71               path: /
72               port: http
73           restartPolicy: Always
74           resources:
75             {{- toYaml .Values.resources | nindent 12 }}
76           securityContext:
77             # ubuntu
78             runAsUser: 1000
79             allowPrivilegeEscalation: false
80       {{- with .Values.nodeSelector }}
81       nodeSelector:
82         {{- toYaml . | nindent 8 }}
83       {{- end }}
84     {{- with .Values.affinity }}
85       affinity:
86         {{- toYaml . | nindent 8 }}
87     {{- end }}
88     {{- with .Values.tolerations }}
89       tolerations:
90         {{- toYaml . | nindent 8 }}
91     {{- end }}
92
93       volumes:
94         - name: config-volume
95           configMap:
96             name: {{ .Release.Name }}-appconfig
97         - name: secret-volume
98           secret:
99             secretName: {{ .Release.Name }}-appsecret