-
Notifications
You must be signed in to change notification settings - Fork 183
/
statefulset.yaml
141 lines (141 loc) · 5.81 KB
/
statefulset.yaml
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
136
137
138
139
140
141
{{- if eq (include "events.otelcol.enabled" .) "true" }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ template "sumologic.metadata.name.events.statefulset" . }}
namespace: {{ template "sumologic.namespace" . }}
labels:
app: {{ template "sumologic.labels.app.events.statefulset" . }}
{{- include "sumologic.labels.common" . | nindent 4 }}
spec:
selector:
matchLabels:
app: {{ template "sumologic.labels.app.events.pod" . }}
serviceName: {{ template "sumologic.metadata.name.events.service-headless" . }}
podManagementPolicy: "Parallel"
replicas: 1
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/events/otelcol/configmap.yaml") . | sha256sum }}
{{- if .Values.sumologic.podAnnotations }}
{{ toYaml .Values.sumologic.podAnnotations | indent 8 }}
{{- end }}
{{- if .Values.otelevents.statefulset.podAnnotations }}
{{ toYaml .Values.otelevents.statefulset.podAnnotations | indent 8 }}
{{- end }}
labels:
app: {{ template "sumologic.labels.app.events.pod" . }}
{{- include "sumologic.labels.scrape.events" . | nindent 8 }}
{{- include "sumologic.labels.common" . | nindent 8 }}
{{- if .Values.sumologic.podLabels }}
{{ toYaml .Values.sumologic.podLabels | indent 8 }}
{{- end }}
{{- if .Values.otelevents.statefulset.podLabels }}
{{ toYaml .Values.otelevents.statefulset.podLabels | indent 8 }}
{{- end }}
spec:
serviceAccountName: {{ template "sumologic.metadata.name.roles.serviceaccount" . }}
{{- if not (empty (include "events.statefulset.nodeSelector" .)) }}
nodeSelector:
{{ include "events.statefulset.nodeSelector" . | indent 8 }}
{{- end }}
{{- if not (empty (include "events.statefulset.tolerations" .)) }}
tolerations:
{{ include "events.statefulset.tolerations" . | indent 8 }}
{{- end }}
{{- if or (not (empty (include "events.statefulset.affinity" .))) .Values.otelevents.statefulset.podAntiAffinity }}
affinity:
{{- if not (empty (include "otelcolInstrumentation.statefulset.affinity" .)) }}
{{ include "otelcolInstrumentation.statefulset.affinity" . | indent 8 }}
{{- end }}
{{- if eq .Values.otelevents.statefulset.podAntiAffinity "hard"}}
{{ include "pod-anti-affinity-hard" . | indent 8 }}
{{else if eq .Values.otelevents.statefulset.podAntiAffinity "soft"}}
{{ include "pod-anti-affinity-soft" . | indent 8 }}
{{- end }}
{{- end }}
{{- if .Values.otelevents.statefulset.topologySpreadConstraints }}
topologySpreadConstraints:
{{ toYaml .Values.otelevents.statefulset.topologySpreadConstraints | indent 6 }}
{{- end }}
volumes:
- name: config-volume
configMap:
name: {{ template "sumologic.metadata.name.events.configmap" . }}
{{- if .Values.otelevents.statefulset.extraVolumes }}
{{ toYaml .Values.otelevents.statefulset.extraVolumes | indent 6 }}
{{- end }}
securityContext:
{{- toYaml .Values.otelevents.statefulset.securityContext | nindent 8 }}
{{- if .Values.otelevents.statefulset.priorityClassName }}
priorityClassName: {{ .Values.otelevents.statefulset.priorityClassName | quote }}
{{- end }}
containers:
- name: otelcol
image: {{ template "sumologic.events.image" . }}
imagePullPolicy: {{ .Values.otelevents.image.pullPolicy }}
args:
- --config=/etc/otel/config.yaml
resources:
{{- toYaml .Values.otelevents.statefulset.resources | nindent 10 }}
{{- if .Values.otelevents.statefulset.containers.otelcol.securityContext }}
securityContext:
{{- toYaml .Values.otelevents.statefulset.containers.otelcol.securityContext | nindent 10 }}
{{- end }}
ports:
- name: metrics
containerPort: 8888
protocol: TCP
- name: pprof
containerPort: 1777
protocol: TCP
livenessProbe:
httpGet:
path: /
port: 13133 # Health Check extension default port.
{{- toYaml .Values.otelevents.statefulset.containers.otelcol.livenessProbe | nindent 10 }}
readinessProbe:
httpGet:
path: /
port: 13133 # Health Check extension default port.
{{- toYaml .Values.otelevents.statefulset.containers.otelcol.readinessProbe | nindent 10 }}
startupProbe:
httpGet:
path: /
port: 13133 # Health Check extension default port.
{{- toYaml .Values.otelevents.statefulset.containers.otelcol.startupProbe | nindent 10 }}
volumeMounts:
- name: config-volume
mountPath: /etc/otel/config.yaml
subPath: config.yaml
{{- if .Values.sumologic.events.persistence.enabled }}
- name: file-storage
mountPath: {{ .Values.sumologic.events.persistence.persistentVolume.path }}
{{- end }}
{{- if .Values.otelevents.statefulset.extraVolumeMounts }}
{{ toYaml .Values.otelevents.statefulset.extraVolumeMounts | indent 8 }}
{{- end }}
env:
{{- $ctx := .Values -}}
{{- include "kubernetes.sources.envs" (dict "Context" $ctx "Type" "events") | nindent 8 -}}
{{- include "proxy-env-variables" . | nindent 8 -}}
{{- if .Values.otelevents.statefulset.extraEnvVars }}
{{ toYaml .Values.otelevents.statefulset.extraEnvVars | nindent 8 }}
{{- end }}
{{- if .Values.sumologic.events.persistence.enabled }}
volumeClaimTemplates:
- metadata:
name: file-storage
{{- if .Values.sumologic.events.persistence.persistentVolume.pvcLabels }}
labels:
{{ toYaml .Values.sumologic.events.persistence.persistentVolume.pvcLabels | indent 8 }}
{{- end }}
spec:
accessModes: [{{ .Values.sumologic.events.persistence.persistentVolume.accessMode }}]
storageClassName: {{ .Values.sumologic.events.persistence.persistentVolume.storageClass }}
resources:
requests:
storage: {{ .Values.sumologic.events.persistence.size }}
{{- end }}
{{- end }}