Merge "[DMAAP] DMaaP ServiceMesh compatibility"
[oom.git] / kubernetes / aaf / components / aaf-cass / templates / deployment.yaml
1 {{/*
2 # Copyright © 2017 Amdocs, Bell Canada
3 # Modifications © 2020 Orange
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #       http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 */}}
17
18 apiVersion: apps/v1
19 kind: Deployment
20 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
21 spec:
22   selector: {{- include "common.selectors" . | nindent 4 }}
23   replicas: {{ .Values.replicaCount }}
24   template:
25     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
26     spec:
27       initContainers:
28       - name: fix-permission
29         command:
30         - /bin/sh
31         args:
32         - -c
33         - |
34           echo "*** Move files from configmap to emptyDir"
35           cp -L /config-input-dats/* /config-dats/
36           echo "*** set righ user to the different folders"
37           chown -R 1000:1000 /config-dats
38           chown -R 1000:1000 /var/lib/cassandra
39           chown -R 1000:1000 /status
40         image: {{ include "repositoryGenerator.image.busybox" . }}
41         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
42         volumeMounts:
43           - mountPath: /var/lib/cassandra
44             name: aaf-cass-vol
45           - mountPath: /config-input-dats
46             name: config-cass-init-dats
47           - mountPath: /config-dats
48             name: config-cass-dats
49           - mountPath: /status
50             name: aaf-status
51         resources:
52           limits:
53             cpu: 100m
54             memory: 100Mi
55           requests:
56             cpu: 30m
57             memory: 100Mi
58       containers:
59       - name: {{ include "common.name" . }}
60         image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
61         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
62         # installing with cmd "onap" will not only initialize the DB, but add ONAP bootstrap data as well
63         command: ["/bin/bash","/opt/app/aaf/cass_init/cmd.sh","onap"]
64         ports: {{ include "common.containerPorts" . | nindent 10  }}
65         env:
66         - name: CASSANDRA_CLUSTER_NAME
67           value: {{ .Values.config.cluster_name }}
68         - name: CASSANDRA_DC
69           value: {{ .Values.config.dc }}
70         - name: CQLSH
71           value: "/opt/cassandra/bin/cqlsh"
72         - name: HEAP_NEWSIZE
73           value: {{ .Values.config.heap_new_size }}
74         - name: MAX_HEAP_SIZE
75           value: {{ .Values.config.max_heap_size }}
76         - name: MY_POD_NAME
77           valueFrom:
78             fieldRef:
79               fieldPath: metadata.name
80         - name: MY_POD_NAMESPACE
81           valueFrom:
82             fieldRef:
83               fieldPath: metadata.namespace
84         - name: MY_POD_IP
85           valueFrom:
86             fieldRef:
87               fieldPath: status.podIP
88         volumeMounts:
89         - mountPath: /var/lib/cassandra
90           name: aaf-cass-vol
91         - mountPath: /etc/localtime
92           name: localtime
93           readOnly: true
94         - mountPath: /opt/app/aaf/cass_init/dats
95           name: config-cass-dats
96         - mountPath: /opt/app/aaf/status
97           name: aaf-status
98         {{- if eq .Values.liveness.enabled true }}
99         livenessProbe:
100           tcpSocket:
101             port: tcp-cql
102           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
103           periodSeconds: {{ .Values.liveness.periodSeconds }}
104         {{ end -}}
105         readinessProbe:
106           tcpSocket:
107             port: tcp-cql
108           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
109           periodSeconds: {{ .Values.readiness.periodSeconds }}
110         resources: {{ include "common.resources" . | nindent 10 }}
111       {{- if .Values.nodeSelector }}
112       nodeSelector: {{ toYaml .Values.nodeSelector | nindent 10 }}
113       {{- end -}}
114       {{- if .Values.affinity }}
115       affinity: {{ toYaml .Values.affinity | nindent 10 }}
116       {{- end }}
117       volumes:
118       - name: localtime
119         hostPath:
120           path: /etc/localtime
121       - name: aaf-status
122         emptyDir: {}
123       - name: aaf-cass-vol
124       {{- if .Values.persistence.enabled }}
125         persistentVolumeClaim:
126           claimName: {{ include "common.fullname" . }}
127       {{- else }}
128         emptyDir: {}
129       {{- end }}
130       - name: config-cass-init-dats
131         configMap:
132           name: {{ include "common.fullname" . }}-cass-init-dats
133       - name: config-cass-dats
134         emptyDir: {}
135       imagePullSecrets:
136       - name: "{{ include "common.namespace" . }}-docker-registry-key"