blob: e62d387a0aad8b04fd17ffb5b9b5f77908279da4 [file] [log] [blame]
Jakub Latuseka6d04ad2020-10-21 13:26:45 +02001{{/*
kj52dfb132018-03-27 15:50:39 +03002# Copyright © 2017 Amdocs, Bell Canada
Sylvain Desbureaux8f9ef352020-04-14 15:02:57 +02003# Modifications © 2020 Orange
kj52dfb132018-03-27 15:50:39 +03004#
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.
Jakub Latuseka6d04ad2020-10-21 13:26:45 +020016*/}}
kj52dfb132018-03-27 15:50:39 +030017
Sylvain Desbureaux8f9ef352020-04-14 15:02:57 +020018apiVersion: apps/v1
kj52dfb132018-03-27 15:50:39 +030019kind: Deployment
Sylvain Desbureaux8f9ef352020-04-14 15:02:57 +020020metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
kj52dfb132018-03-27 15:50:39 +030021spec:
Sylvain Desbureaux8f9ef352020-04-14 15:02:57 +020022 selector: {{- include "common.selectors" . | nindent 4 }}
23 replicas: {{ .Values.replicaCount }}
kj52dfb132018-03-27 15:50:39 +030024 template:
Sylvain Desbureaux8f9ef352020-04-14 15:02:57 +020025 metadata: {{- include "common.templateMetadata" . | nindent 6 }}
kj52dfb132018-03-27 15:50:39 +030026 spec:
ChrisCec86a532020-03-19 15:53:31 -050027 initContainers:
28 - name: fix-permission
29 command:
30 - /bin/sh
31 args:
32 - -c
33 - |
Sylvain Desbureaux9e2ca9d2021-01-11 08:15:10 +000034 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
ChrisCec86a532020-03-19 15:53:31 -050046 chown -R 1000:1000 /var/lib/cassandra
Sylvain Desbureaux9e2ca9d2021-01-11 08:15:10 +000047 chown -R 1000:1000 /status
Sylvain Desbureaux0dfa3872020-11-21 21:29:17 +010048 image: {{ include "repositoryGenerator.image.busybox" . }}
ChrisCec86a532020-03-19 15:53:31 -050049 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
50 volumeMounts:
ChrisCec86a532020-03-19 15:53:31 -050051 - mountPath: /var/lib/cassandra
52 name: aaf-cass-vol
Sylvain Desbureaux9e2ca9d2021-01-11 08:15:10 +000053 - 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
Sylvain Desbureaux8f9ef352020-04-14 15:02:57 +020063 resources:
64 limits:
65 cpu: 100m
66 memory: 100Mi
67 requests:
68 cpu: 30m
69 memory: 100Mi
kj52dfb132018-03-27 15:50:39 +030070 containers:
Mandeep Khinda6dcc80d2018-10-09 14:47:35 +000071 - name: {{ include "common.name" . }}
Sylvain Desbureaux0dfa3872020-11-21 21:29:17 +010072 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
kj52dfb132018-03-27 15:50:39 +030073 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
Instrumentalcc3a0bd2019-05-01 14:18:49 -050074 # installing with cmd "onap" will not only initialize the DB, but add ONAP bootstrap data as well
Mandeep Khinda6dcc80d2018-10-09 14:47:35 +000075 command: ["/bin/bash","/opt/app/aaf/cass_init/cmd.sh","onap"]
Sylvain Desbureaux8f9ef352020-04-14 15:02:57 +020076 ports: {{ include "common.containerPorts" . | nindent 10 }}
Mandeep Khinda6dcc80d2018-10-09 14:47:35 +000077 env:
78 - name: CASSANDRA_CLUSTER_NAME
Sylvain Desbureaux8f9ef352020-04-14 15:02:57 +020079 value: {{ .Values.config.cluster_name }}
Mandeep Khinda6dcc80d2018-10-09 14:47:35 +000080 - name: CASSANDRA_DC
Sylvain Desbureaux8f9ef352020-04-14 15:02:57 +020081 value: {{ .Values.config.dc }}
ChrisCec86a532020-03-19 15:53:31 -050082 - name: CQLSH
83 value: "/opt/cassandra/bin/cqlsh"
Mandeep Khinda6dcc80d2018-10-09 14:47:35 +000084 - name: HEAP_NEWSIZE
Sylvain Desbureaux8f9ef352020-04-14 15:02:57 +020085 value: {{ .Values.config.heap_new_size }}
Mandeep Khinda6dcc80d2018-10-09 14:47:35 +000086 - name: MAX_HEAP_SIZE
Sylvain Desbureaux8f9ef352020-04-14 15:02:57 +020087 value: {{ .Values.config.max_heap_size }}
Instrumentalcc3a0bd2019-05-01 14:18:49 -050088 - 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
kj52dfb132018-03-27 15:50:39 +0300100 volumeMounts:
Mandeep Khinda6dcc80d2018-10-09 14:47:35 +0000101 - mountPath: /var/lib/cassandra
Instrumentalcc3a0bd2019-05-01 14:18:49 -0500102 name: aaf-cass-vol
Mahendra Raghuwanshiafb1e2a2018-05-03 12:15:03 +0000103 - mountPath: /etc/localtime
104 name: localtime
105 readOnly: true
Sylvain Desbureaux9e2ca9d2021-01-11 08:15:10 +0000106 - 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
kj52dfb132018-03-27 15:50:39 +0300112 {{- if eq .Values.liveness.enabled true }}
113 livenessProbe:
114 tcpSocket:
Sylvain Desbureaux8f9ef352020-04-14 15:02:57 +0200115 port: tcp-cql
kj52dfb132018-03-27 15:50:39 +0300116 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
117 periodSeconds: {{ .Values.liveness.periodSeconds }}
118 {{ end -}}
119 readinessProbe:
Mike Elliotta91e2bf2018-10-15 11:43:53 -0400120 tcpSocket:
Sylvain Desbureaux8f9ef352020-04-14 15:02:57 +0200121 port: tcp-cql
kj52dfb132018-03-27 15:50:39 +0300122 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
123 periodSeconds: {{ .Values.readiness.periodSeconds }}
Sylvain Desbureaux8f9ef352020-04-14 15:02:57 +0200124 resources: {{ include "common.resources" . | nindent 10 }}
kj52dfb132018-03-27 15:50:39 +0300125 {{- if .Values.nodeSelector }}
Sylvain Desbureaux8f9ef352020-04-14 15:02:57 +0200126 nodeSelector: {{ toYaml .Values.nodeSelector | nindent 10 }}
kj52dfb132018-03-27 15:50:39 +0300127 {{- end -}}
128 {{- if .Values.affinity }}
Sylvain Desbureaux8f9ef352020-04-14 15:02:57 +0200129 affinity: {{ toYaml .Values.affinity | nindent 10 }}
kj52dfb132018-03-27 15:50:39 +0300130 {{- end }}
kj52dfb132018-03-27 15:50:39 +0300131 volumes:
Mandeep Khinda6dcc80d2018-10-09 14:47:35 +0000132 - name: localtime
133 hostPath:
134 path: /etc/localtime
Sylvain Desbureaux9e2ca9d2021-01-11 08:15:10 +0000135 - name: aaf-status
136 emptyDir: {}
Instrumentalcc3a0bd2019-05-01 14:18:49 -0500137 - name: aaf-cass-vol
Mandeep Khinda6dcc80d2018-10-09 14:47:35 +0000138 {{- if .Values.persistence.enabled }}
139 persistentVolumeClaim:
Sylvain Desbureaux8f9ef352020-04-14 15:02:57 +0200140 claimName: {{ include "common.fullname" . }}
Mandeep Khinda6dcc80d2018-10-09 14:47:35 +0000141 {{- else }}
142 emptyDir: {}
143 {{- end }}
Sylvain Desbureaux9e2ca9d2021-01-11 08:15:10 +0000144 - 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: {}
kj52dfb132018-03-27 15:50:39 +0300154 imagePullSecrets:
Instrumental378109d2018-10-16 20:40:41 -0500155 - name: "{{ include "common.namespace" . }}-docker-registry-key"