[CONSUL] Add limits to consul chart.
[oom.git] / kubernetes / aaf / components / aaf-cass / templates / deployment.yaml
1 # Copyright © 2017 Amdocs, Bell Canada
2 # Modifications © 2020 Orange
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: {{- include "common.resourceMetadata" . | nindent 2 }}
19 spec:
20   selector: {{- include "common.selectors" . | nindent 4 }}
21   replicas: {{ .Values.replicaCount }}
22   template:
23     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
24     spec:
25       initContainers:
26       - name: fix-permission
27         command:
28         - /bin/sh
29         args:
30         - -c
31         - |
32           chown -R 1000:1000 /opt/app/aaf/status
33           chown -R 1000:1000 /var/lib/cassandra
34         image: "{{ .Values.global.busyboxRepository }}/{{ .Values.global.busyboxImage }}"
35         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
36         volumeMounts:
37           - mountPath: /var/lib/cassandra
38             name: aaf-cass-vol
39         resources:
40           limits:
41             cpu: 100m
42             memory: 100Mi
43           requests:
44             cpu: 30m
45             memory: 100Mi
46       containers:
47       - name: {{ include "common.name" . }}
48         image: {{ include "common.repository" . }}/{{ .Values.image }}
49         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
50         # installing with cmd "onap" will not only initialize the DB, but add ONAP bootstrap data as well
51         command: ["/bin/bash","/opt/app/aaf/cass_init/cmd.sh","onap"]
52         ports: {{ include "common.containerPorts" . | nindent 10  }}
53         env:
54         - name: CASSANDRA_CLUSTER_NAME
55           value: {{ .Values.config.cluster_name }}
56         - name: CASSANDRA_DC
57           value: {{ .Values.config.dc }}
58         - name: CQLSH
59           value: "/opt/cassandra/bin/cqlsh"
60         - name: HEAP_NEWSIZE
61           value: {{ .Values.config.heap_new_size }}
62         - name: MAX_HEAP_SIZE
63           value: {{ .Values.config.max_heap_size }}
64         - name: MY_POD_NAME
65           valueFrom:
66             fieldRef:
67               fieldPath: metadata.name
68         - name: MY_POD_NAMESPACE
69           valueFrom:
70             fieldRef:
71               fieldPath: metadata.namespace
72         - name: MY_POD_IP
73           valueFrom:
74             fieldRef:
75               fieldPath: status.podIP
76         volumeMounts:
77         - mountPath: /var/lib/cassandra
78           name: aaf-cass-vol
79         - mountPath: /etc/localtime
80           name: localtime
81           readOnly: true
82         {{- if eq .Values.liveness.enabled true }}
83         livenessProbe:
84           tcpSocket:
85             port: tcp-cql
86           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
87           periodSeconds: {{ .Values.liveness.periodSeconds }}
88         {{ end -}}
89         readinessProbe:
90           tcpSocket:
91             port: tcp-cql
92           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
93           periodSeconds: {{ .Values.readiness.periodSeconds }}
94         resources: {{ include "common.resources" . | nindent 10 }}
95       {{- if .Values.nodeSelector }}
96       nodeSelector: {{ toYaml .Values.nodeSelector | nindent 10 }}
97       {{- end -}}
98       {{- if .Values.affinity }}
99       affinity: {{ toYaml .Values.affinity | nindent 10 }}
100       {{- end }}
101       volumes:
102       - name: localtime
103         hostPath:
104           path: /etc/localtime
105       - name: aaf-cass-vol
106       {{- if .Values.persistence.enabled }}
107         persistentVolumeClaim:
108           claimName: {{ include "common.fullname" . }}
109       {{- else }}
110         emptyDir: {}
111       {{- end }}
112       imagePullSecrets:
113       - name: "{{ include "common.namespace" . }}-docker-registry-key"