Merge "[AAF] Uses new tpls for repos / images"
[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           chown -R 1000:1000 /opt/app/aaf/status
35           chown -R 1000:1000 /var/lib/cassandra
36         image: {{ include "repositoryGenerator.image.busybox" . }}
37         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
38         volumeMounts:
39           - mountPath: /var/lib/cassandra
40             name: aaf-cass-vol
41         resources:
42           limits:
43             cpu: 100m
44             memory: 100Mi
45           requests:
46             cpu: 30m
47             memory: 100Mi
48       containers:
49       - name: {{ include "common.name" . }}
50         image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
51         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
52         # installing with cmd "onap" will not only initialize the DB, but add ONAP bootstrap data as well
53         command: ["/bin/bash","/opt/app/aaf/cass_init/cmd.sh","onap"]
54         ports: {{ include "common.containerPorts" . | nindent 10  }}
55         env:
56         - name: CASSANDRA_CLUSTER_NAME
57           value: {{ .Values.config.cluster_name }}
58         - name: CASSANDRA_DC
59           value: {{ .Values.config.dc }}
60         - name: CQLSH
61           value: "/opt/cassandra/bin/cqlsh"
62         - name: HEAP_NEWSIZE
63           value: {{ .Values.config.heap_new_size }}
64         - name: MAX_HEAP_SIZE
65           value: {{ .Values.config.max_heap_size }}
66         - name: MY_POD_NAME
67           valueFrom:
68             fieldRef:
69               fieldPath: metadata.name
70         - name: MY_POD_NAMESPACE
71           valueFrom:
72             fieldRef:
73               fieldPath: metadata.namespace
74         - name: MY_POD_IP
75           valueFrom:
76             fieldRef:
77               fieldPath: status.podIP
78         volumeMounts:
79         - mountPath: /var/lib/cassandra
80           name: aaf-cass-vol
81         - mountPath: /etc/localtime
82           name: localtime
83           readOnly: true
84         - mountPath: /opt/app/aaf/cass_init/data
85           name: config-cass-init-data
86         - mountPath: /opt/app/aaf/cass_init/dats
87           name: config-cass-init-dats
88         {{- if eq .Values.liveness.enabled true }}
89         livenessProbe:
90           tcpSocket:
91             port: tcp-cql
92           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
93           periodSeconds: {{ .Values.liveness.periodSeconds }}
94         {{ end -}}
95         readinessProbe:
96           tcpSocket:
97             port: tcp-cql
98           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
99           periodSeconds: {{ .Values.readiness.periodSeconds }}
100         resources: {{ include "common.resources" . | nindent 10 }}
101       {{- if .Values.nodeSelector }}
102       nodeSelector: {{ toYaml .Values.nodeSelector | nindent 10 }}
103       {{- end -}}
104       {{- if .Values.affinity }}
105       affinity: {{ toYaml .Values.affinity | nindent 10 }}
106       {{- end }}
107       volumes:
108       - name: localtime
109         hostPath:
110           path: /etc/localtime
111       - name: aaf-cass-vol
112       {{- if .Values.persistence.enabled }}
113         persistentVolumeClaim:
114           claimName: {{ include "common.fullname" . }}
115       {{- else }}
116         emptyDir: {}
117       {{- end }}
118       - name: config-cass-init-dats
119         configMap:
120           name: {{ include "common.fullname" . }}-cass-init-dats
121       - name: config-cass-init-data
122         configMap:
123           name: {{ include "common.fullname" . }}-cass-init-data
124       imagePullSecrets:
125       - name: "{{ include "common.namespace" . }}-docker-registry-key"