c664d034bb9cce1926bf0744baa7417573e742f8
[oom.git] / kubernetes / aaf / charts / aaf-cass / templates / deployment.yaml
1 # Copyright © 2017 Amdocs, Bell Canada
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #       http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 apiVersion: extensions/v1beta1
16 kind: Deployment
17 metadata:
18   name: {{ include "common.fullname" . }}
19   namespace: {{ include "common.namespace" . }}
20   labels:
21     app: {{ include "common.name" . }}
22     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
23     release: {{ .Release.Name }}
24     heritage: {{ .Release.Service }}
25 spec:
26   replicas: {{ .Values.global.aaf.cass.replicas }}
27   template:
28     metadata:
29       labels:
30         app: {{ include "common.name" . }}
31         release: {{ .Release.Name }}
32     spec:
33       containers:
34       - name: {{ include "common.name" . }}
35         image: {{ .Values.global.repository }}/onap/aaf/aaf_cass:{{.Values.global.aaf.imageVersion}}
36         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
37         # installing with cmd "onap" will not only initialize the DB, but add ONAP bootstrap data as well
38         command: ["/bin/bash","/opt/app/aaf/cass_init/cmd.sh","onap"]
39         lifecycle:
40           preStop:
41             exec:
42               command: ["/bin/sh","-c","rm /opt/app/aaf/status/aaf-cass"]
43         ports:
44         - name: storage
45           containerPort: {{.Values.global.aaf.cass.storage_port}}
46         - name: ssl-storage
47           containerPort: {{.Values.global.aaf.cass.ssl_storage_port}}
48         - name: native-trans
49           containerPort: {{.Values.global.aaf.cass.native_trans_port}}
50         - name: rpc
51           containerPort: {{.Values.global.aaf.cass.rpc_port}}
52         env:
53         - name: CASSANDRA_CLUSTER_NAME
54           value: {{.Values.global.aaf.cass.cluster_name}}
55         - name: CASSANDRA_DC
56           value: {{.Values.global.aaf.cass.dc}}
57         - name: HEAP_NEWSIZE
58           value: {{.Values.global.aaf.cass.heap_new_size}}
59         - name: MAX_HEAP_SIZE
60           value: {{.Values.global.aaf.cass.max_heap_size}}
61         - name: MY_POD_NAME
62           valueFrom:
63             fieldRef:
64               fieldPath: metadata.name
65         - name: MY_POD_NAMESPACE
66           valueFrom:
67             fieldRef:
68               fieldPath: metadata.namespace
69         - name: MY_POD_IP
70           valueFrom:
71             fieldRef:
72               fieldPath: status.podIP
73         volumeMounts:
74         - mountPath: /var/lib/cassandra
75           name: aaf-cass-vol
76         - mountPath: /opt/app/aaf/status
77           name: aaf-status-vol
78         - mountPath: /etc/localtime
79           name: localtime
80           readOnly: true
81         {{- if eq .Values.liveness.enabled true }}
82         livenessProbe:
83           tcpSocket:
84             port: {{.Values.global.aaf.cass.native_trans_port}}
85           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
86           periodSeconds: {{ .Values.liveness.periodSeconds }}
87         {{ end -}}
88         readinessProbe:
89           tcpSocket:
90             port: {{.Values.global.aaf.cass.native_trans_port}}
91           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
92           periodSeconds: {{ .Values.readiness.periodSeconds }}
93         resources:
94 {{ include "common.resources" . | indent 10 }}
95       {{- if .Values.nodeSelector }}
96       nodeSelector:
97 {{ toYaml .Values.nodeSelector | indent 10 }}
98       {{- end -}}
99       {{- if .Values.affinity }}
100       affinity:
101 {{ toYaml .Values.affinity | indent 10 }}
102       {{- end }}
103       volumes:
104       - name: localtime
105         hostPath:
106           path: /etc/localtime
107       - name: aaf-status-vol
108         persistentVolumeClaim:
109           claimName: {{ .Release.Name }}-aaf-status-pvc
110       - name: aaf-cass-vol
111       {{- if .Values.persistence.enabled }}
112         persistentVolumeClaim:
113           claimName: {{ include "common.fullname" . }}-pvc
114       {{- else }}
115         emptyDir: {}
116       {{- end }}
117       imagePullSecrets:
118       - name: "{{ include "common.namespace" . }}-docker-registry-key"