meta-statefulset.yaml 6.03 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
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: {{ include "influxdb-enterprise.fullname" . }}-meta
  labels:
    {{- include "influxdb-enterprise.labels" . | nindent 4 }}
spec:
  replicas: {{ .Values.meta.replicas | default 3 }}
  podManagementPolicy: Parallel
  serviceName: {{ include "influxdb-enterprise.fullname" . }}-meta
  selector:
    matchLabels:
      influxdb.influxdata.com/component: meta
      {{- include "influxdb-enterprise.selectorLabels" . | nindent 6 }}
  template:
    metadata:
    {{- with .Values.meta.podAnnotations }}
      annotations:
        {{- toYaml . | nindent 8 }}
    {{- end }}
      labels:
        influxdb.influxdata.com/component: meta
        {{- include "influxdb-enterprise.selectorLabels" . | nindent 8 }}
    spec:
      {{- with .Values.imagePullSecrets }}
      imagePullSecrets:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      securityContext:
        {{- toYaml .Values.meta.podSecurityContext | nindent 8 }}
31
      serviceAccountName: {{ template "influxdb-enterprise.serviceAccountName" . }}
32
      volumes:
33 34 35 36
      {{ if not .Values.meta.persistence.enabled }}
      - name: {{ include "influxdb-enterprise.fullname" . }}-meta-data
        emptyDir: {}
      {{ end }}
37 38 39
      - name: config
        configMap:
          name: {{ include "influxdb-enterprise.fullname" . }}-meta
40 41 42 43
      {{- if .Values.license.secret }}
      - name: license
        secret:
          secretName: {{ .Values.license.secret.name }}
44 45 46
          items:
          - key: {{ .Values.license.secret.key }}
            path: license.json
47
      {{- end }}
48 49 50 51 52 53
      {{- if .Values.meta.https.enabled }}
      - name: tls
        secret:
          {{- if .Values.meta.https.useCertManager }}
          secretName: {{ include "influxdb-enterprise.fullname" . }}-meta-tls
          {{ else }}
54 55 56
          secretName: {{ .Values.meta.https.secret.name }}
          {{ if or .Values.meta.https.secret.crt .Values.meta.https.secret.key }}
          items:
57
            - key: {{ .Values.meta.https.secret.crt }}
58
              path: tls.crt
59
            - key: {{ .Values.meta.https.secret.key }}
60 61
              path: tls.key
          {{ end }}
62 63
          {{ end }}
      {{ end }}
David McKay's avatar
David McKay committed
64 65 66 67 68 69 70 71 72 73 74 75 76 77
      {{- if and .Values.meta.https.enabled .Values.meta.https.secret }}
      {{- if .Values.meta.https.secret.ca -}}
      - name: tls-ca
        secret:
          {{ if .Values.meta.https.secret.caSecret -}}
          secretName: {{ .Values.meta.https.secret.caSecret }}
          {{ else }}
          secretName: {{ .Values.meta.https.secret.name }}
          {{ end }}
          items:
            - key: {{ .Values.meta.https.secret.ca }}
              path: ca.crt
      {{ end }}
      {{ end }}
78 79 80
      containers:
        - name: {{ .Chart.Name }}
          command:
81
          - "/usr/bin/perl"
82
          args:
83
          - "/etc/influxdb/entrypoint.pl"
84 85
          securityContext:
            {{- toYaml .Values.meta.securityContext | nindent 12 }}
David McKay's avatar
David McKay committed
86
          {{- include "influxdb-enterprise.image" (dict "chart" .Chart "imageroot" .Values.image "podvals" .Values.meta "podtype" "meta") | indent 10 }}
87
          imagePullPolicy: {{ .Values.meta.image.pullPolicy }}
88 89 90 91
          env:
            - name: INFLUXDB_META_INTERNAL_SHARED_SECRET
              valueFrom:
                secretKeyRef:
92
                  name: {{ .Values.meta.sharedSecret.secretName }}
93
                  key: secret
94 95 96 97 98
          {{- if .Values.envFromSecret }}
          envFrom:
            - secretRef:
                name: {{ .Values.envFromSecret }}
          {{- end }}
99 100 101 102 103 104 105 106 107 108 109
          ports:
            - name: http
              containerPort: 8091
              protocol: TCP
            - name: raft
              containerPort: 8089
              protocol: TCP
          livenessProbe:
            httpGet:
              path: /ping
              port: http
110 111 112
              {{- if .Values.meta.https.enabled }}
              scheme: HTTPS
              {{- end }}
113 114
          readinessProbe:
            httpGet:
115
              path: /ping
116
              port: http
117 118 119
              {{- if .Values.meta.https.enabled }}
              scheme: HTTPS
              {{- end }}
120 121 122 123 124
          volumeMounts:
          - name: config
            mountPath: /etc/influxdb
          - name: {{ include "influxdb-enterprise.fullname" . }}-meta-data
            mountPath: /var/lib/influxdb
125 126
          {{- if .Values.license.secret }}
          - name: license
127
            mountPath: /var/run/secrets/influxdb/
128
          {{- end }}
129 130 131 132
          {{- if .Values.meta.https.enabled }}
          - name: tls
            mountPath: /var/run/secrets/tls/
          {{ end }}
David McKay's avatar
David McKay committed
133 134 135 136 137 138 139
          {{- if and .Values.meta.https.enabled .Values.meta.https.secret }}
          {{- if .Values.meta.https.secret.ca -}}
          - name: tls-ca
            mountPath: /usr/share/ca-certificates/selfsigned/ca.crt
            subPath: ca.crt
          {{ end }}
          {{ end }}
140 141 142 143 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
          resources:
            {{- toYaml .Values.meta.resources | nindent 12 }}
      {{- with .Values.meta.nodeSelector }}
      nodeSelector:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.meta.affinity }}
      affinity:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.meta.tolerations }}
      tolerations:
        {{- toYaml . | nindent 8 }}
      {{- end }}
  {{- if and .Values.meta.persistence.enabled (not .Values.meta.persistence.existingClaim) }}
  volumeClaimTemplates:
    - metadata:
        name: {{ include "influxdb-enterprise.fullname" . }}-meta-data
        annotations:
        {{- range $key, $value := .Values.meta.persistence.annotations }}
          {{ $key }}: "{{ $value }}"
        {{- end }}
      spec:
        accessModes:
          - {{ .Values.meta.persistence.accessMode | quote}}
        resources:
          requests:
            storage: {{ .Values.meta.persistence.size | quote }}
      {{- if .Values.meta.persistence.storageClass }}
      {{- if (eq "-" .Values.meta.persistence.storageClass) }}
        storageClassName: ""
      {{- else }}
        storageClassName: "{{ .Values.meta.persistence.storageClass }}"
      {{- end }}
      {{- end }}
  {{- end }}