Issue-ID: RICAPP-169 - Inclusion of InfluxDB helm chart for KPIMON, AD, TS, QP xApps
[ric-plt/ric-dep.git] / helm / 3rdparty / influxdb / templates / meta-statefulset.yaml
1 ################################################################################
2 #   Copyright (c) 2021 HCL Technolgies Limited.                                #
3 #                                                                              #
4 #   Licensed under the Apache License, Version 2.0 (the "License");            #
5 #   you may not use this file except in compliance with the License.           #
6 #   You may obtain a copy of the License at                                    #
7 #                                                                              #
8 #       http://www.apache.org/licenses/LICENSE-2.0                             #
9 #                                                                              #
10 #   Unless required by applicable law or agreed to in writing, software        #
11 #   distributed under the License is distributed on an "AS IS" BASIS,          #
12 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
13 #   See the License for the specific language governing permissions and        #
14 #   limitations under the License.                                             #
15 ################################################################################
16 {{- if .Values.enterprise.enabled }}
17 apiVersion: apps/v1
18 kind: StatefulSet
19 metadata:
20   name: {{ include "common.fullname.influxdb" . }}-meta
21   labels:
22     {{- include "common.influxdb.labels" . | nindent 4 }}
23     app.kubernetes.io/component: meta
24 spec:
25   replicas: {{ .Values.enterprise.meta.clusterSize }}
26   selector:
27     matchLabels:
28       {{- include "common.influxdb.selectorLabels" . | nindent 6 }}
29       app.kubernetes.io/component: meta
30   serviceName: "{{ include "common.fullname.influxdb" . }}-meta"
31   template:
32     metadata:
33       labels:
34         {{- include "common.influxdb.selectorLabels" . | nindent 8 }}
35         app.kubernetes.io/component: meta
36       {{- if .Values.podAnnotations }}
37       annotations:
38 {{ toYaml .Values.podAnnotations | indent 8 }}
39       {{- end }}
40     spec:
41       {{- if .Values.image.pullSecrets }}
42       imagePullSecrets:
43       {{- range .Values.image.pullSecrets }}
44         - name: {{ . }}
45       {{- end}}
46       {{- end }}
47       serviceAccountName: {{ include "common.influxdb.serviceAccountName" . }}
48       containers:
49       - name: "{{ include "common.fullname.influxdb" . }}-meta"
50         image: "{{ .Values.image.repository }}:{{ .Values.enterprise.meta.image.tag }}"
51         imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
52         resources:
53 {{ toYaml .Values.enterprise.meta.resources | indent 10 }}
54         ports:
55         - name: udp
56           containerPort: {{ include "common.serviceport.influxdb.udp.bind_address" . |  default 8089 }}
57         - name: rpc
58           containerPort: {{ include "common.serviceport.influxdb.rpc.bind_address" . | default 8088 }}
59         - name: meta
60           containerPort: {{ include "common.serviceport.influxdb.meta.bind_address" . | default 8091 }}
61         {{- if .Values.env }}
62         env:
63 {{ toYaml .Values.env | indent 10 }}
64           # Values.env's HOSTNAME isn't fundamentally different from $HOSTNAME, but this way we get a distinguished name for InfluxDB at runtime.
65           - name: INFLUXDB_HOSTNAME
66             value: "$(_HOSTNAME).{{ include "common.fullname.influxdb" . }}-meta"
67         {{- end }}
68         livenessProbe:
69           httpGet:
70             path: {{ .Values.livenessProbe.path | default "/ping" }}
71             port: meta
72           initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds | default 30 }}
73           timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds | default 5 }}
74         readinessProbe:
75           httpGet:
76             path: {{ .Values.readinessProbe.path | default "/ping" }}
77             port: meta
78           initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds | default 5 }}
79           timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds | default 1 }}
80         {{- if .Values.startupProbe.enabled }}
81         startupProbe:
82           httpGet:
83             path: {{ .Values.startupProbe.path | default "/ping" }}
84             port: meta
85           failureThreshold: {{ .Values.startupProbe.failureThreshold | default 6 }}
86           periodSeconds: {{ .Values.startupProbe.periodSeconds | default 5 }}
87         {{- end }}
88         volumeMounts:
89         - name: {{ include "common.fullname.influxdb" . }}-meta
90           mountPath: /var/lib/influxdb
91         - name: config
92           mountPath: /etc/influxdb
93         {{- if .Values.initScripts.enabled }}
94         - name: init
95           mountPath: /docker-entrypoint-initdb.d
96         {{- end }}
97       volumes:
98       - name: config
99         configMap:
100           name: {{ include "common.fullname.influxdb" . }}-meta
101       {{- if .Values.initScripts.enabled }}
102       - name: init
103         configMap:
104           name: {{ include "common.fullname.influxdb" . }}-init
105       {{- end }}
106       {{- if (not .Values.persistence.enabled ) }}
107       - name: {{ include "common.fullname.influxdb" . }}-meta
108         emptyDir: {}
109       {{- end }}
110     {{- if .Values.schedulerName }}
111       schedulerName: "{{ .Values.schedulerName }}"
112     {{- end }}
113     {{- if .Values.nodeSelector }}
114       nodeSelector:
115 {{ toYaml .Values.nodeSelector | indent 8 }}
116       {{- end -}}
117       {{- if .Values.affinity }}
118       affinity:
119 {{ toYaml .Values.affinity | indent 8 }}
120       {{- end }}
121       {{- if .Values.tolerations }}
122       tolerations:
123 {{ toYaml .Values.tolerations | indent 8 }}
124       {{- end }}
125   {{- if .Values.persistence.enabled }}
126   volumeClaimTemplates:
127     - metadata:
128         name: {{ include "common.fullname.influxdb" . }}-meta
129         annotations:
130         {{- range $key, $value := .Values.persistence.annotations }}
131           {{ $key }}: "{{ $value }}"
132         {{- end }}
133       spec:
134         accessModes:
135           - {{ .Values.persistence.accessMode | quote}}
136         resources:
137           requests:
138             storage: {{ .Values.persistence.size | quote }}
139       {{- if .Values.persistence.storageClass }}
140       {{- if (eq "-" .Values.persistence.storageClass) }}
141         storageClassName: ""
142       {{- else }}
143         storageClassName: "{{ .Values.persistence.storageClass }}"
144       {{- end }}
145       {{- end }}
146   {{- end }}
147 {{- end }}