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