[DCAEGEN2] Update cm-container and consul-loader
[oom.git] / kubernetes / portal / components / portal-cassandra / templates / deployment.yaml
1 {{/*
2 # Copyright (c) 2017 Amdocs, Bell Canada
3 # Modifications Copyright (c) 2018 AT&T
4 # Modifications Copyright (c) 2020 Nokia
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 implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 */}}
18
19 apiVersion: apps/v1
20 kind: Deployment
21 metadata:
22   name: {{ include "common.fullname" . }}
23   namespace: {{ include "common.namespace" . }}
24   labels:
25     app: {{ include "common.name" . }}
26     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
27     release: {{ include "common.release" . }}
28     heritage: {{ .Release.Service }}
29 spec:
30   selector:
31     matchLabels:
32       app: {{ include "common.name" . }}
33   replicas: {{ .Values.replicaCount }}
34   template:
35     metadata:
36       labels:
37         app: {{ include "common.name" . }}
38         release: {{ include "common.release" . }}
39     spec:
40       containers:
41       - name: {{ include "common.name" . }}
42         image: {{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.image }}
43         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
44         command:
45         - /bin/bash
46         - -c
47         - |
48           /opt/bitnami/scripts/cassandra/entrypoint.sh /opt/bitnami/scripts/cassandra/run.sh
49         ports:
50         - containerPort: {{ .Values.service.internalPort }}
51         - containerPort: {{ .Values.service.internalPort2 }}
52         - containerPort: {{ .Values.service.internalPort3 }}
53         - containerPort: {{ .Values.service.internalPort4 }}
54         - containerPort: {{ .Values.service.internalPort5 }}
55         {{ if eq .Values.liveness.enabled true }}
56         livenessProbe:
57           exec:
58             command:
59             - /bin/bash
60             - -ec
61             - |
62               nodetool status
63           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
64           periodSeconds: {{ .Values.liveness.periodSeconds }}
65           successThreshold: {{ .Values.liveness.successThreshold }}
66           failureThreshold: {{ .Values.liveness.failureThreshold }}
67         {{ end }}
68         readinessProbe:
69           exec:
70             command:
71             - /bin/bash
72             - -ec
73             - |
74               nodetool status | grep -E "^UN\\s+${POD_IP}"
75           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
76           periodSeconds: {{ .Values.readiness.periodSeconds }}
77           successThreshold: {{ .Values.readiness.successThreshold }}
78           failureThreshold: {{ .Values.readiness.failureThreshold }}
79         lifecycle:
80           preStop:
81             exec:
82               command:
83               - bash
84               - -ec
85               - nodetool decommission
86         env:
87           - name: CASSANDRA_USER
88             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-creds" "key" "login") | indent 12}}
89           - name: CASSANDRA_PASSWORD
90             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-creds" "key" "password") | indent 12}}
91           - name: POD_IP
92             valueFrom:
93               fieldRef:
94                 fieldPath: status.podIP
95           - name: CASSANDRA_PASSWORD_SEEDER
96             value: "yes"
97           - name: BITNAMI_DEBUG
98             value: "true"
99           - name: CASSANDRA_CLUSTER_NAME
100             value: cassandra
101           - name: CASSANDRA_NUM_TOKENS
102             value: "256"
103           - name: CASSANDRA_DATACENTER
104             value: dc1
105           - name: CASSANDRA_ENDPOINT_SNITCH
106             value: SimpleSnitch
107           - name: CASSANDRA_RACK
108             value: rack1
109           - name: CASSANDRA_ENABLE_RPC
110             value: "true"
111         volumeMounts:
112         - mountPath: /etc/localtime
113           name: localtime
114           readOnly: true
115         - name: cassandra-docker-entrypoint-initdb
116           mountPath: /docker-entrypoint-initdb.d/aaa_portal.cql
117           subPath: portal.cql
118         - name: {{ include "common.fullname" . }}-data
119           mountPath: /var/lib/cassandra/data
120         resources:
121 {{ include "common.resources" . | indent 12 }}
122       {{- if .Values.nodeSelector }}
123       nodeSelector:
124 {{ toYaml .Values.nodeSelector | indent 10 }}
125       {{- end -}}
126       {{- if .Values.affinity }}
127       affinity:
128 {{ toYaml .Values.affinity | indent 10 }}
129       {{- end }}
130       volumes:
131         - name: cassandra-docker-entrypoint-initdb
132           configMap:
133             name: {{ include "common.fullname" . }}-docker-entry-initd
134         - name: localtime
135           hostPath:
136             path: /etc/localtime
137       {{- if .Values.persistence.enabled }}
138         - name: {{ include "common.fullname" . }}-data
139           persistentVolumeClaim:
140             claimName: {{ include "common.fullname" . }}
141       {{- else }}
142           emptyDir: {}
143       {{- end }}
144       imagePullSecrets:
145       - name: "{{ include "common.namespace" . }}-docker-registry-key"