blob: eac88703cf57dd9cc056920703d99851d1f5dda3 [file] [log] [blame]
Chandrasekaran Ramachandranb515b962021-06-11 16:07:09 +05301################################################################################
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################################################################################
Chandru22ebf742021-06-02 17:16:37 +053016apiVersion: apps/v1
17kind: StatefulSet
18metadata:
Chandrasekaran Ramachandranb515b962021-06-11 16:07:09 +053019 name: {{ include "common.fullname.influxdb" . }}-meta
Chandru22ebf742021-06-02 17:16:37 +053020 labels:
Chandrasekaran Ramachandranb515b962021-06-11 16:07:09 +053021 {{- include "common.influxdb.labels" . | nindent 4 }}
Chandru22ebf742021-06-02 17:16:37 +053022spec:
23 {{- if .Values.enterprise.enabled }}
24 replicas: {{ .Values.enterprise.clusterSize }}
25 {{ else }}
26 replicas: 1
27 {{- end}}
28 selector:
29 matchLabels:
Chandrasekaran Ramachandranb515b962021-06-11 16:07:09 +053030 {{- include "common.influxdb.selectorLabels" . | nindent 6 }}
31 serviceName: {{ include "common.fullname.influxdb" . }}-meta
Chandru22ebf742021-06-02 17:16:37 +053032 template:
33 metadata:
34 labels:
Chandrasekaran Ramachandranb515b962021-06-11 16:07:09 +053035 {{- include "common.influxdb.selectorLabels" . | nindent 8 }}
Chandru22ebf742021-06-02 17:16:37 +053036 {{- if .Values.podAnnotations }}
37 annotations:
38{{ toYaml .Values.podAnnotations | indent 8 }}
39 {{- end }}
40 spec:
41 {{- if .Values.schedulerName }}
42 schedulerName: "{{ .Values.schedulerName }}"
43 {{- end }}
44 {{- if .Values.nodeSelector }}
45 nodeSelector:
46{{ toYaml .Values.nodeSelector | indent 8 }}
47 {{- end -}}
48 {{- if .Values.affinity }}
49 affinity:
50{{ toYaml .Values.affinity | indent 8 }}
51 {{- end }}
52 {{- if .Values.tolerations }}
53 tolerations:
54{{ toYaml .Values.tolerations | indent 8 }}
55 {{- end }}
56 {{- if .Values.securityContext }}
57 securityContext:
58{{ toYaml .Values.securityContext | indent 8 }}
59 {{- end }}
60 {{- if .Values.image.pullSecrets }}
61 imagePullSecrets:
62 {{- range .Values.image.pullSecrets }}
63 - name: {{ . }}
64 {{- end}}
65 {{- end }}
Chandrasekaran Ramachandranb515b962021-06-11 16:07:09 +053066 serviceAccountName: {{ include "common.influxdb.serviceAccountName" . }}
Chandru22ebf742021-06-02 17:16:37 +053067 containers:
Chandrasekaran Ramachandranb515b962021-06-11 16:07:09 +053068 - name: {{ include "common.fullname.influxdb" . }}
Chandru22ebf742021-06-02 17:16:37 +053069 image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
70 imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
71 resources:
72{{ toYaml .Values.resources | indent 10 }}
73 ports:
74 - name: api
Chandrasekaran Ramachandranb515b962021-06-11 16:07:09 +053075 containerPort: {{ include "common.serviceport.influxdb.http.bind_address" . | default 8086 }}
Chandru22ebf742021-06-02 17:16:37 +053076 {{- if .Values.config.graphite.enabled }}
77 - name: graphite
Chandrasekaran Ramachandranb515b962021-06-11 16:07:09 +053078 containerPort: {{ include "common.serviceport.influxdb.graphite.bind_address" . | default 2003 }}
Chandru22ebf742021-06-02 17:16:37 +053079 {{- end }}
80 {{- if .Values.config.collectd.enabled }}
81 - name: collectd
Chandrasekaran Ramachandranb515b962021-06-11 16:07:09 +053082 containerPort: {{ include "common.serviceport.influxdb.collectd.bind_address" . | default 25826 }}
Chandru22ebf742021-06-02 17:16:37 +053083 protocol: UDP
84 {{- end }}
85 {{- if .Values.config.udp.enabled }}
86 - name: udp
Chandrasekaran Ramachandranb515b962021-06-11 16:07:09 +053087 containerPort: {{ include "common.serviceport.influxdb.udp.bind_address" . | default 8089 }}
Chandru22ebf742021-06-02 17:16:37 +053088 protocol: UDP
89 {{- end }}
90 {{- if .Values.config.opentsdb.enabled }}
91 - name: opentsdb
Chandrasekaran Ramachandranb515b962021-06-11 16:07:09 +053092 containerPort: {{ include "common.serviceport.influxdb.opentsdb.bind_address" . | default 4242 }}
Chandru22ebf742021-06-02 17:16:37 +053093 {{- end }}
94 - name: rpc
Chandrasekaran Ramachandranb515b962021-06-11 16:07:09 +053095 containerPort: {{ include "common.serviceport.influxdb.rpc.bind_address" . | default 8088 }}
Chandru22ebf742021-06-02 17:16:37 +053096 {{- if .Values.enterprise.enabled }}
97 - name: meta
Chandrasekaran Ramachandranb515b962021-06-11 16:07:09 +053098 containerPort: {{ include "common.serviceport.influxdb.meta.bind_address" . | default 8091 }}
Chandru22ebf742021-06-02 17:16:37 +053099 {{- end }}
100 {{- if .Values.env }}
101 env:
102{{ toYaml .Values.env | indent 10 }}
103 {{- if .Values.enterprise.enabled }}
104 - name: INFLUXDB_HOSTNAME # Values.env's HOSTNAME isn't fundamentally different from $HOSTNAME, but this way weg get a distinguished name at runtime.
Chandrasekaran Ramachandranb515b962021-06-11 16:07:09 +0530105 value: "$(_HOSTNAME).{{ include "common.fullname.influxdb" . }}"
Chandru22ebf742021-06-02 17:16:37 +0530106 {{- end }}
107 {{- end }}
108 {{- if .Values.envFromSecret }}
109 envFrom:
110 - secretRef:
111 name: {{ .Values.envFromSecret }}
112 {{- end }}
113 livenessProbe:
114 httpGet:
115 path: {{ .Values.livenessProbe.path | default "/ping" }}
116 port: api
117 scheme: {{ .Values.livenessProbe.scheme | default "HTTP" }}
118 initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds | default 30 }}
119 timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds | default 5 }}
120 readinessProbe:
121 httpGet:
122 path: {{ .Values.readinessProbe.path | default "/ping" }}
123 port: api
124 scheme: {{ .Values.readinessProbe.scheme | default "HTTP" }}
125 initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds | default 5 }}
126 timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds | default 1 }}
127 {{- if .Values.startupProbe.enabled }}
128 startupProbe:
129 httpGet:
130 path: {{ .Values.startupProbe.path | default "/ping" }}
131 port: api
132 scheme: {{ .Values.startupProbe.scheme | default "HTTP" }}
133 failureThreshold: {{ .Values.startupProbe.failureThreshold | default 6 }}
134 periodSeconds: {{ .Values.startupProbe.periodSeconds | default 5 }}
135 {{- end }}
136 volumeMounts:
Chandrasekaran Ramachandranb515b962021-06-11 16:07:09 +0530137 - name: {{ include "common.fullname.influxdb" . }}-data
Chandru22ebf742021-06-02 17:16:37 +0530138 mountPath: /var/lib/influxdb
139 - name: config
140 mountPath: /etc/influxdb
141 {{- if .Values.initScripts.enabled }}
142 - name: init
143 mountPath: /docker-entrypoint-initdb.d
144 {{- end }}
145 {{- if .Values.mountPoints }}
146{{ toYaml .Values.mountPoints | indent 8 }}
147 {{- end }}
148 {{- if .Values.extraContainers }}
149{{ toYaml .Values.extraContainers | indent 6}}
150 {{- end }}
151 volumes:
152 - name: config
153 configMap:
Chandrasekaran Ramachandranb515b962021-06-11 16:07:09 +0530154 name: {{ include "common.fullname.influxdb" . }}
Chandru22ebf742021-06-02 17:16:37 +0530155 {{- if .Values.initScripts.enabled }}
156 - name: init
157 configMap:
Chandrasekaran Ramachandranb515b962021-06-11 16:07:09 +0530158 name: {{ include "common.fullname.influxdb" . }}-init
Chandru22ebf742021-06-02 17:16:37 +0530159 {{- end }}
160 {{- if (not .Values.persistence.enabled ) }}
Chandrasekaran Ramachandranb515b962021-06-11 16:07:09 +0530161 - name: {{ include "common.fullname.influxdb" . }}-data
Chandru22ebf742021-06-02 17:16:37 +0530162 emptyDir: {}
163 {{- end }}
164 # Cannot use existing claim in enterprise mode
165 {{- if and .Values.persistence.enabled .Values.persistence.existingClaim (not .Values.enterprise.enabled) }}
Chandrasekaran Ramachandranb515b962021-06-11 16:07:09 +0530166 - name: {{ include "common.fullname.influxdb" . }}-data
Chandru22ebf742021-06-02 17:16:37 +0530167 persistentVolumeClaim:
168 claimName: {{ .Values.persistence.existingClaim }}
169 {{- end }}
170 {{- if .Values.volumes }}
171{{ toYaml .Values.volumes | indent 6 }}
172 {{- end }}
173 # Must use volume claim template in enterprise mode
174 {{- if and .Values.persistence.enabled (or (not .Values.persistence.existingClaim) .Values.enterprise.enabled) }}
175 volumeClaimTemplates:
176 - metadata:
Chandrasekaran Ramachandranb515b962021-06-11 16:07:09 +0530177 name: {{ include "common.fullname.influxdb" . }}-data
Chandru22ebf742021-06-02 17:16:37 +0530178 annotations:
179 {{- range $key, $value := .Values.persistence.annotations }}
180 {{ $key }}: "{{ $value }}"
181 {{- end }}
182 spec:
183 accessModes:
184 - {{ .Values.persistence.accessMode | quote}}
185 resources:
186 requests:
187 storage: {{ .Values.persistence.size | quote }}
188 {{- if .Values.persistence.storageClass }}
189 {{- if (eq "-" .Values.persistence.storageClass) }}
190 storageClassName: ""
191 {{- else }}
192 storageClassName: "{{ .Values.persistence.storageClass }}"
193 {{- end }}
194 {{- end }}
195 {{- end }}