Chandrasekaran Ramachandran | b515b96 | 2021-06-11 16:07:09 +0530 | [diff] [blame^] | 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 | ################################################################################ |
Chandru | 22ebf74 | 2021-06-02 17:16:37 +0530 | [diff] [blame] | 16 | apiVersion: apps/v1 |
| 17 | kind: StatefulSet |
| 18 | metadata: |
Chandrasekaran Ramachandran | b515b96 | 2021-06-11 16:07:09 +0530 | [diff] [blame^] | 19 | name: {{ include "common.fullname.influxdb" . }}-meta |
Chandru | 22ebf74 | 2021-06-02 17:16:37 +0530 | [diff] [blame] | 20 | labels: |
Chandrasekaran Ramachandran | b515b96 | 2021-06-11 16:07:09 +0530 | [diff] [blame^] | 21 | {{- include "common.influxdb.labels" . | nindent 4 }} |
Chandru | 22ebf74 | 2021-06-02 17:16:37 +0530 | [diff] [blame] | 22 | spec: |
| 23 | {{- if .Values.enterprise.enabled }} |
| 24 | replicas: {{ .Values.enterprise.clusterSize }} |
| 25 | {{ else }} |
| 26 | replicas: 1 |
| 27 | {{- end}} |
| 28 | selector: |
| 29 | matchLabels: |
Chandrasekaran Ramachandran | b515b96 | 2021-06-11 16:07:09 +0530 | [diff] [blame^] | 30 | {{- include "common.influxdb.selectorLabels" . | nindent 6 }} |
| 31 | serviceName: {{ include "common.fullname.influxdb" . }}-meta |
Chandru | 22ebf74 | 2021-06-02 17:16:37 +0530 | [diff] [blame] | 32 | template: |
| 33 | metadata: |
| 34 | labels: |
Chandrasekaran Ramachandran | b515b96 | 2021-06-11 16:07:09 +0530 | [diff] [blame^] | 35 | {{- include "common.influxdb.selectorLabels" . | nindent 8 }} |
Chandru | 22ebf74 | 2021-06-02 17:16:37 +0530 | [diff] [blame] | 36 | {{- 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 Ramachandran | b515b96 | 2021-06-11 16:07:09 +0530 | [diff] [blame^] | 66 | serviceAccountName: {{ include "common.influxdb.serviceAccountName" . }} |
Chandru | 22ebf74 | 2021-06-02 17:16:37 +0530 | [diff] [blame] | 67 | containers: |
Chandrasekaran Ramachandran | b515b96 | 2021-06-11 16:07:09 +0530 | [diff] [blame^] | 68 | - name: {{ include "common.fullname.influxdb" . }} |
Chandru | 22ebf74 | 2021-06-02 17:16:37 +0530 | [diff] [blame] | 69 | 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 Ramachandran | b515b96 | 2021-06-11 16:07:09 +0530 | [diff] [blame^] | 75 | containerPort: {{ include "common.serviceport.influxdb.http.bind_address" . | default 8086 }} |
Chandru | 22ebf74 | 2021-06-02 17:16:37 +0530 | [diff] [blame] | 76 | {{- if .Values.config.graphite.enabled }} |
| 77 | - name: graphite |
Chandrasekaran Ramachandran | b515b96 | 2021-06-11 16:07:09 +0530 | [diff] [blame^] | 78 | containerPort: {{ include "common.serviceport.influxdb.graphite.bind_address" . | default 2003 }} |
Chandru | 22ebf74 | 2021-06-02 17:16:37 +0530 | [diff] [blame] | 79 | {{- end }} |
| 80 | {{- if .Values.config.collectd.enabled }} |
| 81 | - name: collectd |
Chandrasekaran Ramachandran | b515b96 | 2021-06-11 16:07:09 +0530 | [diff] [blame^] | 82 | containerPort: {{ include "common.serviceport.influxdb.collectd.bind_address" . | default 25826 }} |
Chandru | 22ebf74 | 2021-06-02 17:16:37 +0530 | [diff] [blame] | 83 | protocol: UDP |
| 84 | {{- end }} |
| 85 | {{- if .Values.config.udp.enabled }} |
| 86 | - name: udp |
Chandrasekaran Ramachandran | b515b96 | 2021-06-11 16:07:09 +0530 | [diff] [blame^] | 87 | containerPort: {{ include "common.serviceport.influxdb.udp.bind_address" . | default 8089 }} |
Chandru | 22ebf74 | 2021-06-02 17:16:37 +0530 | [diff] [blame] | 88 | protocol: UDP |
| 89 | {{- end }} |
| 90 | {{- if .Values.config.opentsdb.enabled }} |
| 91 | - name: opentsdb |
Chandrasekaran Ramachandran | b515b96 | 2021-06-11 16:07:09 +0530 | [diff] [blame^] | 92 | containerPort: {{ include "common.serviceport.influxdb.opentsdb.bind_address" . | default 4242 }} |
Chandru | 22ebf74 | 2021-06-02 17:16:37 +0530 | [diff] [blame] | 93 | {{- end }} |
| 94 | - name: rpc |
Chandrasekaran Ramachandran | b515b96 | 2021-06-11 16:07:09 +0530 | [diff] [blame^] | 95 | containerPort: {{ include "common.serviceport.influxdb.rpc.bind_address" . | default 8088 }} |
Chandru | 22ebf74 | 2021-06-02 17:16:37 +0530 | [diff] [blame] | 96 | {{- if .Values.enterprise.enabled }} |
| 97 | - name: meta |
Chandrasekaran Ramachandran | b515b96 | 2021-06-11 16:07:09 +0530 | [diff] [blame^] | 98 | containerPort: {{ include "common.serviceport.influxdb.meta.bind_address" . | default 8091 }} |
Chandru | 22ebf74 | 2021-06-02 17:16:37 +0530 | [diff] [blame] | 99 | {{- 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 Ramachandran | b515b96 | 2021-06-11 16:07:09 +0530 | [diff] [blame^] | 105 | value: "$(_HOSTNAME).{{ include "common.fullname.influxdb" . }}" |
Chandru | 22ebf74 | 2021-06-02 17:16:37 +0530 | [diff] [blame] | 106 | {{- 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 Ramachandran | b515b96 | 2021-06-11 16:07:09 +0530 | [diff] [blame^] | 137 | - name: {{ include "common.fullname.influxdb" . }}-data |
Chandru | 22ebf74 | 2021-06-02 17:16:37 +0530 | [diff] [blame] | 138 | 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 Ramachandran | b515b96 | 2021-06-11 16:07:09 +0530 | [diff] [blame^] | 154 | name: {{ include "common.fullname.influxdb" . }} |
Chandru | 22ebf74 | 2021-06-02 17:16:37 +0530 | [diff] [blame] | 155 | {{- if .Values.initScripts.enabled }} |
| 156 | - name: init |
| 157 | configMap: |
Chandrasekaran Ramachandran | b515b96 | 2021-06-11 16:07:09 +0530 | [diff] [blame^] | 158 | name: {{ include "common.fullname.influxdb" . }}-init |
Chandru | 22ebf74 | 2021-06-02 17:16:37 +0530 | [diff] [blame] | 159 | {{- end }} |
| 160 | {{- if (not .Values.persistence.enabled ) }} |
Chandrasekaran Ramachandran | b515b96 | 2021-06-11 16:07:09 +0530 | [diff] [blame^] | 161 | - name: {{ include "common.fullname.influxdb" . }}-data |
Chandru | 22ebf74 | 2021-06-02 17:16:37 +0530 | [diff] [blame] | 162 | 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 Ramachandran | b515b96 | 2021-06-11 16:07:09 +0530 | [diff] [blame^] | 166 | - name: {{ include "common.fullname.influxdb" . }}-data |
Chandru | 22ebf74 | 2021-06-02 17:16:37 +0530 | [diff] [blame] | 167 | 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 Ramachandran | b515b96 | 2021-06-11 16:07:09 +0530 | [diff] [blame^] | 177 | name: {{ include "common.fullname.influxdb" . }}-data |
Chandru | 22ebf74 | 2021-06-02 17:16:37 +0530 | [diff] [blame] | 178 | 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 }} |