diff --git a/charts/influxdb2/Chart.yaml b/charts/influxdb2/Chart.yaml index b8110cea3875064e75af5fed2c9905d923909c8d..13b841b30af9bc689d9f96856025175aa5f35d13 100644 --- a/charts/influxdb2/Chart.yaml +++ b/charts/influxdb2/Chart.yaml @@ -4,7 +4,7 @@ name: influxdb2 description: A Helm chart for InfluxDB v2 home: https://www.influxdata.com/products/influxdb/ type: application -version: 2.0.12 +version: 2.1.0 maintainers: - name: rawkode email: rawkode@influxdata.com diff --git a/charts/influxdb2/ci/default-values.yaml b/charts/influxdb2/ci/default-values.yaml new file mode 100644 index 0000000000000000000000000000000000000000..986b68f147a4898bfc236e4a2ed219dbd8357e4b --- /dev/null +++ b/charts/influxdb2/ci/default-values.yaml @@ -0,0 +1 @@ +# Default values only, no overrides diff --git a/charts/influxdb2/ci/init-scripts-values.yaml b/charts/influxdb2/ci/init-scripts-values.yaml new file mode 100644 index 0000000000000000000000000000000000000000..4116994005112275ddd4bfed063d9854d59b1e05 --- /dev/null +++ b/charts/influxdb2/ci/init-scripts-values.yaml @@ -0,0 +1,5 @@ +initScripts: + enabled: true + +persistence: + enabled: false diff --git a/charts/influxdb2/templates/_helpers.tpl b/charts/influxdb2/templates/_helpers.tpl index f65c65b8d675f84af396c09da87b200feb9d5b2d..aa82dac22484d3b10c66ae140f6a48dba0ead076 100644 --- a/charts/influxdb2/templates/_helpers.tpl +++ b/charts/influxdb2/templates/_helpers.tpl @@ -36,12 +36,12 @@ Common labels */}} {{- define "influxdb.labels" -}} app.kubernetes.io/name: {{ include "influxdb.name" . }} -helm.sh/chart: {{ include "influxdb.chart" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} app.kubernetes.io/managed-by: {{ .Release.Service }} +helm.sh/chart: {{ include "influxdb.chart" . }} {{- end -}} {{/* diff --git a/charts/influxdb2/templates/init-config.yaml b/charts/influxdb2/templates/init-config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..5f6089852693a9198df71c8e82cb7c5ab7693390 --- /dev/null +++ b/charts/influxdb2/templates/init-config.yaml @@ -0,0 +1,10 @@ +{{- if .Values.initScripts.enabled -}} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "influxdb.fullname" . }}-init + labels: + {{- include "influxdb.labels" . | nindent 4 }} +data: +{{ toYaml .Values.initScripts.scripts | indent 2 }} +{{- end -}} diff --git a/charts/influxdb2/templates/service.yaml b/charts/influxdb2/templates/service.yaml index aff818803b65d913004d2ef0b03abc54bf503f59..daada35a963d087b45e6fca67fd10bf9240e80a2 100644 --- a/charts/influxdb2/templates/service.yaml +++ b/charts/influxdb2/templates/service.yaml @@ -30,10 +30,11 @@ spec: port: {{ .Values.service.port }} protocol: TCP targetPort: {{ .Values.service.targetPort }} -{{ if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePort))) }} - nodePort: {{.Values.service.nodePort}} -{{ end }} +{{- if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePort))) }} + nodePort: {{ .Values.service.nodePort }} +{{- end }} {{- if .Values.extraExposePorts }} {{- tpl (toYaml .Values.extraExposePorts) . | indent 4 }} {{- end }} - selector: {{- include "influxdb.selectorLabels" . | nindent 4 }} + selector: + {{- include "influxdb.selectorLabels" . | nindent 4 }} diff --git a/charts/influxdb2/templates/statefulset.yaml b/charts/influxdb2/templates/statefulset.yaml index 8e12cc1037003175788b552dee569a35538ec80e..5b1f3d4c5ec0397637fc11bd8fd853227af4dcc2 100644 --- a/charts/influxdb2/templates/statefulset.yaml +++ b/charts/influxdb2/templates/statefulset.yaml @@ -3,7 +3,7 @@ kind: StatefulSet metadata: name: {{ template "influxdb.fullname" . }} labels: - {{ include "influxdb.labels" . | nindent 4 }} + {{- include "influxdb.labels" . | nindent 4 }} spec: replicas: 1 selector: @@ -14,8 +14,13 @@ spec: metadata: labels: {{- include "influxdb.selectorLabels" . | nindent 8 }} + {{- if .Values.podLabels }} +{{ toYaml .Values.podLabels | indent 8 }} + {{- end }} + {{- if .Values.podAnnotations }} annotations: - {{- toYaml .Values.podAnnotations | nindent 8 }} +{{ toYaml .Values.podAnnotations | indent 8 }} + {{- end }} spec: volumes: - name: data @@ -30,6 +35,15 @@ spec: {{- else }} emptyDir: {} {{- end }} + {{- if .Values.initScripts.enabled }} + - name: init + configMap: + name: {{ include "influxdb.fullname" . }}-init + defaultMode: 0744 + {{- end }} + {{- if .Values.volumes }} + {{- toYaml .Values.volumes | nindent 8 }} + {{- end }} serviceAccountName: {{ include "influxdb.serviceAccountName" . }} containers: - name: {{ .Chart.Name }} @@ -76,22 +90,19 @@ spec: name: {{ template "influxdb.fullname" . }}-auth {{- end }} key: admin-token - # Path to the BoltDB database. - name: INFLUXD_BOLT_PATH value: {{ .Values.persistence.mountPath }}/influxd.bolt # Path to persistent storage engine files where InfluxDB stores all Time-Structure Merge Tree (TSM) data on disk. - name: INFLUXD_ENGINE_PATH value: {{ .Values.persistence.mountPath }} - - # Extra environment variables from .Values.env {{- with .Values.env }} + # Extra environment variables from .Values.env {{- toYaml . | nindent 12 }} {{- end }} - {{- if .Values.securityContext }} securityContext: - {{ toYaml .Values.securityContext | nindent 12 }} + {{- toYaml .Values.securityContext | nindent 12 }} {{- end }} livenessProbe: httpGet: @@ -127,6 +138,13 @@ spec: - name: data mountPath: {{ .Values.persistence.mountPath }} subPath: {{ .Values.persistence.subPath }} + {{- if .Values.initScripts.enabled }} + - name: init + mountPath: /docker-entrypoint-initdb.d + {{- end }} + {{- if .Values.mountPoints }} + {{- toYaml .Values.mountPoints | nindent 10 }} + {{- end }} resources: {{ .Values.resources | toYaml | nindent 12 | trim }} diff --git a/charts/influxdb2/values.yaml b/charts/influxdb2/values.yaml index 9863c3d19597344caaf7ea79c6f8abfe047df226..68db48f4bc3e8cee718afc1fa8a25a1e865ba0a8 100644 --- a/charts/influxdb2/values.yaml +++ b/charts/influxdb2/values.yaml @@ -3,8 +3,14 @@ image: tag: 2.2.0-alpine pullPolicy: IfNotPresent +## Annotations to be added to InfluxDB pods +## podAnnotations: {} +## Labels to be added to InfluxDB pods +## +podLabels: {} + nameOverride: "" fullnameOverride: "" @@ -120,6 +126,30 @@ persistence: mountPath: /var/lib/influxdb2 subPath: "" +## Add custom volume and volumeMounts +## +# volumes: +# - name: influxdb2-templates +# hostPath: +# path: /data/influxdb2-templates +# type: Directory +# mountPoints: +# - name: influxdb2-templates +# mountPath: /influxdb2-templates +# readOnly: true + +## Allow executing custom init scripts +## If the container finds any files with the .sh extension inside of the +## /docker-entrypoint-initdb.d folder, it will execute them. +## When multiple scripts are present, they will be executed in lexical sort order by name. +## For more details see Custom Initialization Scripts in https://hub.docker.com/_/influxdb +initScripts: + enabled: false + scripts: + init.sh: |+ + #!/bin/bash + influx apply --force yes -u https://raw.githubusercontent.com/influxdata/community-templates/master/influxdb2_operational_monitoring/influxdb2_operational_monitoring.yml + ## Specify a service type ## ref: http://kubernetes.io/docs/user-guide/services/ ##