blob: 4e18b3b7462cff55fe14dd634af2fafc61f392d8 [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 Desbureauxef766402021-02-11 18:12:46 +010034 echo "*** Move files from configmap to emptyDir"
Sylvain Desbureaux9e2ca9d2021-01-11 08:15:10 +000035 cp -L /config-input-dats/* /config-dats/
Sylvain Desbureauxef766402021-02-11 18:12:46 +010036 echo "*** set righ user to the different folders"
Sylvain Desbureaux9e2ca9d2021-01-11 08:15:10 +000037 chown -R 1000:1000 /config-dats
ChrisCec86a532020-03-19 15:53:31 -050038 chown -R 1000:1000 /var/lib/cassandra
Sylvain Desbureaux9e2ca9d2021-01-11 08:15:10 +000039 chown -R 1000:1000 /status
Sylvain Desbureaux0dfa3872020-11-21 21:29:17 +010040 image: {{ include "repositoryGenerator.image.busybox" . }}
ChrisCec86a532020-03-19 15:53:31 -050041 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
42 volumeMounts:
ChrisCec86a532020-03-19 15:53:31 -050043 - mountPath: /var/lib/cassandra
44 name: aaf-cass-vol
Sylvain Desbureaux9e2ca9d2021-01-11 08:15:10 +000045 - mountPath: /config-input-dats
46 name: config-cass-init-dats
47 - mountPath: /config-dats
48 name: config-cass-dats
Sylvain Desbureaux9e2ca9d2021-01-11 08:15:10 +000049 - mountPath: /status
50 name: aaf-status
Sylvain Desbureaux8f9ef352020-04-14 15:02:57 +020051 resources:
52 limits:
53 cpu: 100m
54 memory: 100Mi
55 requests:
56 cpu: 30m
57 memory: 100Mi
kj52dfb132018-03-27 15:50:39 +030058 containers:
Mandeep Khinda6dcc80d2018-10-09 14:47:35 +000059 - name: {{ include "common.name" . }}
Sylvain Desbureaux0dfa3872020-11-21 21:29:17 +010060 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
kj52dfb132018-03-27 15:50:39 +030061 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
Instrumentalcc3a0bd2019-05-01 14:18:49 -050062 # installing with cmd "onap" will not only initialize the DB, but add ONAP bootstrap data as well
Mandeep Khinda6dcc80d2018-10-09 14:47:35 +000063 command: ["/bin/bash","/opt/app/aaf/cass_init/cmd.sh","onap"]
Sylvain Desbureaux8f9ef352020-04-14 15:02:57 +020064 ports: {{ include "common.containerPorts" . | nindent 10 }}
Mandeep Khinda6dcc80d2018-10-09 14:47:35 +000065 env:
66 - name: CASSANDRA_CLUSTER_NAME
Sylvain Desbureaux8f9ef352020-04-14 15:02:57 +020067 value: {{ .Values.config.cluster_name }}
Mandeep Khinda6dcc80d2018-10-09 14:47:35 +000068 - name: CASSANDRA_DC
Sylvain Desbureaux8f9ef352020-04-14 15:02:57 +020069 value: {{ .Values.config.dc }}
ChrisCec86a532020-03-19 15:53:31 -050070 - name: CQLSH
71 value: "/opt/cassandra/bin/cqlsh"
Mandeep Khinda6dcc80d2018-10-09 14:47:35 +000072 - name: HEAP_NEWSIZE
Sylvain Desbureaux8f9ef352020-04-14 15:02:57 +020073 value: {{ .Values.config.heap_new_size }}
Mandeep Khinda6dcc80d2018-10-09 14:47:35 +000074 - name: MAX_HEAP_SIZE
Sylvain Desbureaux8f9ef352020-04-14 15:02:57 +020075 value: {{ .Values.config.max_heap_size }}
Instrumentalcc3a0bd2019-05-01 14:18:49 -050076 - 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
kj52dfb132018-03-27 15:50:39 +030088 volumeMounts:
Mandeep Khinda6dcc80d2018-10-09 14:47:35 +000089 - mountPath: /var/lib/cassandra
Instrumentalcc3a0bd2019-05-01 14:18:49 -050090 name: aaf-cass-vol
Mahendra Raghuwanshiafb1e2a2018-05-03 12:15:03 +000091 - mountPath: /etc/localtime
92 name: localtime
93 readOnly: true
Sylvain Desbureaux9e2ca9d2021-01-11 08:15:10 +000094 - mountPath: /opt/app/aaf/cass_init/dats
95 name: config-cass-dats
96 - mountPath: /opt/app/aaf/status
97 name: aaf-status
kj52dfb132018-03-27 15:50:39 +030098 {{- if eq .Values.liveness.enabled true }}
99 livenessProbe:
100 tcpSocket:
Sylvain Desbureaux8f9ef352020-04-14 15:02:57 +0200101 port: tcp-cql
kj52dfb132018-03-27 15:50:39 +0300102 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
103 periodSeconds: {{ .Values.liveness.periodSeconds }}
104 {{ end -}}
105 readinessProbe:
Mike Elliotta91e2bf2018-10-15 11:43:53 -0400106 tcpSocket:
Sylvain Desbureaux8f9ef352020-04-14 15:02:57 +0200107 port: tcp-cql
kj52dfb132018-03-27 15:50:39 +0300108 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
109 periodSeconds: {{ .Values.readiness.periodSeconds }}
Sylvain Desbureaux8f9ef352020-04-14 15:02:57 +0200110 resources: {{ include "common.resources" . | nindent 10 }}
kj52dfb132018-03-27 15:50:39 +0300111 {{- if .Values.nodeSelector }}
Sylvain Desbureaux8f9ef352020-04-14 15:02:57 +0200112 nodeSelector: {{ toYaml .Values.nodeSelector | nindent 10 }}
kj52dfb132018-03-27 15:50:39 +0300113 {{- end -}}
114 {{- if .Values.affinity }}
Sylvain Desbureaux8f9ef352020-04-14 15:02:57 +0200115 affinity: {{ toYaml .Values.affinity | nindent 10 }}
kj52dfb132018-03-27 15:50:39 +0300116 {{- end }}
kj52dfb132018-03-27 15:50:39 +0300117 volumes:
Mandeep Khinda6dcc80d2018-10-09 14:47:35 +0000118 - name: localtime
119 hostPath:
120 path: /etc/localtime
Sylvain Desbureaux9e2ca9d2021-01-11 08:15:10 +0000121 - name: aaf-status
122 emptyDir: {}
Instrumentalcc3a0bd2019-05-01 14:18:49 -0500123 - name: aaf-cass-vol
Mandeep Khinda6dcc80d2018-10-09 14:47:35 +0000124 {{- if .Values.persistence.enabled }}
125 persistentVolumeClaim:
Sylvain Desbureaux8f9ef352020-04-14 15:02:57 +0200126 claimName: {{ include "common.fullname" . }}
Mandeep Khinda6dcc80d2018-10-09 14:47:35 +0000127 {{- else }}
128 emptyDir: {}
129 {{- end }}
Sylvain Desbureaux9e2ca9d2021-01-11 08:15:10 +0000130 - name: config-cass-init-dats
131 configMap:
132 name: {{ include "common.fullname" . }}-cass-init-dats
Sylvain Desbureaux9e2ca9d2021-01-11 08:15:10 +0000133 - name: config-cass-dats
134 emptyDir: {}
kj52dfb132018-03-27 15:50:39 +0300135 imagePullSecrets:
Instrumental378109d2018-10-16 20:40:41 -0500136 - name: "{{ include "common.namespace" . }}-docker-registry-key"