From 1380094f4626d76f32d1522507d2fb876b636c44 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Fri, 14 Jan 2022 14:20:24 -0800 Subject: [PATCH] Remove the quadruple dollar hack Double expansion issue was fixed with the recent splunk-otel-collector upgrade. Now OTel collector configs are expanded only once and hack with `$$$$` is not needed anymore. + temporary set splunk-otel-collector docker image to the latest dev version to keep the main in a working state. --- CHANGELOG.md | 5 +++++ UPGRADING.md | 8 ++++++++ .../splunk-otel-collector/templates/_helpers.tpl | 6 +++--- .../templates/config/_otel-agent.tpl | 10 +++++----- helm-charts/splunk-otel-collector/values.yaml | 4 ++-- rendered/manifests/agent-only/daemonset.yaml | 2 +- .../agent-only/deployment-cluster-receiver.yaml | 2 +- .../manifests/gateway-only/deployment-gateway.yaml | 2 +- rendered/manifests/logs-only/daemonset.yaml | 2 +- rendered/manifests/metrics-only/daemonset.yaml | 2 +- .../metrics-only/deployment-cluster-receiver.yaml | 2 +- rendered/manifests/otel-logs/configmap-agent.yaml | 10 +++++----- rendered/manifests/otel-logs/daemonset.yaml | 8 ++++---- .../otel-logs/deployment-cluster-receiver.yaml | 2 +- rendered/manifests/traces-only/daemonset.yaml | 2 +- 15 files changed, 40 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f1856b7474..debed401e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## Unreleased +### Fixed + +- Double expansion issue splunk-otel-collector (#357). See [upgrade +guideline](https://github.com/signalfx/splunk-otel-collector-chart/blob/main/UPGRADING.md#0410-to-0420) + ## [0.41.0] - 2021-12-13 ### Added diff --git a/UPGRADING.md b/UPGRADING.md index dc70032967..3a96e62f7f 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -1,5 +1,13 @@ # Upgrade guidelines +## 0.41.0 to 0.42.0 + +[#357 Double expansion issue in splunk-otel-collector is +fixed](https://github.com/signalfx/splunk-otel-collector-chart/pull/357) + +If you use OTel native logs collection with any custom log processing operators +in `filelog` receiver, please replace any occurrences of `$$$$` with `$$`. + ## 0.38.0 to 0.39.0 [#325 Logs collection is now disabled by default for Splunk Observability diff --git a/helm-charts/splunk-otel-collector/templates/_helpers.tpl b/helm-charts/splunk-otel-collector/templates/_helpers.tpl index e8ac1f9c4a..d1225374da 100644 --- a/helm-charts/splunk-otel-collector/templates/_helpers.tpl +++ b/helm-charts/splunk-otel-collector/templates/_helpers.tpl @@ -218,15 +218,15 @@ Create a filter expression for multiline logs configuration. {{- $expr := "" }} {{- if .namespaceName }} {{- $useRegexp := eq (toString .namespaceName.useRegexp | default "false") "true" }} -{{- $expr = cat "($$$$resource[\"k8s.namespace.name\"])" (ternary "matches" "==" $useRegexp) (quote .namespaceName.value) "&&" }} +{{- $expr = cat "($$resource[\"k8s.namespace.name\"])" (ternary "matches" "==" $useRegexp) (quote .namespaceName.value) "&&" }} {{- end }} {{- if .podName }} {{- $useRegexp := eq (toString .podName.useRegexp | default "false") "true" }} -{{- $expr = cat $expr "($$$$resource[\"k8s.pod.name\"])" (ternary "matches" "==" $useRegexp) (quote .podName.value) "&&" }} +{{- $expr = cat $expr "($$resource[\"k8s.pod.name\"])" (ternary "matches" "==" $useRegexp) (quote .podName.value) "&&" }} {{- end }} {{- if .containerName }} {{- $useRegexp := eq (toString .containerName.useRegexp | default "false") "true" }} -{{- $expr = cat $expr "($$$$resource[\"k8s.container.name\"])" (ternary "matches" "==" $useRegexp) (quote .containerName.value) "&&" }} +{{- $expr = cat $expr "($$resource[\"k8s.container.name\"])" (ternary "matches" "==" $useRegexp) (quote .containerName.value) "&&" }} {{- end }} {{- $expr | trimSuffix "&&" | trim }} {{- end -}} diff --git a/helm-charts/splunk-otel-collector/templates/config/_otel-agent.tpl b/helm-charts/splunk-otel-collector/templates/config/_otel-agent.tpl index 2ae2e783ce..3fa70da29a 100644 --- a/helm-charts/splunk-otel-collector/templates/config/_otel-agent.tpl +++ b/helm-charts/splunk-otel-collector/templates/config/_otel-agent.tpl @@ -139,11 +139,11 @@ receivers: id: get-format routes: - output: parser-docker - expr: '$$$$body matches "^\\{"' + expr: '$$body matches "^\\{"' - output: parser-crio - expr: '$$$$body matches "^[^ Z]+ "' + expr: '$$body matches "^[^ Z]+ "' - output: parser-containerd - expr: '$$$$body matches "^[^ Z]+Z"' + expr: '$$body matches "^[^ Z]+Z"' {{- end }} {{- if or (not .Values.logsCollection.containers.containerRuntime) (eq .Values.logsCollection.containers.containerRuntime "cri-o") }} # Parse CRI-O format @@ -199,12 +199,12 @@ receivers: - type: metadata id: filename resource: - com.splunk.source: EXPR($$$$attributes["file.path"]) + com.splunk.source: EXPR($$attributes["file.path"]) # Extract metadata from file path - type: regex_parser id: extract_metadata_from_filepath regex: '^\/var\/log\/pods\/(?P[^_]+)_(?P[^_]+)_(?P[^\/]+)\/(?P[^\._]+)\/(?P\d+)\.log$' - parse_from: $$$$attributes["file.path"] + parse_from: $$attributes["file.path"] # Move out attributes to Attributes - type: metadata resource: diff --git a/helm-charts/splunk-otel-collector/values.yaml b/helm-charts/splunk-otel-collector/values.yaml index e5d754daab..e025931e14 100644 --- a/helm-charts/splunk-otel-collector/values.yaml +++ b/helm-charts/splunk-otel-collector/values.yaml @@ -712,9 +712,9 @@ image: otelcol: # The registry and name of the opentelemetry collector image to pull - repository: quay.io/signalfx/splunk-otel-collector + repository: quay.io/signalfx/splunk-otel-collector-dev # The tag of the Splunk OTel Collector image, default value is the chart appVersion - tag: "" + tag: 91f554caad6cc5fb52b4bcbdccc94256f0562610 # The policy that specifies when the user wants the opentelemetry collector images to be pulled pullPolicy: IfNotPresent diff --git a/rendered/manifests/agent-only/daemonset.yaml b/rendered/manifests/agent-only/daemonset.yaml index 95664cd576..255d0635b7 100644 --- a/rendered/manifests/agent-only/daemonset.yaml +++ b/rendered/manifests/agent-only/daemonset.yaml @@ -76,7 +76,7 @@ spec: containerPort: 9411 hostPort: 9411 protocol: TCP - image: quay.io/signalfx/splunk-otel-collector:0.41.0 + image: quay.io/signalfx/splunk-otel-collector-dev:91f554caad6cc5fb52b4bcbdccc94256f0562610 imagePullPolicy: IfNotPresent env: - name: SPLUNK_MEMORY_TOTAL_MIB diff --git a/rendered/manifests/agent-only/deployment-cluster-receiver.yaml b/rendered/manifests/agent-only/deployment-cluster-receiver.yaml index 806d5b1567..20357f71aa 100644 --- a/rendered/manifests/agent-only/deployment-cluster-receiver.yaml +++ b/rendered/manifests/agent-only/deployment-cluster-receiver.yaml @@ -41,7 +41,7 @@ spec: - /otelcol - --config=/conf/relay.yaml - --metrics-addr=0.0.0.0:8889 - image: quay.io/signalfx/splunk-otel-collector:0.41.0 + image: quay.io/signalfx/splunk-otel-collector-dev:91f554caad6cc5fb52b4bcbdccc94256f0562610 imagePullPolicy: IfNotPresent env: - name: SPLUNK_MEMORY_TOTAL_MIB diff --git a/rendered/manifests/gateway-only/deployment-gateway.yaml b/rendered/manifests/gateway-only/deployment-gateway.yaml index babc12ca91..c9c25e19ed 100644 --- a/rendered/manifests/gateway-only/deployment-gateway.yaml +++ b/rendered/manifests/gateway-only/deployment-gateway.yaml @@ -41,7 +41,7 @@ spec: - /otelcol - --config=/conf/relay.yaml - --metrics-addr=0.0.0.0:8889 - image: quay.io/signalfx/splunk-otel-collector:0.41.0 + image: quay.io/signalfx/splunk-otel-collector-dev:91f554caad6cc5fb52b4bcbdccc94256f0562610 imagePullPolicy: IfNotPresent env: - name: SPLUNK_MEMORY_TOTAL_MIB diff --git a/rendered/manifests/logs-only/daemonset.yaml b/rendered/manifests/logs-only/daemonset.yaml index 8036966f7c..c3c9edace6 100644 --- a/rendered/manifests/logs-only/daemonset.yaml +++ b/rendered/manifests/logs-only/daemonset.yaml @@ -129,7 +129,7 @@ spec: - name: otlp-http-old containerPort: 55681 protocol: TCP - image: quay.io/signalfx/splunk-otel-collector:0.41.0 + image: quay.io/signalfx/splunk-otel-collector-dev:91f554caad6cc5fb52b4bcbdccc94256f0562610 imagePullPolicy: IfNotPresent env: - name: SPLUNK_MEMORY_TOTAL_MIB diff --git a/rendered/manifests/metrics-only/daemonset.yaml b/rendered/manifests/metrics-only/daemonset.yaml index 467d83a5cf..3edf41d404 100644 --- a/rendered/manifests/metrics-only/daemonset.yaml +++ b/rendered/manifests/metrics-only/daemonset.yaml @@ -60,7 +60,7 @@ spec: containerPort: 9943 hostPort: 9943 protocol: TCP - image: quay.io/signalfx/splunk-otel-collector:0.41.0 + image: quay.io/signalfx/splunk-otel-collector-dev:91f554caad6cc5fb52b4bcbdccc94256f0562610 imagePullPolicy: IfNotPresent env: - name: SPLUNK_MEMORY_TOTAL_MIB diff --git a/rendered/manifests/metrics-only/deployment-cluster-receiver.yaml b/rendered/manifests/metrics-only/deployment-cluster-receiver.yaml index 806d5b1567..20357f71aa 100644 --- a/rendered/manifests/metrics-only/deployment-cluster-receiver.yaml +++ b/rendered/manifests/metrics-only/deployment-cluster-receiver.yaml @@ -41,7 +41,7 @@ spec: - /otelcol - --config=/conf/relay.yaml - --metrics-addr=0.0.0.0:8889 - image: quay.io/signalfx/splunk-otel-collector:0.41.0 + image: quay.io/signalfx/splunk-otel-collector-dev:91f554caad6cc5fb52b4bcbdccc94256f0562610 imagePullPolicy: IfNotPresent env: - name: SPLUNK_MEMORY_TOTAL_MIB diff --git a/rendered/manifests/otel-logs/configmap-agent.yaml b/rendered/manifests/otel-logs/configmap-agent.yaml index 15e478c1c0..85d47a6bdc 100644 --- a/rendered/manifests/otel-logs/configmap-agent.yaml +++ b/rendered/manifests/otel-logs/configmap-agent.yaml @@ -139,11 +139,11 @@ data: operators: - id: get-format routes: - - expr: $$$$body matches "^\\{" + - expr: $$body matches "^\\{" output: parser-docker - - expr: $$$$body matches "^[^ Z]+ " + - expr: $$body matches "^[^ Z]+ " output: parser-crio - - expr: $$$$body matches "^[^ Z]+Z" + - expr: $$body matches "^[^ Z]+Z" output: parser-containerd type: router - id: parser-crio @@ -190,10 +190,10 @@ data: type: json_parser - id: filename resource: - com.splunk.source: EXPR($$$$attributes["file.path"]) + com.splunk.source: EXPR($$attributes["file.path"]) type: metadata - id: extract_metadata_from_filepath - parse_from: $$$$attributes["file.path"] + parse_from: $$attributes["file.path"] regex: ^\/var\/log\/pods\/(?P[^_]+)_(?P[^_]+)_(?P[^\/]+)\/(?P[^\._]+)\/(?P\d+)\.log$ type: regex_parser - attributes: diff --git a/rendered/manifests/otel-logs/daemonset.yaml b/rendered/manifests/otel-logs/daemonset.yaml index baedc30a48..e662112e3b 100644 --- a/rendered/manifests/otel-logs/daemonset.yaml +++ b/rendered/manifests/otel-logs/daemonset.yaml @@ -27,7 +27,7 @@ spec: app: splunk-otel-collector release: default annotations: - checksum/config: cc641bdc22a677c320c67f9335e7100b21b7cb654613f730df21b106da9e425d + checksum/config: ea0bb7a5bcd707268a902feec74217c929c1bff378507cf3c20cc10dab6394b1 kubectl.kubernetes.io/default-container: otel-collector spec: hostNetwork: true @@ -41,7 +41,7 @@ spec: key: node-role.kubernetes.io/master initContainers: - name: copy-old-checkpoint - image: quay.io/signalfx/splunk-otel-collector:0.41.0 + image: quay.io/signalfx/splunk-otel-collector-dev:91f554caad6cc5fb52b4bcbdccc94256f0562610 imagePullPolicy: IfNotPresent command: [ "sh", "-c"] securityContext: @@ -54,7 +54,7 @@ spec: - name: old-checkpoint mountPath: /var/lib/otel_pos - name: migrate-checkpoint - image: quay.io/signalfx/splunk-otel-collector:0.41.0 + image: quay.io/signalfx/splunk-otel-collector-dev:91f554caad6cc5fb52b4bcbdccc94256f0562610 imagePullPolicy: IfNotPresent command: ["/migratecheckpoint"] securityContext: @@ -124,7 +124,7 @@ spec: containerPort: 9411 hostPort: 9411 protocol: TCP - image: quay.io/signalfx/splunk-otel-collector:0.41.0 + image: quay.io/signalfx/splunk-otel-collector-dev:91f554caad6cc5fb52b4bcbdccc94256f0562610 imagePullPolicy: IfNotPresent securityContext: runAsUser: 0 diff --git a/rendered/manifests/otel-logs/deployment-cluster-receiver.yaml b/rendered/manifests/otel-logs/deployment-cluster-receiver.yaml index 806d5b1567..20357f71aa 100644 --- a/rendered/manifests/otel-logs/deployment-cluster-receiver.yaml +++ b/rendered/manifests/otel-logs/deployment-cluster-receiver.yaml @@ -41,7 +41,7 @@ spec: - /otelcol - --config=/conf/relay.yaml - --metrics-addr=0.0.0.0:8889 - image: quay.io/signalfx/splunk-otel-collector:0.41.0 + image: quay.io/signalfx/splunk-otel-collector-dev:91f554caad6cc5fb52b4bcbdccc94256f0562610 imagePullPolicy: IfNotPresent env: - name: SPLUNK_MEMORY_TOTAL_MIB diff --git a/rendered/manifests/traces-only/daemonset.yaml b/rendered/manifests/traces-only/daemonset.yaml index bb36df17f4..729d138069 100644 --- a/rendered/manifests/traces-only/daemonset.yaml +++ b/rendered/manifests/traces-only/daemonset.yaml @@ -72,7 +72,7 @@ spec: containerPort: 9411 hostPort: 9411 protocol: TCP - image: quay.io/signalfx/splunk-otel-collector:0.41.0 + image: quay.io/signalfx/splunk-otel-collector-dev:91f554caad6cc5fb52b4bcbdccc94256f0562610 imagePullPolicy: IfNotPresent env: - name: SPLUNK_MEMORY_TOTAL_MIB