blob: 51e1fb0d39d8ac95a475d683004d2d702a3a1e2a [file] [log] [blame]
Mohammed Naser8a2c8fb2023-02-19 17:23:55 +00001{{/*
2Defines the PodSpec for Vector.
3*/}}
4{{- define "vector.pod" -}}
5serviceAccountName: {{ include "vector.serviceAccountName" . }}
6{{- with .Values.podHostNetwork }}
7hostNetwork: {{ . }}
8{{- end }}
9{{- with .Values.podSecurityContext }}
10securityContext:
11{{ toYaml . | indent 2 }}
12{{- end }}
13{{- with .Values.podPriorityClassName }}
14priorityClassName: {{ . }}
15{{- end }}
Giovanni Tirloni59219b62024-04-09 14:50:25 -030016{{- with .Values.shareProcessNamespace }}
17shareProcessNamespace: {{ . }}
18{{- end }}
Mohammed Naser8a2c8fb2023-02-19 17:23:55 +000019{{- with .Values.dnsPolicy }}
20dnsPolicy: {{ . }}
21{{- end }}
22{{- with .Values.dnsConfig }}
23dnsConfig:
24{{ toYaml . | indent 2 }}
25{{- end }}
26{{- with .Values.image.pullSecrets }}
27imagePullSecrets:
28{{ toYaml . | indent 2 }}
29{{- end }}
30{{- with .Values.initContainers }}
31initContainers:
32{{ toYaml . | indent 2 }}
33{{- end }}
34containers:
35 - name: vector
36{{- with .Values.securityContext }}
37 securityContext:
38{{ toYaml . | indent 6 }}
39{{- end }}
40{{- if .Values.image.sha }}
41 image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}@sha256:{{ .Values.image.sha }}"
42{{- else }}
43 image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
44{{- end }}
45 imagePullPolicy: {{ .Values.image.pullPolicy }}
46{{- with .Values.command }}
47 command:
48 {{- toYaml . | nindent 6 }}
49{{- end }}
50{{- with .Values.args }}
51 args:
52 {{- toYaml . | nindent 6 }}
53{{- end }}
54 env:
Giovanni Tirloni59219b62024-04-09 14:50:25 -030055 - name: VECTOR_LOG
56 value: "{{ .Values.logLevel | default "info" }}"
Mohammed Naser8a2c8fb2023-02-19 17:23:55 +000057{{- if .Values.env }}
58{{- with .Values.env }}
59 {{- toYaml . | nindent 6 }}
60{{- end }}
61{{- end }}
62{{- if (eq .Values.role "Agent") }}
63 - name: VECTOR_SELF_NODE_NAME
64 valueFrom:
65 fieldRef:
66 fieldPath: spec.nodeName
67 - name: VECTOR_SELF_POD_NAME
68 valueFrom:
69 fieldRef:
70 fieldPath: metadata.name
71 - name: VECTOR_SELF_POD_NAMESPACE
72 valueFrom:
73 fieldRef:
74 fieldPath: metadata.namespace
75 - name: PROCFS_ROOT
76 value: "/host/proc"
77 - name: SYSFS_ROOT
78 value: "/host/sys"
79{{- end }}
80{{- if .Values.envFrom }}
81{{- with .Values.envFrom }}
82 envFrom:
83 {{- toYaml . | nindent 6 }}
84{{- end }}
85{{- end }}
86 ports:
87{{- if or .Values.containerPorts .Values.existingConfigMaps }}
88 {{- toYaml .Values.containerPorts | nindent 6 }}
89{{- else if .Values.customConfig }}
90 {{- include "vector.containerPorts" . | indent 6 }}
91{{- else if or (eq .Values.role "Aggregator") (eq .Values.role "Stateless-Aggregator") }}
92 - name: datadog-agent
93 containerPort: 8282
94 protocol: TCP
95 - name: fluent
96 containerPort: 24224
97 protocol: TCP
98 - name: logstash
99 containerPort: 5044
100 protocol: TCP
101 - name: splunk-hec
102 containerPort: 8080
103 protocol: TCP
104 - name: statsd
105 containerPort: 8125
106 protocol: TCP
107 - name: syslog
108 containerPort: 9000
109 protocol: TCP
110 - name: vector
111 containerPort: 6000
112 protocol: TCP
113 - name: prom-exporter
114 containerPort: 9090
115 protocol: TCP
116{{- else if (eq .Values.role "Agent") }}
117 - name: prom-exporter
118 containerPort: 9090
119 protocol: TCP
120{{- end }}
121{{- with .Values.livenessProbe }}
122 livenessProbe:
123 {{- toYaml . | trim | nindent 6 }}
124{{- end }}
125{{- with .Values.readinessProbe }}
126 readinessProbe:
127 {{- toYaml . | trim | nindent 6 }}
128{{- end }}
129{{- with .Values.resources }}
130 resources:
131{{- toYaml . | nindent 6 }}
132{{- end }}
133{{- with .Values.lifecycle }}
134 lifecycle:
135{{- toYaml . | nindent 6 }}
136{{- end }}
137 volumeMounts:
138 - name: data
139 {{- if .Values.existingConfigMaps }}
140 mountPath: "{{ if .Values.dataDir }}{{ .Values.dataDir }}{{ else }}{{ fail "Specify `dataDir` if you're using `existingConfigMaps`" }}{{ end }}"
141 {{- else }}
142 mountPath: "{{ .Values.customConfig.data_dir | default "/vector-data-dir" }}"
143 {{- end }}
144 - name: config
145 mountPath: "/etc/vector/"
146 readOnly: true
147{{- if (eq .Values.role "Agent") }}
Giovanni Tirloni59219b62024-04-09 14:50:25 -0300148{{- with .Values.defaultVolumeMounts }}
149{{- toYaml . | nindent 6 }}
150{{- end }}
Mohammed Naser8a2c8fb2023-02-19 17:23:55 +0000151{{- end }}
152{{- with .Values.extraVolumeMounts }}
153{{- toYaml . | nindent 6 }}
154{{- end }}
155{{- with .Values.extraContainers }}
156{{ toYaml . | indent 2 }}
157{{- end }}
158terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
159{{- with .Values.nodeSelector }}
160nodeSelector:
161{{ toYaml . | indent 2 }}
162{{- end }}
163{{- with .Values.affinity }}
164affinity:
165{{ toYaml . | indent 2 }}
166{{- end }}
167{{- with .Values.tolerations }}
168tolerations:
169{{ toYaml . | indent 2 }}
170{{- end }}
171{{- with .Values.topologySpreadConstraints }}
172topologySpreadConstraints:
173{{- toYaml . | nindent 2 }}
174{{- end }}
175volumes:
176{{- if and .Values.persistence.enabled (eq .Values.role "Aggregator") }}
177{{- with .Values.persistence.existingClaim }}
178 - name: data
179 persistentVolumeClaim:
180 claimName: {{ . }}
181{{- end }}
182{{- else if (ne .Values.role "Agent") }}
183 - name: data
184 emptyDir: {}
185{{- end }}
186 - name: config
187 projected:
188 sources:
189{{- if .Values.existingConfigMaps }}
190 {{- range .Values.existingConfigMaps }}
191 - configMap:
192 name: {{ . }}
193 {{- end }}
194{{- else }}
195 - configMap:
196 name: {{ template "vector.fullname" . }}
197{{- end }}
198{{- if (eq .Values.role "Agent") }}
199 - name: data
Giovanni Tirloni59219b62024-04-09 14:50:25 -0300200 {{- if .Values.persistence.hostPath.enabled }}
Mohammed Naser8a2c8fb2023-02-19 17:23:55 +0000201 hostPath:
202 path: {{ .Values.persistence.hostPath.path | quote }}
Giovanni Tirloni59219b62024-04-09 14:50:25 -0300203 {{- else }}
204 emptyDir: {}
205 {{- end }}
206 {{- with .Values.defaultVolumes }}
207 {{- toYaml . | nindent 2 }}
208 {{- end }}
Mohammed Naser8a2c8fb2023-02-19 17:23:55 +0000209{{- end }}
210{{- with .Values.extraVolumes }}
211{{- toYaml . | nindent 2 }}
212{{- end }}
213{{- end }}