data-statefulset.yaml 6.07 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: {{ include "influxdb-enterprise.fullname" . }}-data
  labels:
    {{- include "influxdb-enterprise.labels" . | nindent 4 }}
spec:
  replicas: {{ .Values.data.replicas | default 3 }}
  podManagementPolicy: Parallel
  serviceName: {{ include "influxdb-enterprise.fullname" . }}-data
  selector:
    matchLabels:
      influxdb.influxdata.com/component: data
      {{- include "influxdb-enterprise.selectorLabels" . | nindent 6 }}
  template:
    metadata:
    {{- with .Values.data.podAnnotations }}
      annotations:
        {{- toYaml . | nindent 8 }}
    {{- end }}
      labels:
        influxdb.influxdata.com/component: data
        {{- include "influxdb-enterprise.selectorLabels" . | nindent 8 }}
    spec:
      {{- with .Values.imagePullSecrets }}
      imagePullSecrets:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      securityContext:
        {{- toYaml .Values.data.podSecurityContext | nindent 8 }}
      volumes:
32 33 34 35
      {{ if not .Values.data.persistence.enabled }}
      - name: {{ include "influxdb-enterprise.fullname" . }}-data-data
        emptyDir: {}
      {{ end }}
36 37 38
      - name: config
        configMap:
          name: {{ include "influxdb-enterprise.fullname" . }}-data
39 40 41 42
      {{- if .Values.license.secret }}
      - name: license
        secret:
          secretName: {{ .Values.license.secret.name }}
43 44 45
          items:
          - key: {{ .Values.license.secret.key }}
            path: license.json
46
      {{- end }}
47 48 49 50 51 52
      {{- if .Values.data.https.enabled }}
      - name: tls
        secret:
          {{- if .Values.data.https.useCertManager }}
          secretName: {{ include "influxdb-enterprise.fullname" . }}-data-tls
          {{ else }}
53 54 55
          secretName: {{ .Values.data.https.secret.name }}
          {{ if or .Values.data.https.secret.crt .Values.data.https.secret.key }}
          items:
56
            - key: {{ .Values.data.https.secret.crt }}
57
              path: tls.crt
58
            - key: {{ .Values.data.https.secret.key }}
59 60
              path: tls.key
          {{ end }}
61 62
          {{ end }}
      {{ end }}
David McKay's avatar
David McKay committed
63 64 65 66 67 68 69 70 71 72 73 74 75 76
      {{- if and .Values.data.https.enabled .Values.data.https.secret }}
      {{- if .Values.data.https.secret.ca -}}
      - name: tls-ca
        secret:
          {{ if .Values.data.https.secret.caSecret -}}
          secretName: {{ .Values.data.https.secret.caSecret }}
          {{ else }}
          secretName: {{ .Values.data.https.secret.name }}
          {{ end }}
          items:
            - key: {{ .Values.data.https.secret.ca }}
              path: ca.crt
      {{ end }}
      {{ end }}
77 78 79
      containers:
        - name: {{ .Chart.Name }}
          command:
80
          - "/usr/bin/perl"
81
          args:
82
          - "/etc/influxdb/entrypoint.pl"
83 84
          securityContext:
            {{- toYaml .Values.data.securityContext | nindent 12 }}
David McKay's avatar
David McKay committed
85
          {{- include "influxdb-enterprise.image" (dict "chart" .Chart "imageroot" .Values.image "podvals" .Values.data "podtype" "data") | indent 10 }}
86
          imagePullPolicy: {{ .Values.data.image.pullPolicy }}
87 88 89
          env:
          - name: RELEASE_NAME
            value: {{ include "influxdb-enterprise.fullname" . }}
90 91
          ports:
            - name: http
92
              containerPort: 8086
93 94
              protocol: TCP
            - name: raft
95 96 97
              containerPort: 8088
              protocol: TCP
            - name: udp
98
              containerPort: 8089
99 100 101 102 103 104
              protocol: UDP
            - name: graphite
              containerPort: 2003
              protocol: TCP
            - name: opentsdb
              containerPort: 4242
105
              protocol: TCP
106 107 108
            - name: collectd
              containerPort: 25826
              protocol: UDP
109 110 111 112
          livenessProbe:
            httpGet:
              path: /ping
              port: http
113 114 115
              {{- if .Values.data.https.enabled }}
              scheme: HTTPS
              {{- end }}
116 117 118
          readinessProbe:
            initialDelaySeconds: 30
            httpGet:
119
              path: /ping
120
              port: http
121 122 123
              {{- if .Values.data.https.enabled }}
              scheme: HTTPS
              {{- end }}
124 125 126 127 128
          volumeMounts:
          - name: config
            mountPath: /etc/influxdb
          - name: {{ include "influxdb-enterprise.fullname" . }}-data-data
            mountPath: /var/lib/influxdb
129 130
          {{- if .Values.license.secret }}
          - name: license
131
            mountPath: /var/run/secrets/influxdb/
132
          {{- end }}
133 134 135 136
          {{- if .Values.data.https.enabled }}
          - name: tls
            mountPath: /var/run/secrets/tls/
          {{ end }}
David McKay's avatar
David McKay committed
137 138 139
          {{- if and .Values.data.https.enabled .Values.data.https.secret }}
          {{- if .Values.data.https.secret.ca -}}
          - name: tls-ca
140
            mountPath: /usr/share/ca-certificates/selfsigned/ca.crt
David McKay's avatar
David McKay committed
141 142 143
            subPath: ca.crt
          {{ end }}
          {{ end }}
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
          resources:
            {{- toYaml .Values.data.resources | nindent 12 }}
      {{- with .Values.data.nodeSelector }}
      nodeSelector:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.data.affinity }}
      affinity:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.data.tolerations }}
      tolerations:
        {{- toYaml . | nindent 8 }}
      {{- end }}
  {{- if and .Values.data.persistence.enabled (not .Values.data.persistence.existingClaim) }}
  volumeClaimTemplates:
    - metadata:
        name: {{ include "influxdb-enterprise.fullname" . }}-data-data
        annotations:
        {{- range $key, $value := .Values.data.persistence.annotations }}
          {{ $key }}: "{{ $value }}"
        {{- end }}
      spec:
        accessModes:
          - {{ .Values.data.persistence.accessMode | quote}}
        resources:
          requests:
            storage: {{ .Values.data.persistence.size | quote }}
      {{- if .Values.data.persistence.storageClass }}
      {{- if (eq "-" .Values.data.persistence.storageClass) }}
        storageClassName: ""
      {{- else }}
        storageClassName: "{{ .Values.data.persistence.storageClass }}"
      {{- end }}
      {{- end }}
  {{- end }}