[CONSUL] Add limits to consul chart.
[oom.git] / kubernetes / portal / components / portal-cassandra / templates / deployment.yaml
1 # Copyright © 2017 Amdocs, Bell Canada
2 # Modifications Copyright © 2018 AT&T
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 "common.fullname" . }}
20   namespace: {{ include "common.namespace" . }}
21   labels:
22     app: {{ include "common.name" . }}
23     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
24     release: {{ include "common.release" . }}
25     heritage: {{ .Release.Service }}
26 spec:
27   selector:
28     matchLabels:
29       app: {{ include "common.name" . }}
30   replicas: {{ .Values.replicaCount }}
31   template:
32     metadata:
33       labels:
34         app: {{ include "common.name" . }}
35         release: {{ include "common.release" . }}
36     spec:
37       containers:
38       - name: {{ include "common.name" . }}
39         image: "{{ include "common.repository" . }}/{{ .Values.image }}"
40         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
41         ports:
42         - containerPort: {{ .Values.service.internalPort }}
43         - containerPort: {{ .Values.service.internalPort2 }}
44         - containerPort: {{ .Values.service.internalPort3 }}
45         - containerPort: {{ .Values.service.internalPort4 }}
46         - containerPort: {{ .Values.service.internalPort5 }}
47         {{ if eq .Values.liveness.enabled true }}
48         livenessProbe:
49           exec:
50             command:
51             - /bin/bash
52             - -c
53             - nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }'
54           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
55           periodSeconds: {{ .Values.liveness.periodSeconds }}
56         {{ end }}
57         readinessProbe:
58           exec:
59             command:
60             - /bin/bash
61             - -c
62             - nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }'
63           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
64           periodSeconds: {{ .Values.readiness.periodSeconds }}
65         env:
66           - name: CASSUSER
67             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-creds" "key" "login") | indent 12}}
68           - name: CASSPASS
69             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-creds" "key" "password") | indent 12}}
70           - name: JVM_OPTS
71             value: "{{ .Values.config.cassandraJvmOpts }}"
72           - name: POD_IP
73             valueFrom:
74               fieldRef:
75                 fieldPath: status.podIP
76         volumeMounts:
77         - mountPath: /etc/localtime
78           name: localtime
79           readOnly: true
80         - name: cassandra-docker-entrypoint-initdb
81           mountPath: /docker-entrypoint-initdb.d/aaa_portal_single.cql
82           subPath: portal_single.cql
83         - name: {{ include "common.fullname" . }}-data
84           mountPath: /var/lib/cassandra/data
85         resources:
86 {{ include "common.resources" . | indent 12 }}
87       {{- if .Values.nodeSelector }}
88       nodeSelector:
89 {{ toYaml .Values.nodeSelector | indent 10 }}
90       {{- end -}}
91       {{- if .Values.affinity }}
92       affinity:
93 {{ toYaml .Values.affinity | indent 10 }}
94       {{- end }}
95       volumes:
96         - name: cassandra-docker-entrypoint-initdb
97           configMap:
98             name: {{ include "common.fullname" . }}-docker-entry-initd
99         - name: localtime
100           hostPath:
101             path: /etc/localtime
102       {{- if .Values.persistence.enabled }}
103         - name: {{ include "common.fullname" . }}-data
104           persistentVolumeClaim:
105             claimName: {{ include "common.fullname" . }}
106       {{- else }}
107           emptyDir: {}
108       {{- end }}
109       imagePullSecrets:
110       - name: "{{ include "common.namespace" . }}-docker-registry-key"