Skip to content

Commit

Permalink
Operator: Migrate .Values.operator.instrumentation.spec to .Values.…
Browse files Browse the repository at this point in the history
…instrumentation (#1436)

* Initial updates to migrate .Values.operator.instrumentation.spec to .Values.instrumentation

* Add unit tests

* Update related github workflow

* Add or update CHANGELOG.md and UPGRADING.md

* patch
  • Loading branch information
jvoravong authored Sep 5, 2024
1 parent 5d83577 commit a185657
Show file tree
Hide file tree
Showing 12 changed files with 526 additions and 78 deletions.
12 changes: 12 additions & 0 deletions .chloggen/operator-instrumentation-update.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: breaking
# The name of the component, or a single word describing the area of concern, (e.g. agent, clusterReceiver, gateway, operator, chart, other)
component: operator
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Operator Helm values previously under `.Values.operator.instrumentation.spec.*` have been moved to `.Values.instrumentation.*`
# One or more tracking issues related to the change
issues: [1436]
# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext: If you use custom values under `.Values.operator.instrumentation.spec.*` please review the [upgrade guidelines](https://github.com/signalfx/splunk-otel-collector-chart/blob/main/UPGRADING.md#01055-01080)
6 changes: 3 additions & 3 deletions .github/workflows/update_docker_images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ jobs:
- name: 'java'
component: 'operator'
yaml_file_path: 'helm-charts/splunk-otel-collector/values.yaml'
yaml_value_path: '.operator.instrumentation.spec.java'
yaml_value_path: '.instrumentation.java'
filter: 'v2.'
- name: 'nodejs'
component: 'operator'
yaml_file_path: 'helm-charts/splunk-otel-collector/values.yaml'
yaml_value_path: '.operator.instrumentation.spec.nodejs'
yaml_value_path: '.instrumentation.nodejs'
- name: 'dotnet'
component: 'operator'
yaml_file_path: 'helm-charts/splunk-otel-collector/values.yaml'
yaml_value_path: '.operator.instrumentation.spec.dotnet'
yaml_value_path: '.instrumentation.dotnet'
- name: 'fluentd-hec'
component: 'agent'
yaml_file_path: 'helm-charts/splunk-otel-collector/values.yaml'
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ pre-commit: render ## Test the Helm chart with pre-commit
.PHONY: unittest
unittest: ## Run unittests on the Helm chart
@echo "Running unit tests on helm chart..."
cd helm-charts/splunk-otel-collector && helm unittest --strict -f ../../test/unittests/*.yaml . || exit 1
cd helm-charts/splunk-otel-collector && helm unittest --strict -f "../../test/unittests/*.yaml" . || exit 1

##@ Changelog
# Tasks related to changelog management
Expand Down
32 changes: 32 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
# Upgrade guidelines

## 0.105.5 to 0.108.0

We've simplified the Helm chart configuration for `operator` auto-instrumentation.
The values previously under `.Values.operator.instrumentation.spec.*` have been moved to `.Values.instrumentation.*`.

- **No Action Needed**: If you have no customizations under `.Values.operator.instrumentation.spec.*`, no migration is required.
- **Action Required**: Continuing to use the old values path will result in a Helm install or upgrade error, blocking the process.

Migration Steps:

1. **Find** any references to `.Values.operator.instrumentation.spec.*` in your Helm values with custom values.
2. **Migrate** them from `.Values.operator.instrumentation.spec.*` to `.Values.instrumentation.*`.

Example Migration:

Before (Deprecated Path):

```yaml
operator:
instrumentation:
spec:
endpoint: XXX
...
```

After (Updated Path):
```yaml
instrumentation:
endpoint: XXX
...
```

## 0.105.3 to 0.105.4

The `Java instrumentation` for Operator auto-instrumentation has been upgraded from v1.32.2 to v2.7.0.
Expand Down
24 changes: 12 additions & 12 deletions helm-charts/splunk-otel-collector/templates/operator/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ Helper to ensure the correct usage of the Splunk OpenTelemetry Collector Operato

{{- /* Check if the endpoint is overridden in the Helm values */ -}}
{{- $endpointOverridden := and
.Values.operator.instrumentation.spec
.Values.operator.instrumentation.spec.exporter
.Values.operator.instrumentation.spec.exporter.endpoint
(ne .Values.operator.instrumentation.spec.exporter.endpoint "")
.Values.instrumentation
.Values.instrumentation.exporter
.Values.instrumentation.exporter.endpoint
(ne .Values.instrumentation.exporter.endpoint "")
-}}

{{- /* Validate the configuration */ -}}
Expand All @@ -40,12 +40,12 @@ Helper to define an endpoint for exporting telemetry data related to auto-instru

{{- /* Use the user-defined endpoint if specified in the Helm values */ -}}
{{- if and
.Values.operator.instrumentation.spec
.Values.operator.instrumentation.spec.exporter
.Values.operator.instrumentation.spec.exporter.endpoint
(ne .Values.operator.instrumentation.spec.exporter.endpoint "")
.Values.instrumentation
.Values.instrumentation.exporter
.Values.instrumentation.exporter.endpoint
(ne .Values.instrumentation.exporter.endpoint "")
}}
{{- $endpoint = .Values.operator.instrumentation.spec.exporter.endpoint -}}
{{- $endpoint = .Values.instrumentation.exporter.endpoint -}}
{{- /* Use the agent service endpoint if the agent is enabled */ -}}
{{- else if .Values.agent.service.enabled -}}
{{- $endpoint = printf "http://%s-agent.%s.svc.cluster.local:4317" (include "splunk-otel-collector.fullname" .) .Release.Namespace -}}
Expand All @@ -57,7 +57,7 @@ Helper to define an endpoint for exporting telemetry data related to auto-instru
{{- $endpoint = printf "http://%s:4317" (include "splunk-otel-collector.fullname" .) -}}
{{- /* Fail if no valid endpoint is available */ -}}
{{- else -}}
{{- fail "When operator.enabled=true, (splunkPlatform.tracesEnabled=true or splunkObservability.tracesEnabled=true), either agent.enabled=true, gateway.enabled=true, or .Values.operator.instrumentation.spec.exporter.endpoint must be set" -}}
{{- fail "When operator.enabled=true, (splunkPlatform.tracesEnabled=true or splunkObservability.tracesEnabled=true), either agent.enabled=true, gateway.enabled=true, or .Values.instrumentation.exporter.endpoint must be set" -}}
{{- end -}}

{{- /* Return the determined endpoint */ -}}
Expand All @@ -81,8 +81,8 @@ Helper to define entries for instrumentation libraries.
{{- $instLibAliases := dict "apache-httpd" "apacheHttpd" -}}

{{- /* Iterate over each specified instrumentation library */ -}}
{{- if .Values.operator.instrumentation.spec -}}
{{- range $key, $value := .Values.operator.instrumentation.spec -}}
{{- if .Values.instrumentation -}}
{{- range $key, $value := .Values.instrumentation -}}
{{- /* Check for required fields to determine if it is an instrumentation library */ -}}
{{- if and (eq (kindOf $value) "map") $value.repository $value.tag -}}
{{- $instLibName := get $instLibAliases $key | default $key -}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ spec:
- tracecontext
- baggage
- b3
{{- with .Values.operator.instrumentation.spec.sampler }}
{{- with .Values.instrumentation.sampler }}
sampler:
{{- toYaml . | nindent 4 }}
{{- end }}
env:
{{- if .Values.splunkObservability.profilingEnabled }}
{{- if eq (include "splunk-otel-collector.operator.env-has" (dict "env" .Values.operator.instrumentation.spec.env "envName" "SPLUNK_PROFILER_ENABLED")) "false" }}
{{- if eq (include "splunk-otel-collector.operator.env-has" (dict "env" .Values.instrumentation.env "envName" "SPLUNK_PROFILER_ENABLED")) "false" }}
- name: SPLUNK_PROFILER_ENABLED
value: "true"
{{- end }}
{{- if eq (include "splunk-otel-collector.operator.env-has" (dict "env" .Values.operator.instrumentation.spec.env "envName" "SPLUNK_PROFILER_MEMORY_ENABLED")) "false" }}
{{- if eq (include "splunk-otel-collector.operator.env-has" (dict "env" .Values.instrumentation.env "envName" "SPLUNK_PROFILER_MEMORY_ENABLED")) "false" }}
- name: SPLUNK_PROFILER_MEMORY_ENABLED
value: "true"
{{- end }}
Expand All @@ -42,7 +42,7 @@ spec:
apiVersion: v1
fieldPath: status.hostIP
{{- end }}
{{- with .Values.operator.instrumentation.spec.env }}
{{- with .Values.instrumentation.env }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{ include "splunk-otel-collector.operator.instrumentation-libraries" . }}
Expand Down
Loading

0 comments on commit a185657

Please sign in to comment.