Mohammed Naser | 8a2c8fb | 2023-02-19 17:23:55 +0000 | [diff] [blame] | 1 | {{/* |
| 2 | Defines the PodSpec for Vector. |
| 3 | */}} |
| 4 | {{- define "vector.pod" -}} |
| 5 | serviceAccountName: {{ include "vector.serviceAccountName" . }} |
| 6 | {{- with .Values.podHostNetwork }} |
| 7 | hostNetwork: {{ . }} |
| 8 | {{- end }} |
| 9 | {{- with .Values.podSecurityContext }} |
| 10 | securityContext: |
| 11 | {{ toYaml . | indent 2 }} |
| 12 | {{- end }} |
| 13 | {{- with .Values.podPriorityClassName }} |
| 14 | priorityClassName: {{ . }} |
| 15 | {{- end }} |
Giovanni Tirloni | 59219b6 | 2024-04-09 14:50:25 -0300 | [diff] [blame] | 16 | {{- with .Values.shareProcessNamespace }} |
| 17 | shareProcessNamespace: {{ . }} |
| 18 | {{- end }} |
Mohammed Naser | 8a2c8fb | 2023-02-19 17:23:55 +0000 | [diff] [blame] | 19 | {{- with .Values.dnsPolicy }} |
| 20 | dnsPolicy: {{ . }} |
| 21 | {{- end }} |
| 22 | {{- with .Values.dnsConfig }} |
| 23 | dnsConfig: |
| 24 | {{ toYaml . | indent 2 }} |
| 25 | {{- end }} |
| 26 | {{- with .Values.image.pullSecrets }} |
| 27 | imagePullSecrets: |
| 28 | {{ toYaml . | indent 2 }} |
| 29 | {{- end }} |
| 30 | {{- with .Values.initContainers }} |
| 31 | initContainers: |
| 32 | {{ toYaml . | indent 2 }} |
| 33 | {{- end }} |
| 34 | containers: |
| 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 Tirloni | 59219b6 | 2024-04-09 14:50:25 -0300 | [diff] [blame] | 55 | - name: VECTOR_LOG |
| 56 | value: "{{ .Values.logLevel | default "info" }}" |
Mohammed Naser | 8a2c8fb | 2023-02-19 17:23:55 +0000 | [diff] [blame] | 57 | {{- 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 Tirloni | 59219b6 | 2024-04-09 14:50:25 -0300 | [diff] [blame] | 148 | {{- with .Values.defaultVolumeMounts }} |
| 149 | {{- toYaml . | nindent 6 }} |
| 150 | {{- end }} |
Mohammed Naser | 8a2c8fb | 2023-02-19 17:23:55 +0000 | [diff] [blame] | 151 | {{- end }} |
| 152 | {{- with .Values.extraVolumeMounts }} |
| 153 | {{- toYaml . | nindent 6 }} |
| 154 | {{- end }} |
| 155 | {{- with .Values.extraContainers }} |
| 156 | {{ toYaml . | indent 2 }} |
| 157 | {{- end }} |
| 158 | terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }} |
| 159 | {{- with .Values.nodeSelector }} |
| 160 | nodeSelector: |
| 161 | {{ toYaml . | indent 2 }} |
| 162 | {{- end }} |
| 163 | {{- with .Values.affinity }} |
| 164 | affinity: |
| 165 | {{ toYaml . | indent 2 }} |
| 166 | {{- end }} |
| 167 | {{- with .Values.tolerations }} |
| 168 | tolerations: |
| 169 | {{ toYaml . | indent 2 }} |
| 170 | {{- end }} |
| 171 | {{- with .Values.topologySpreadConstraints }} |
| 172 | topologySpreadConstraints: |
| 173 | {{- toYaml . | nindent 2 }} |
| 174 | {{- end }} |
| 175 | volumes: |
| 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 Tirloni | 59219b6 | 2024-04-09 14:50:25 -0300 | [diff] [blame] | 200 | {{- if .Values.persistence.hostPath.enabled }} |
Mohammed Naser | 8a2c8fb | 2023-02-19 17:23:55 +0000 | [diff] [blame] | 201 | hostPath: |
| 202 | path: {{ .Values.persistence.hostPath.path | quote }} |
Giovanni Tirloni | 59219b6 | 2024-04-09 14:50:25 -0300 | [diff] [blame] | 203 | {{- else }} |
| 204 | emptyDir: {} |
| 205 | {{- end }} |
| 206 | {{- with .Values.defaultVolumes }} |
| 207 | {{- toYaml . | nindent 2 }} |
| 208 | {{- end }} |
Mohammed Naser | 8a2c8fb | 2023-02-19 17:23:55 +0000 | [diff] [blame] | 209 | {{- end }} |
| 210 | {{- with .Values.extraVolumes }} |
| 211 | {{- toYaml . | nindent 2 }} |
| 212 | {{- end }} |
| 213 | {{- end }} |