From 884305304913e966934d2d859a0163acbaf6effd 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 --- .../templates/daemonset.yaml | 17 +++++++++++++++++ rendered/manifests/otel-logs/daemonset.yaml | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) 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