16b35c4f12fc4839b189d784177d861717c7ec63
[ric-plt/ric-dep.git] / helm / 3rdparty / influxdb / templates / meta-statefulset.yaml
1 {{- if .Values.enterprise.enabled }}
2 apiVersion: apps/v1
3 kind: StatefulSet
4 metadata:
5   name: {{ include "influxdb.fullname" . }}-meta
6   labels:
7     {{- include "influxdb.labels" . | nindent 4 }}
8     app.kubernetes.io/component: meta
9 spec:
10   replicas: {{ .Values.enterprise.meta.clusterSize }}
11   selector:
12     matchLabels:
13       {{- include "influxdb.selectorLabels" . | nindent 6 }}
14       app.kubernetes.io/component: meta
15   serviceName: "{{ include "influxdb.fullname" . }}-meta"
16   template:
17     metadata:
18       labels:
19         {{- include "influxdb.selectorLabels" . | nindent 8 }}
20         app.kubernetes.io/component: meta
21       {{- if .Values.podAnnotations }}
22       annotations:
23 {{ toYaml .Values.podAnnotations | indent 8 }}
24       {{- end }}
25     spec:
26       {{- if .Values.image.pullSecrets }}
27       imagePullSecrets:
28       {{- range .Values.image.pullSecrets }}
29         - name: {{ . }}
30       {{- end}}
31       {{- end }}
32       serviceAccountName: {{ include "influxdb.serviceAccountName" . }}
33       containers:
34       - name: "{{ include "influxdb.fullname" . }}-meta"
35         image: "{{ .Values.image.repository }}:{{ .Values.enterprise.meta.image.tag }}"
36         imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
37         resources:
38 {{ toYaml .Values.enterprise.meta.resources | indent 10 }}
39         ports:
40         - name: udp
41           containerPort: {{ .Values.config.udp.bind_address |  default 8089 }}
42         - name: rpc
43           containerPort: {{ .Values.config.rpc.bind_address | default 8088 }}
44         - name: meta
45           containerPort: {{ .Values.config.meta.bind_address | default 8091 }}
46         {{- if .Values.env }}
47         env:
48 {{ toYaml .Values.env | indent 10 }}
49           # Values.env's HOSTNAME isn't fundamentally different from $HOSTNAME, but this way we get a distinguished name for InfluxDB at runtime.
50           - name: INFLUXDB_HOSTNAME
51             value: "$(_HOSTNAME).{{ include "influxdb.fullname" . }}-meta"
52         {{- end }}
53         livenessProbe:
54           httpGet:
55             path: {{ .Values.livenessProbe.path | default "/ping" }}
56             port: meta
57           initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds | default 30 }}
58           timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds | default 5 }}
59         readinessProbe:
60           httpGet:
61             path: {{ .Values.readinessProbe.path | default "/ping" }}
62             port: meta
63           initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds | default 5 }}
64           timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds | default 1 }}
65         {{- if .Values.startupProbe.enabled }}
66         startupProbe:
67           httpGet:
68             path: {{ .Values.startupProbe.path | default "/ping" }}
69             port: meta
70           failureThreshold: {{ .Values.startupProbe.failureThreshold | default 6 }}
71           periodSeconds: {{ .Values.startupProbe.periodSeconds | default 5 }}
72         {{- end }}
73         volumeMounts:
74         - name: {{ include "influxdb.fullname" . }}-meta
75           mountPath: /var/lib/influxdb
76         - name: config
77           mountPath: /etc/influxdb
78         {{- if .Values.initScripts.enabled }}
79         - name: init
80           mountPath: /docker-entrypoint-initdb.d
81         {{- end }}
82       volumes:
83       - name: config
84         configMap:
85           name: {{ include "influxdb.fullname" . }}-meta
86       {{- if .Values.initScripts.enabled }}
87       - name: init
88         configMap:
89           name: {{ include "influxdb.fullname" . }}-init
90       {{- end }}
91       {{- if (not .Values.persistence.enabled ) }}
92       - name: {{ include "influxdb.fullname" . }}-meta
93         emptyDir: {}
94       {{- end }}
95     {{- if .Values.schedulerName }}
96       schedulerName: "{{ .Values.schedulerName }}"
97     {{- end }}
98     {{- if .Values.nodeSelector }}
99       nodeSelector:
100 {{ toYaml .Values.nodeSelector | indent 8 }}
101       {{- end -}}
102       {{- if .Values.affinity }}
103       affinity:
104 {{ toYaml .Values.affinity | indent 8 }}
105       {{- end }}
106       {{- if .Values.tolerations }}
107       tolerations:
108 {{ toYaml .Values.tolerations | indent 8 }}
109       {{- end }}
110   {{- if .Values.persistence.enabled }}
111   volumeClaimTemplates:
112     - metadata:
113         name: {{ include "influxdb.fullname" . }}-meta
114         annotations:
115         {{- range $key, $value := .Values.persistence.annotations }}
116           {{ $key }}: "{{ $value }}"
117         {{- end }}
118       spec:
119         accessModes:
120           - {{ .Values.persistence.accessMode | quote}}
121         resources:
122           requests:
123             storage: {{ .Values.persistence.size | quote }}
124       {{- if .Values.persistence.storageClass }}
125       {{- if (eq "-" .Values.persistence.storageClass) }}
126         storageClassName: ""
127       {{- else }}
128         storageClassName: "{{ .Values.persistence.storageClass }}"
129       {{- end }}
130       {{- end }}
131   {{- end }}
132 {{- end }}