Commit ac15fe4b authored by Felippe Mendonça's avatar Felippe Mendonça Committed by Kubernetes Prow Robot

[stable/influxdb] changes from deployment to statefulset (#17619)

* feat(stable/influxdb): changes from deployment to statefulset Signed-off-by: 's avatarFelippe Mendonça <mendonca.felippe@gmail.com> * [stable/influxdb] adds brief description about statefulset Signed-off-by: 's avatarFelippe Mendonça <mendonca.felippe@gmail.com> * [stable/influx] chart version bumped Signed-off-by: 's avatarFelippe Mendonça <mendonca.felippe@gmail.com>
parent 9cf9b349
apiVersion: v1
name: influxdb
version: 2.0.1
version: 3.0.0
appVersion: 1.7.6
description: Scalable datastore for metrics, events, and real-time analytics.
keywords:
......
......@@ -12,7 +12,7 @@ $ helm install stable/influxdb --name foo --namespace bar
## Introduction
This chart bootstraps an InfluxDB deployment and service on a Kubernetes cluster using the Helm Package manager.
This chart bootstraps an InfluxDB statefulset and service on a Kubernetes cluster using the Helm Package manager.
## Prerequisites
......@@ -69,7 +69,7 @@ $ helm install --name my-release -f values.yaml stable/influxdb
The [InfluxDB](https://hub.docker.com/_/influxdb/) image stores data in the `/var/lib/influxdb` directory in the container.
The chart mounts a [Persistent Volume](http://kubernetes.io/docs/user-guide/persistent-volumes/) at this location. The volume is created using dynamic volume provisioning.
If persistence is enabled, a [Persistent Volume](http://kubernetes.io/docs/user-guide/persistent-volumes/) associated with Statefulset will be provisioned. The volume is created using dynamic volume provisioning. In case of a disruption e.g. a node drain, kubernetes ensures that the same volume will be reatached to the Pod, preventing any data loss. Althought, when persistence is not enabled, InfluxDB data will be stored in an empty directory thus, in a Pod restart, data will be lost.
## Starting with authentication
......
{{- if and (.Values.persistence.enabled) (not .Values.persistence.useExisting) }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: "{{- if not (empty .Values.persistence.name) }}{{ .Values.persistence.name }}{{- else }}{{ template "influxdb.fullname" . }}{{- end }}"
labels:
app: "{{- if not (empty .Values.persistence.name) }}{{ .Values.persistence.name }}{{- else }}{{ template "influxdb.fullname" . }}{{- end }}"
chart: "{{ template "influxdb.chart" . }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
accessModes:
- {{ .Values.persistence.accessMode | quote }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- if .Values.persistence.storageClass }}
{{- if (eq "-" .Values.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.persistence.storageClass }}"
{{- end }}
{{- end }}
{{- end }}
apiVersion: apps/v1
kind: Deployment
kind: StatefulSet
metadata:
name: "{{ template "influxdb.fullname" . }}"
labels:
......@@ -12,7 +12,7 @@ spec:
selector:
matchLabels:
app: {{ template "influxdb.fullname" . }}
release: "{{ .Release.Name }}"
serviceName: "{{ template "influxdb.fullname" . }}"
template:
metadata:
labels:
......@@ -83,7 +83,7 @@ spec:
periodSeconds: {{ .Values.startupProbe.periodSeconds | default 5 }}
{{- end }}
volumeMounts:
- name: data
- name: {{ template "influxdb.fullname" . }}-data
mountPath: {{ .Values.config.storage_directory }}
- name: config
mountPath: /etc/influxdb
......@@ -92,18 +92,6 @@ spec:
mountPath: /docker-entrypoint-initdb.d
{{- end }}
volumes:
- name: data
{{- if .Values.persistence.enabled }}
{{- if not (empty .Values.persistence.name) }}
persistentVolumeClaim:
claimName: {{ .Values.persistence.name }}
{{- else }}
persistentVolumeClaim:
claimName: {{ template "influxdb.fullname" . }}
{{- end }}
{{- else }}
emptyDir: {}
{{- end }}
- name: config
configMap:
name: {{ template "influxdb.fullname" . }}
......@@ -112,6 +100,10 @@ spec:
configMap:
name: {{ template "influxdb.fullname" . }}-init
{{- end }}
{{- if (not .Values.persistence.enabled ) }}
- name: {{ template "influxdb.fullname" . }}-data
emptyDir: {}
{{- end }}
{{- if .Values.schedulerName }}
schedulerName: "{{ .Values.schedulerName }}"
{{- end }}
......@@ -127,3 +119,25 @@ spec:
tolerations:
{{ toYaml .Values.tolerations | indent 8 }}
{{- end }}
{{- if .Values.persistence.enabled }}
volumeClaimTemplates:
- metadata:
name: {{ template "influxdb.fullname" . }}-data
annotations:
{{- range $key, $value := .Values.persistence.annotations }}
{{ $key }}: "{{ $value }}"
{{- end }}
spec:
accessModes:
- {{ .Values.persistence.accessMode | quote}}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- if .Values.persistence.storageClass }}
{{- if (eq "-" .Values.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.persistence.storageClass }}"
{{- end }}
{{- end }}
{{- end }}
\ No newline at end of file
......@@ -44,10 +44,6 @@ service:
##
persistence:
enabled: true
## If true will use an existing PVC instead of creating one
# useExisting: false
## Name of existing PVC to be used in the influx deployment
# name:
## influxdb data Persistent Volume Storage Class
## If defined, storageClassName: <storageClass>
## If set to "-", storageClassName: "", which disables dynamic provisioning
......@@ -56,6 +52,7 @@ persistence:
## GKE, AWS & OpenStack)
##
# storageClass: "-"
annotations:
accessMode: ReadWriteOnce
size: 8Gi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment