Skip to content

Commit

Permalink
add initContainer for migrating checkpoint for otel agent (#253)
Browse files Browse the repository at this point in the history
  • Loading branch information
rockb1017 authored Oct 27, 2021
1 parent 3401db5 commit 085f98c
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## Unreleased

### Added

- Add initContainer for log checkpoint migration from Fluentd to Otel agent (#253)

## [0.37.0] - 2021-10-26

[Upgrade
Expand Down
35 changes: 34 additions & 1 deletion helm-charts/splunk-otel-collector/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ spec:
tolerations:
{{ toYaml . | nindent 8 }}
{{- end }}
{{- if and (eq (include "splunk-otel-collector.logsEnabled" .) "true") (eq .Values.logsEngine "fluentd") }}
{{- if (eq (include "splunk-otel-collector.logsEnabled" .) "true") }}
initContainers:
{{- if (eq .Values.logsEngine "fluentd") }}
- name: prepare-fluentd-config
image: {{ .Values.image.fluentd.initContainer.image }}
imagePullPolicy: {{ .Values.image.fluentd.initContainer.pullPolicy }}
Expand Down Expand Up @@ -90,6 +91,38 @@ spec:
mountPath: /fluentd/etc/json
- name: fluentd-config-cri
mountPath: /fluentd/etc/cri
{{- else }}
- name: migrate-checkpoint
image: {{ template "splunk-otel-collector.image.otelcol" . }}
imagePullPolicy: {{ .Values.image.otelcol.pullPolicy }}
command: ["/migratecheckpoint"]
securityContext:
runAsUser: 0
env:
- name: CONTAINER_LOG_PATH_FLUENTD
value: "{{ .Values.fluentd.config.posFilePrefix }}-containers.log.pos"
- name: CONTAINER_LOG_PATH_OTEL
value: "/var/lib/otel_pos/receiver_filelog_"
- name: CUSTOM_LOG_PATH_FLUENTD
value: "{{ .Values.fluentd.config.posFilePrefix }}-*.pos"
- name: CUSTOM_LOG_PATH_OTEL
value: "/var/lib/otel_pos/receiver_filelog_"
- name: CUSTOM_LOG_CAPTURE_REGEX
value: '{{ regexReplaceAll "(\\W)" .Values.fluentd.config.posFilePrefix "\\${1}" }}\-(?P<name>[\w0-9-_]+)\.pos'
- name: JOURNALD_LOG_PATH_FLUENTD
value: "/var/log/splunkd-fluentd-journald-*.pos.json"
- name: JOURNALD_LOG_PATH_OTEL
value: "/var/lib/otel_pos/receiver_journald_"
- name: JOURNALD_LOG_CAPTURE_REGEX
value: '\/splunkd\-fluentd\-journald\-(?P<name>[\w0-9-_]+)\.pos\.json'
volumeMounts:
- name: checkpoint
mountPath: /var/lib/otel_pos
- name: varlog
mountPath: /var/log
- name: varlibdockercontainers
mountPath: /var/lib/docker/containers
{{- end }}
{{- end }}
containers:
{{- if and (eq (include "splunk-otel-collector.logsEnabled" .) "true") (eq .Values.logsEngine "fluentd") }}
Expand Down

0 comments on commit 085f98c

Please sign in to comment.