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