Extend K8S and RIC installation instructions
[it/dep.git] / ric-aux / helm / 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: apps/v1
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   selector:
28     matchLabels:
29       app: {{ include "common.name" . }}
30       release: {{ .Release.Name }}
31   template:
32     metadata:
33       labels:
34         app: {{ include "common.name" . }}
35         release: {{ .Release.Name }}
36     spec:
37       containers:
38       - name: {{ include "common.name" . }}
39         image: {{ .Values.global.repository }}/{{.Values.global.aaf.cass.image}}
40         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
41         # installing with cmd "onap" will not only initialize the DB, but add ONAP bootstrap data as well
42         command: ["/bin/bash","/opt/app/aaf/cass_init/cmd.sh","onap"]
43         lifecycle:
44           preStop:
45             exec:
46               command: ["/bin/sh","-c","rm /opt/app/aaf/status/aaf-cass"]
47         ports:
48         - name: storage
49           containerPort: {{.Values.global.aaf.cass.storage_port}}
50         - name: ssl-storage
51           containerPort: {{.Values.global.aaf.cass.ssl_storage_port}}
52         - name: native-trans
53           containerPort: {{.Values.global.aaf.cass.native_trans_port}}
54         - name: rpc
55           containerPort: {{.Values.global.aaf.cass.rpc_port}}
56         env:
57         - name: CASSANDRA_CLUSTER_NAME
58           value: {{.Values.global.aaf.cass.cluster_name}}
59         - name: CASSANDRA_DC
60           value: {{.Values.global.aaf.cass.dc}}
61         - name: HEAP_NEWSIZE
62           value: {{.Values.global.aaf.cass.heap_new_size}}
63         - name: MAX_HEAP_SIZE
64           value: {{.Values.global.aaf.cass.max_heap_size}}
65         - name: MY_POD_NAME
66           valueFrom:
67             fieldRef:
68               fieldPath: metadata.name
69         - name: MY_POD_NAMESPACE
70           valueFrom:
71             fieldRef:
72               fieldPath: metadata.namespace
73         - name: MY_POD_IP
74           valueFrom:
75             fieldRef:
76               fieldPath: status.podIP
77         volumeMounts:
78         - mountPath: /var/lib/cassandra
79           name: aaf-cass-vol
80         - mountPath: /opt/app/aaf/status
81           name: aaf-status-vol
82         - mountPath: /etc/localtime
83           name: localtime
84           readOnly: true
85         {{- if eq .Values.liveness.enabled true }}
86         livenessProbe:
87           tcpSocket:
88             port: {{.Values.global.aaf.cass.native_trans_port}}
89           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
90           periodSeconds: {{ .Values.liveness.periodSeconds }}
91         {{ end -}}
92         readinessProbe:
93           tcpSocket:
94             port: {{.Values.global.aaf.cass.native_trans_port}}
95           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
96           periodSeconds: {{ .Values.readiness.periodSeconds }}
97         resources:
98 {{ include "common.resources" . | indent 10 }}
99       {{- if .Values.nodeSelector }}
100       nodeSelector:
101 {{ toYaml .Values.nodeSelector | indent 10 }}
102       {{- end -}}
103       {{- if .Values.affinity }}
104       affinity:
105 {{ toYaml .Values.affinity | indent 10 }}
106       {{- end }}
107       volumes:
108       - name: localtime
109         hostPath:
110           path: /etc/localtime
111       - name: aaf-status-vol
112         persistentVolumeClaim:
113           claimName: {{ .Release.Name }}-aaf-status-pvc
114       - name: aaf-cass-vol
115       {{- if .Values.persistence.enabled }}
116         persistentVolumeClaim:
117           claimName: {{ include "common.fullname" . }}-pvc
118       {{- else }}
119         emptyDir: {}
120       {{- end }}
121       imagePullSecrets:
122       - name: "{{ include "common.namespace" . }}-docker-registry-key"