summaryrefslogtreecommitdiffstats
path: root/deployments/helm/v2/emco/fluentd/templates/aggregator-statefulset.yaml
blob: 40957cf28024a00d625002fcdec15cd5414cf7b7 (plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
{{- if .Values.aggregator.enabled -}}
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: {{ include "fluentd.fullname" . }}
  labels: {{- include "fluentd.labels" . | nindent 4 }}
    app.kubernetes.io/component: aggregator
spec:
  selector:
    matchLabels: {{- include "fluentd.matchLabels" . | nindent 6 }}
      app.kubernetes.io/component: aggregator
  serviceName: {{ include "fluentd.fullname" . }}-headless
  replicas: {{ .Values.aggregator.replicaCount }}
  updateStrategy: {{- toYaml .Values.aggregator.updateStrategy | nindent 4 }}
  template:
    metadata:
      labels: {{- include "fluentd.labels" . | nindent 8 }}
        app.kubernetes.io/component: aggregator
      annotations:
        checksum/config: {{ include (print $.Template.BasePath "/aggregator-configmap.yaml") . | sha256sum }}
        {{- if .Values.aggregator.podAnnotations }}
        {{- include "fluentd.tplValue" (dict "value" .Values.aggregator.podAnnotations "context" $) | nindent 8 }}
        {{- end }}
    spec:
      {{- include "fluentd.imagePullSecrets" . | nindent 6 }}
      {{- if .Values.aggregator.securityContext.enabled }}
      securityContext:
        runAsUser: {{ .Values.aggregator.securityContext.runAsUser }}
        fsGroup: {{ .Values.aggregator.securityContext.fsGroup }}
      {{- end }}
      {{- if .Values.aggregator.affinity }}
      affinity: {{- include "fluentd.tplValue" (dict "value" .Values.aggregator.affinity "context" $) | nindent 8 }}
      {{- end }}
      {{- if .Values.aggregator.nodeSelector }}
      nodeSelector: {{- include "fluentd.tplValue" (dict "value" .Values.aggregator.nodeSelector "context" $) | nindent 8 }}
      {{- end }}
      {{- if .Values.aggregator.tolerations }}
      tolerations: {{- include "fluentd.tplValue" (dict "value" .Values.aggregator.tolerations "context" $) | nindent 8 }}
      {{- end }}
      containers:
        - name: fluentd
          image: {{ include "fluentd.image" . }}
          imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
          env:
            - name: FLUENTD_CONF
              value: {{ .Values.aggregator.configFile }}
            - name: FLUENTD_OPT
              value: {{ .Values.aggregator.extraArgs | quote }}
            {{- if .Values.aggregator.extraEnv }}
            {{- toYaml .Values.aggregator.extraEnv | nindent 12 }}
            {{- end }}
          ports:
            {{- if .Values.aggregator.port }}
            - name: tcp
              containerPort: {{ .Values.aggregator.port }}
              protocol: TCP
            {{- end }}
            {{- if .Values.aggregator.containerPorts }}
            {{- toYaml .Values.aggregator.containerPorts | nindent 12 }}
            {{- end }}
            {{- if .Values.metrics.enabled }}
            - name: metrics
              containerPort: {{ .Values.metrics.service.port }}
              protocol: TCP
            {{- end }}
          {{- if .Values.aggregator.livenessProbe.enabled }}
          livenessProbe:
            httpGet:
              path: /fluentd.healthcheck?json=%7B%22ping%22%3A+%22pong%22%7D
              port: http
            initialDelaySeconds: {{ .Values.aggregator.livenessProbe.initialDelaySeconds }}
            periodSeconds: {{ .Values.aggregator.livenessProbe.periodSeconds }}
            timeoutSeconds: {{ .Values.aggregator.livenessProbe.timeoutSeconds }}
            successThreshold: {{ .Values.aggregator.livenessProbe.successThreshold }}
            failureThreshold: {{ .Values.aggregator.livenessProbe.failureThreshold }}
          {{- end }}
          {{- if .Values.aggregator.readinessProbe.enabled }}
          readinessProbe:
            httpGet:
              path: /fluentd.healthcheck?json=%7B%22ping%22%3A+%22pong%22%7D
              port: http
            initialDelaySeconds: {{ .Values.aggregator.readinessProbe.initialDelaySeconds }}
            periodSeconds: {{ .Values.aggregator.readinessProbe.periodSeconds }}
            timeoutSeconds: {{ .Values.aggregator.readinessProbe.timeoutSeconds }}
            successThreshold: {{ .Values.aggregator.readinessProbe.successThreshold }}
            failureThreshold: {{ .Values.aggregator.readinessProbe.failureThreshold }}
          {{- end }}
          {{- if .Values.aggregator.resources }}
          resources: {{- toYaml .Values.aggregator.resources | nindent 12 }}
          {{- end }}
          volumeMounts:
            - name: fluentd-config
              mountPath: /opt/bitnami/fluentd/conf
            {{- if .Values.aggregator.persistence.enabled }}
            - name: {{ include "fluentd.fullname" . }}-buffer
              mountPath: /opt/bitnami/fluentd/logs/buffers
            {{- else }}
            - name: buffer
              mountPath: /opt/bitnami/fluentd/logs/buffers
            {{- end }}
            {{- if .Values.tls.enabled }}
            - name: certs
              mountPath: /opt/bitnami/fluentd/certs
            {{- end }}
      volumes:
        {{- if .Values.tls.enabled }}
        - name: certs
          secret:
            secretName: {{ template "fluentd.tls.secretName" . }}
            items:
              - key: tls.crt
                path: tls.crt
              - key: tls.key
                path: tls.key
        {{- end }}
        - name: fluentd-config
          configMap:
            name: {{ template "fluentd.aggregator.configMap" . }}
        {{- if not .Values.aggregator.persistence.enabled }}
        - name: buffer
          emptyDir: {}
        {{- end }}

  {{- if .Values.aggregator.persistence.enabled }}
  volumeClaimTemplates:
    - metadata:
        name: {{ include "fluentd.fullname" . }}-buffer
      spec:
        accessModes: [{{ .Values.aggregator.persistence.accessMode }}]
        storageClassName: {{ .Values.aggregator.persistence.storageClass }}
        resources:
          requests:
            storage: {{ .Values.aggregator.persistence.size }}
  {{- end }}
{{- end -}}