From f8979ec8b53d2b10c138a5b4ebc66ac116f813de Mon Sep 17 00:00:00 2001 From: rockb1017 Date: Tue, 16 Nov 2021 10:41:42 -0800 Subject: [PATCH] add init container for copying old checkpoint --- CHANGELOG.md | 1 + .../templates/daemonset.yaml | 17 +++++++++++++++++ rendered/manifests/otel-logs/daemonset.yaml | 17 +++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2730f1b04..7761c30c53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Extract `container.image.tag` attribute from `container.image.name` (#285) - Upgrade splunk-otel-collector image to 0.38.1 (#284) +- Changed the default checkpoint path to `/var/addon/splunk/otel_pos` (#292) ### Fixed diff --git a/helm-charts/splunk-otel-collector/templates/daemonset.yaml b/helm-charts/splunk-otel-collector/templates/daemonset.yaml index 022bfd5462..5c642d0904 100644 --- a/helm-charts/splunk-otel-collector/templates/daemonset.yaml +++ b/helm-charts/splunk-otel-collector/templates/daemonset.yaml @@ -94,6 +94,19 @@ spec: - name: fluentd-config-cri mountPath: /fluentd/etc/cri {{- else }} + - name: copy-old-checkpoint + image: {{ template "splunk-otel-collector.image.fluentd" . }} + imagePullPolicy: {{ .Values.image.fluentd.pullPolicy }} + command: [ "sh", "-c"] + securityContext: + runAsUser: 0 + args: + - cp -n /var/lib/otel_pos/* /var/addon/splunk/otel_pos/ || true + volumeMounts: + - name: checkpoint + mountPath: /var/addon/splunk/otel_pos + - name: old-checkpoint + mountPath: /var/lib/otel_pos - name: migrate-checkpoint image: {{ template "splunk-otel-collector.image.otelcol" . }} imagePullPolicy: {{ .Values.image.otelcol.pullPolicy }} @@ -365,6 +378,10 @@ spec: hostPath: path: {{ .Values.logsCollection.checkpointPath }} type: DirectoryOrCreate + - name: old-checkpoint + hostPath: + path: /var/lib/otel_pos + type: DirectoryOrCreate {{- end}} {{- end}} {{- if eq (include "splunk-otel-collector.metricsEnabled" $) "true" }} diff --git a/rendered/manifests/otel-logs/daemonset.yaml b/rendered/manifests/otel-logs/daemonset.yaml index 5587a88855..3f94bea333 100644 --- a/rendered/manifests/otel-logs/daemonset.yaml +++ b/rendered/manifests/otel-logs/daemonset.yaml @@ -40,6 +40,19 @@ spec: - effect: NoSchedule key: node-role.kubernetes.io/master initContainers: + - name: copy-old-checkpoint + image: splunk/fluentd-hec:1.2.8 + imagePullPolicy: IfNotPresent + command: [ "sh", "-c"] + securityContext: + runAsUser: 0 + args: + - cp -n /var/lib/otel_pos/* /var/addon/splunk/otel_pos/ || true + volumeMounts: + - name: checkpoint + mountPath: /var/addon/splunk/otel_pos + - name: old-checkpoint + mountPath: /var/lib/otel_pos - name: migrate-checkpoint image: quay.io/signalfx/splunk-otel-collector:0.38.1 imagePullPolicy: IfNotPresent @@ -216,6 +229,10 @@ spec: hostPath: path: /var/addon/splunk/otel_pos type: DirectoryOrCreate + - name: old-checkpoint + hostPath: + path: /var/lib/otel_pos + type: DirectoryOrCreate - name: host-dev hostPath: path: /dev