Feature 8170: deploy OSM services with a helm chart
[osm/devops.git] / installers / helm / osm / templates / pla / pla-deployment.yaml
1 {{- if .Values.global.oldServiceAssurance -}}
2 {{- if .Values.pla.enabled -}}
3 #######################################################################################
4 # Copyright ETSI Contributors and Others.
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 #    http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15 # implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 #######################################################################################
19 apiVersion: apps/v1
20 kind: Deployment
21 metadata:
22   name: pla
23   labels:
24     {{- include "osm.labels" . | nindent 4 }}
25 spec:
26   replicas: {{ .Values.pla.replicaCount | default .Values.global.replicaCount }}
27   selector:
28     matchLabels:
29       app.kubernetes.io/component: pla
30       {{- include "osm.selectorLabels" . | nindent 6 }}
31   template:
32     metadata:
33       {{- with .Values.global.podAnnotations }}
34       annotations:
35         {{- toYaml . | nindent 8 }}
36       {{- end }}
37       labels:
38         app.kubernetes.io/component: pla
39         {{- include "osm.selectorLabels" . | nindent 8 }}
40     spec:
41       {{- with .Values.global.imagePullSecrets }}
42       imagePullSecrets:
43         {{- toYaml . | nindent 8 }}
44       {{- end }}
45       serviceAccountName: {{ include "osm.serviceAccountName" . }}
46       securityContext:
47         {{- toYaml .Values.global.podSecurityContext | nindent 8 }}
48       initContainers:
49         - name: kafka-mongo-test
50           image: alpine:latest
51           command: ["sh", "-c", "until (nc -zvw1 kafka 9092 && nc -zvw1 mongodb-k8s 27017); do sleep 3; done; exit 0"]
52       containers:
53         - name: pla
54           securityContext:
55             readOnlyRootFilesystem: true
56             allowPrivilegeEscalation: false
57             runAsNonRoot: true
58             {{- toYaml .Values.global.securityContext | nindent 12 }}
59           image: {{ include "osm.pla.image" . }}
60           imagePullPolicy: {{ .Values.global.image.pullPolicy }}
61           resources:
62             limits:
63               memory: 1024Mi
64             requests:
65               memory: 128Mi
66           envFrom:
67             - configMapRef:
68                 name: {{ include "osm.fullname" . }}-pla-configmap
69       {{- with .Values.global.nodeSelector }}
70       nodeSelector:
71         {{- toYaml . | nindent 8 }}
72       {{- end }}
73       {{- with .Values.global.affinity }}
74       affinity:
75         {{- toYaml . | nindent 8 }}
76       {{- end }}
77       {{- with .Values.global.tolerations }}
78       tolerations:
79         {{- toYaml . | nindent 8 }}
80       {{- end }}
81 {{- end }}
82 {{- end }}