123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- {{- define "opentelemetry-collector.pod" -}}
- {{- with .Values.imagePullSecrets }}
- imagePullSecrets:
- {{- toYaml . | nindent 2 }}
- {{- end }}
- serviceAccountName: {{ include "opentelemetry-collector.serviceAccountName" . }}
- securityContext:
- {{- toYaml .Values.podSecurityContext | nindent 2 }}
- containers:
- - name: {{ include "opentelemetry-collector.lowercase_chartname" . }}
- {{- if .Values.command.name }}
- command:
- - /{{ .Values.command.name }}
- {{- end }}
- args:
- - --config=/conf/relay.yaml
- securityContext:
- {{- if and (not (.Values.securityContext)) (.Values.presets.logsCollection.storeCheckpoints) }}
- runAsUser: 0
- runAsGroup: 0
- {{- else -}}
- {{- toYaml .Values.securityContext | nindent 6 }}
- {{- end }}
- {{- if .Values.image.digest }}
- image: "{{ .Values.image.repository }}@{{ .Values.image.digest }}"
- {{- else }}
- image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
- {{- end }}
- imagePullPolicy: {{ .Values.image.pullPolicy }}
- ports:
- {{- range $key, $port := .Values.ports }}
- {{- if $port.enabled }}
- - name: {{ $key }}
- containerPort: {{ $port.containerPort }}
- protocol: {{ $port.protocol }}
- {{- if and $.isAgent $port.hostPort }}
- hostPort: {{ $port.hostPort }}
- {{- end }}
- {{- end }}
- {{- end }}
- env:
- - name: MY_POD_IP
- valueFrom:
- fieldRef:
- apiVersion: v1
- fieldPath: status.podIP
- {{- if .Values.presets.kubeletMetrics.enabled }}
- - name: K8S_NODE_NAME
- valueFrom:
- fieldRef:
- fieldPath: spec.nodeName
- {{- end }}
- {{- with .Values.extraEnvs }}
- {{- . | toYaml | nindent 6 }}
- {{- end }}
- {{- if .Values.lifecycleHooks }}
- lifecycle:
- {{- toYaml .Values.lifecycleHooks | nindent 6 }}
- {{- end }}
- livenessProbe:
- httpGet:
- path: /
- port: 13133
- readinessProbe:
- httpGet:
- path: /
- port: 13133
- resources:
- {{- toYaml .Values.resources | nindent 6 }}
- volumeMounts:
- {{- if .Values.configMap.create }}
- - mountPath: /conf
- name: {{ include "opentelemetry-collector.lowercase_chartname" . }}-configmap
- {{- end }}
- {{- range .Values.extraConfigMapMounts }}
- - name: {{ .name }}
- mountPath: {{ .mountPath }}
- readOnly: {{ .readOnly }}
- {{- if .subPath }}
- subPath: {{ .subPath }}
- {{- end }}
- {{- end }}
- {{- range .Values.extraHostPathMounts }}
- - name: {{ .name }}
- mountPath: {{ .mountPath }}
- readOnly: {{ .readOnly }}
- {{- if .mountPropagation }}
- mountPropagation: {{ .mountPropagation }}
- {{- end }}
- {{- end }}
- {{- range .Values.secretMounts }}
- - name: {{ .name }}
- mountPath: {{ .mountPath }}
- readOnly: {{ .readOnly }}
- {{- if .subPath }}
- subPath: {{ .subPath }}
- {{- end }}
- {{- end }}
- {{- if eq (include "opentelemetry-collector.logsCollectionEnabled" .) "true" }}
- - name: varlogpods
- mountPath: /var/log/pods
- readOnly: true
- - name: varlibdockercontainers
- mountPath: /var/lib/docker/containers
- readOnly: true
- {{- if .Values.presets.logsCollection.storeCheckpoints}}
- - name: varlibotelcol
- mountPath: /var/lib/otelcol
- {{- end }}
- {{- end }}
- {{- if .Values.presets.hostMetrics.enabled }}
- - name: hostfs
- mountPath: /hostfs
- readOnly: true
- mountPropagation: HostToContainer
- {{- end }}
- {{- if .Values.extraVolumeMounts }}
- {{- toYaml .Values.extraVolumeMounts | nindent 6 }}
- {{- end }}
- {{- with .Values.extraContainers }}
- {{- toYaml . | nindent 2 }}
- {{- end }}
- {{- if .Values.initContainers }}
- initContainers:
- {{- tpl (toYaml .Values.initContainers) . | nindent 2 }}
- {{- end }}
- {{- if .Values.priorityClassName }}
- priorityClassName: {{ .Values.priorityClassName | quote }}
- {{- end }}
- volumes:
- {{- if .Values.configMap.create }}
- - name: {{ include "opentelemetry-collector.lowercase_chartname" . }}-configmap
- configMap:
- name: {{ include "opentelemetry-collector.fullname" . }}{{ .configmapSuffix }}
- items:
- - key: relay
- path: relay.yaml
- {{- end }}
- {{- range .Values.extraConfigMapMounts }}
- - name: {{ .name }}
- configMap:
- name: {{ .configMap }}
- {{- end }}
- {{- range .Values.extraHostPathMounts }}
- - name: {{ .name }}
- hostPath:
- path: {{ .hostPath }}
- {{- end }}
- {{- range .Values.secretMounts }}
- - name: {{ .name }}
- secret:
- secretName: {{ .secretName }}
- {{- end }}
- {{- if eq (include "opentelemetry-collector.logsCollectionEnabled" .) "true" }}
- - name: varlogpods
- hostPath:
- path: /var/log/pods
- {{- if .Values.presets.logsCollection.storeCheckpoints}}
- - name: varlibotelcol
- hostPath:
- path: /var/lib/otelcol
- type: DirectoryOrCreate
- {{- end }}
- - name: varlibdockercontainers
- hostPath:
- path: /var/lib/docker/containers
- {{- end }}
- {{- if .Values.presets.hostMetrics.enabled }}
- - name: hostfs
- hostPath:
- path: /
- {{- end }}
- {{- if .Values.extraVolumes }}
- {{- toYaml .Values.extraVolumes | nindent 2 }}
- {{- end }}
- {{- with .Values.nodeSelector }}
- nodeSelector:
- {{- toYaml . | nindent 2 }}
- {{- end }}
- {{- with .Values.affinity }}
- affinity:
- {{- toYaml . | nindent 2 }}
- {{- end }}
- {{- with .Values.tolerations }}
- tolerations:
- {{- toYaml . | nindent 2 }}
- {{- end }}
- {{- with .Values.topologySpreadConstraints }}
- topologySpreadConstraints:
- {{- toYaml . | nindent 2 }}
- {{- end }}
- {{- end }}
|