Skip to content

Commit

Permalink
patch: move non-dynamic instrumentation configurations to values.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
jvoravong committed Jul 13, 2023
1 parent da8f7c8 commit 3269653
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 72 deletions.
4 changes: 2 additions & 2 deletions examples/enable-operator-and-auto-instrumentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ These helm install commands will deploy the chart to the current namespace for t
# Check if a cert-manager is already installed by looking for cert-manager pods.
kubectl get pods -l app=cert-manager --all-namespaces

# If cert-manager is not deployed, make sure to add certmanager.enabled=true to the list of values to set
helm install splunk-otel-collector -f ./my_values.yaml --set operator.enabled=true,environment=dev splunk-otel-collector-chart/splunk-otel-collector
# If cert-manager is deployed, make sure to remove certmanager.enabled=true to the list of values to set
helm install splunk-otel-collector -f ./my_values.yaml --set operator.enabled=true,certmanager.enabled=true,environment=dev splunk-otel-collector-chart/splunk-otel-collector
```

#### 2.2 Verify all the OpenTelemetry resources (collector, operator, webhook, instrumentation) are deployed successfully
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ spec:
- --health-probe-addr=:8081
- --webhook-port=9443
- --collector-image=otel/opentelemetry-collector-contrib:0.79.0
- --auto-instrumentation-java-image=ghcr.io/signalfx/splunk-otel-java/splunk-otel-java:v1.25.0
command:
- /manager
env:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ spec:
fieldPath: status.hostIP
exporter:
endpoint: http://$(SPLUNK_OTEL_AGENT):4317
java:
image: ghcr.io/signalfx/splunk-otel-java/splunk-otel-java:v1.25.0
propagators:
- tracecontext
- baggage
Expand Down
33 changes: 33 additions & 0 deletions helm-charts/splunk-otel-collector/templates/operator/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,36 @@
{{- fail "When operator.enabled=true, (splunkPlatform.tracesEnabled=true or splunkObservability.tracesEnabled=true), (agent.enabled=true or gateway.enabled=true), and .Values.operator.instrumentation.spec.exporter.endpoint is not set, either environment must be a non-empty string or operator.instrumentation.spec.env must contain an item with {name: OTEL_RESOURCE_ATTRIBUTES, value: non-empty string}" -}}
{{- end }}
{{- end }}

{{- define "splunk-otel-collector.operator.instrumentation.spec-base" -}}
exporter:
endpoint: {{- include "splunk-otel-collector.operator.instrumentation.exporter.endpoint" . | nindent 4 }}
env:
{{- if .Values.agent.enabled }}
- name: SPLUNK_OTEL_AGENT
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: status.hostIP
{{- end }}
{{- if .Values.splunkObservability.profilingEnabled }}
- name: SPLUNK_PROFILER_ENABLED
value: "true"
- name: SPLUNK_PROFILER_MEMORY_ENABLED
value: "true"
{{- end }}
python:
env:
# Required if endpoint is set to 4317.
# Python auto-instrumentation uses http/proto by default, so data must be sent to 4318 instead of 4317.
# See: https://github.com/open-telemetry/opentelemetry-operator#opentelemetry-auto-instrumentation-injection
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: {{- include "splunk-otel-collector.operator.instrumentation.exporter.endpoint" . | replace "4317" "4318" | nindent 6 }}
dotnet:
env:
# Required if endpoint is set to 4317.
# Dotnet auto-instrumentation uses http/proto by default, so data must be sent to 4318 instead of 4317.
# See: https://github.com/open-telemetry/opentelemetry-operator#opentelemetry-auto-instrumentation-injection
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: {{- include "splunk-otel-collector.operator.instrumentation.exporter.endpoint" . | replace "4317" "4318" | nindent 6 }}
{{- end }}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ metadata:
heritage: {{ .Release.Service }}
app.kubernetes.io/component: otel-operator
spec:
{{- $spec := include "splunk-otel-collector.operator.instrumentation.spec" . | fromYaml }}
{{- .Values.operator.instrumentation.spec | mustMergeOverwrite $spec | toYaml | nindent 4 }}
{{- $spec := include "splunk-otel-collector.operator.instrumentation.spec-base" . | fromYaml }}
{{- .Values.operator.instrumentation.spec | mustMergeOverwrite $spec | toYaml | nindent 4 }}
{{- end }}
74 changes: 45 additions & 29 deletions helm-charts/splunk-otel-collector/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1370,37 +1370,53 @@ operator:
# For more details, refer to: https://github.com/open-telemetry/opentelemetry-operator/blob/main/docs/api.md#instrumentation
instrumentation:
# Overrides for default instrumentation configurations can be specified here.
# Source: https://github.com/signalfx/splunk-otel-collector-chart/blob/main/helm-charts/splunk-otel-collector/templates/operator/instrumentation.yaml
# Rendered Default: https://github.com/signalfx/splunk-otel-collector-chart/blob/main/examples/enable-operator-and-auto-instrumentation/rendered_manifests/operator/instrumentation.yaml
spec:
# Optional "endpoint" parameter for exporting data to a specific target.
# By default, the endpoint will be set to the agent if it's enabled. If the agent is not enabled, the endpoint
# will default to the gateway, given it is enabled. If neither the agent nor the gateway is enabled, the endpoint
# must be overridden here.
# exporter:
# endpoint: http://$(SPLUNK_OTEL_AGENT):4317

# Optional "sampler" parameter for enabling trace sampling.
# Refer to: https://opentelemetry.io/docs/concepts/sdk-configuration/general-sdk-configuration/#otel_traces_sampler
# sampler:
# type: traceidratio
# argument: "0.95"

# Optional "environment variable" parameters that can configure all instrumentation libraries.
# env:
# # Sets the deployment.environment tag on spans
# - name: OTEL_RESOURCE_ATTRIBUTES
# value: "deployment.environment=dev"

manager:
autoInstrumentationImage:
# Optional "endpoint" parameter for exporting data to a specific target.
# By default, the endpoint will be set to the agent if it's enabled. If the agent is not enabled, the endpoint
# will default to the gateway, given it is enabled. If neither the agent nor the gateway is enabled, the endpoint
# must be overridden here.
# exporter:
# endpoint: http://$(SPLUNK_OTEL_AGENT):4317
propagators:
- tracecontext
- baggage
- b3
# Optional "sampler" parameter for enabling trace sampling, see: https://opentelemetry.io/docs/concepts/sdk-configuration/general-sdk-configuration/#otel_traces_sampler
# sampler:
# type: traceidratio
# argument: "0.95"
# Optional "environment variable" parameters that can configure all instrumentation libraries.
# env:
# Sets the deployment.environment tag on spans.
# - name: OTEL_RESOURCE_ATTRIBUTES
# value: "deployment.environment=dev"
# Parameters that can enable profiling for all instrumentation libraries.
# Both environment variables will be set to "true" when splunkObservability.profilingEnabled=true using Helm templates.
# - name: SPLUNK_PROFILER_ENABLED
# value: "true"
# - name: SPLUNK_PROFILER_MEMORY_ENABLED
# value: "true"
# Splunk Instrumentation Libraries
java:
repository: "ghcr.io/signalfx/splunk-otel-java/splunk-otel-java"
tag: "v1.25.0"
# name: nameOverride
# By default, the operator manager will watch all namespaces for instrumentation purposes.
# Use this env var to reduce the scope of watched environments.
# env:
# - name: WATCH_NAMESPACE
# value: targetNamespaceAlpha,targetNamespaceBravo
# TODO: Moving the image definitition here break a github workflow that updates this image. Update the workflow before merge.
image: ghcr.io/signalfx/splunk-otel-java/splunk-otel-java:v1.25.0
# OpenTelemetry Instrumentation Libraries
# For default version values, see: https://github:com/open-telemetry/opentelemetry-operator/releases
# apacheHttpd:
# image: ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-apache-httpd:X.X.X
# dotnet:
# Port 4318 is used for dotnet instead of 4317 if the default endpoint value is not overridden, see: https://github.com/open-telemetry/opentelemetry-operator#opentelemetry-auto-instrumentation-injection
# image: ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-dotnet:X.X.X
# go:
# image: ghcr.io/open-telemetry/opentelemetry-go-instrumentation/autoinstrumentation-go:X.X.X
# nodejs:
# image: ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-nodejs:X.X.X
# python:
# Port 4318 is used for python instead of 4317 if the default endpoint value is not overridden, see: https://github.com/open-telemetry/opentelemetry-operator#opentelemetry-auto-instrumentation-injection
# image: ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-python:X.X.X

admissionWebhooks:
certManager:
# The cert and issuer are annoted so they are instantiated after the cert-manager CRDs are installed.
Expand Down

0 comments on commit 3269653

Please sign in to comment.