Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(instrumentation): move instrumentation configuration from opentelemetry-operator #3733

Merged
merged 12 commits into from
Jun 13, 2024
Original file line number Diff line number Diff line change
@@ -1,25 +1,14 @@
{{- $ctx := . -}}
{{- $operator := index .Values "opentelemetry-operator" -}}
{{- if eq ( get $operator "instrumentationNamespaces" ) "" -}}
{{ fail "No value for \"opentelemetry-operator.instrumentationNamespaces\".Value is comma separated namespaces e.g. \"ns1\\,ns2\"" }}
{{- $instrumentation := .Values.instrumentation -}}
{{- $operatorAiImages := index .Values "opentelemetry-operator" "manager" "autoInstrumentationImage" -}}
{{- if eq ( get $instrumentation "instrumentationNamespaces" ) "" -}}
{{ fail "No value for \"instrumentation.instrumentationNamespaces\".Value is comma separated namespaces e.g. \"ns1\\,ns2\"" }}
{{- else -}}
{{- range $ns := splitList "," $operator.instrumentationNamespaces -}}
{{- $dotnetImage := printf "%s:%s" $operator.instrumentation.dotnet.repository $operator.instrumentation.dotnet.tag -}}
{{- if $operator.instrumentation.dotnet.image -}}
{{- $dotnetImage = $operator.instrumentation.dotnet.image -}}
{{- end -}}
{{- $pythonImage := printf "%s:%s" $operator.instrumentation.python.repository $operator.instrumentation.python.tag -}}
{{- if $operator.instrumentation.python.image -}}
{{- $pythonImage = $operator.instrumentation.python.image -}}
{{- end -}}
{{- $nodeJSImage := printf "%s:%s" $operator.instrumentation.nodejs.repository $operator.instrumentation.nodejs.tag -}}
{{- if $operator.instrumentation.nodejs.image -}}
{{- $nodeJSImage = $operator.instrumentation.nodejs.image -}}
{{- end -}}
{{- $javaImage := printf "%s:%s" $operator.instrumentation.java.repository $operator.instrumentation.java.tag -}}
{{- if $operator.instrumentation.java.image -}}
{{- $javaImage = $operator.instrumentation.java.image -}}
{{- end -}}
{{- range $ns := splitList "," $instrumentation.instrumentationNamespaces -}}
{{- $dotnetImage := printf "%s:%s" $operatorAiImages.dotnet.repository $operatorAiImages.dotnet.tag -}}
{{- $pythonImage := printf "%s:%s" $operatorAiImages.python.repository $operatorAiImages.python.tag -}}
{{- $nodeJSImage := printf "%s:%s" $operatorAiImages.nodejs.repository $operatorAiImages.nodejs.tag -}}
{{- $javaImage := printf "%s:%s" $operatorAiImages.java.repository $operatorAiImages.java.tag -}}
---
apiVersion: opentelemetry.io/v1alpha1
kind: Instrumentation
Expand All @@ -44,53 +33,53 @@ spec:
image: {{ $dotnetImage }}
env:
- name: OTEL_METRICS_EXPORTER
value: {{ include "instrumentation.resource.exporter" (dict "enabled" $operator.instrumentation.dotnet.metrics.enabled) }}
value: {{ include "instrumentation.resource.exporter" (dict "enabled" $instrumentation.dotnet.metrics.enabled) }}
- name: OTEL_LOGS_EXPORTER
value: none
- name: OTEL_TRACES_EXPORTER
value: {{ include "instrumentation.resource.exporter" (dict "enabled" $operator.instrumentation.dotnet.traces.enabled) }}
value: {{ include "instrumentation.resource.exporter" (dict "enabled" $instrumentation.dotnet.traces.enabled) }}
- name: OTEL_EXPORTER_OTLP_PROTOCOL
value: http/protobuf
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: http://{{- include "sumologic.opentelemetry.operator.instrumentation.collector.endpoint" $ctx }}:4318
{{- if $operator.instrumentation.dotnet.extraEnvVars -}}
{{- toYaml $operator.instrumentation.dotnet.extraEnvVars | nindent 6 -}}
{{- if $instrumentation.dotnet.extraEnvVars -}}
{{- toYaml $instrumentation.dotnet.extraEnvVars | nindent 6 -}}
{{- end }}
python:
image: {{ $pythonImage }}
env:
- name: OTEL_METRICS_EXPORTER
value: {{ include "instrumentation.resource.exporter" (dict "enabled" $operator.instrumentation.python.metrics.enabled) }}
value: {{ include "instrumentation.resource.exporter" (dict "enabled" $instrumentation.python.metrics.enabled) }}
- name: OTEL_TRACES_EXPORTER
value: {{ include "instrumentation.resource.exporter" (dict "enabled" $operator.instrumentation.python.traces.enabled) }}
value: {{ include "instrumentation.resource.exporter" (dict "enabled" $instrumentation.python.traces.enabled) }}
- name: OTEL_EXPORTER_OTLP_PROTOCOL
value: http/protobuf
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: http://{{- include "sumologic.opentelemetry.operator.instrumentation.collector.endpoint" $ctx }}:4318
{{- if $operator.instrumentation.python.extraEnvVars -}}
{{- toYaml $operator.instrumentation.python.extraEnvVars | nindent 6 -}}
{{- if $instrumentation.python.extraEnvVars -}}
{{- toYaml $instrumentation.python.extraEnvVars | nindent 6 -}}
{{- end }}
nodejs:
image: {{ $nodeJSImage }}
env:
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: http://{{- include "sumologic.opentelemetry.operator.instrumentation.collector.endpoint" $ctx }}:4317
{{- if $operator.instrumentation.nodejs.extraEnvVars -}}
{{- toYaml $operator.instrumentation.nodejs.extraEnvVars | nindent 6 -}}
{{- if $instrumentation.nodejs.extraEnvVars -}}
{{- toYaml $instrumentation.nodejs.extraEnvVars | nindent 6 -}}
{{- end }}
java:
image: {{ $javaImage }}
env:
- name: OTEL_METRICS_EXPORTER
value: {{ include "instrumentation.resource.exporter" (dict "enabled" $operator.instrumentation.java.metrics.enabled) }}
value: {{ include "instrumentation.resource.exporter" (dict "enabled" $instrumentation.java.metrics.enabled) }}
- name: OTEL_TRACES_EXPORTER
value: {{ include "instrumentation.resource.exporter" (dict "enabled" $operator.instrumentation.java.traces.enabled) }}
value: {{ include "instrumentation.resource.exporter" (dict "enabled" $instrumentation.java.traces.enabled) }}
- name: OTEL_EXPORTER_OTLP_PROTOCOL
value: http/protobuf
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: http://{{- include "sumologic.opentelemetry.operator.instrumentation.collector.endpoint" $ctx }}:4318
{{- if $operator.instrumentation.java.extraEnvVars -}}
{{- toYaml $operator.instrumentation.java.extraEnvVars | nindent 6 -}}
{{- if $instrumentation.java.extraEnvVars -}}
{{- toYaml $instrumentation.java.extraEnvVars | nindent 6 -}}
{{- end }}
{{ end -}}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{ $operatorEnabled := index .Values "opentelemetry-operator" "enabled" }}
{{ $tracesEnabled := .Values.sumologic.traces.enabled }}
{{ $createDefaultInstrumentation := index .Values "opentelemetry-operator" "createDefaultInstrumentation" }}
{{ $createDefaultInstrumentation := .Values.instrumentation.createDefaultInstrumentation }}
{{- if and $operatorEnabled $tracesEnabled $createDefaultInstrumentation }}
apiVersion: v1
kind: ConfigMap
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{{- $ctx := . }}
{{ $operatorEnabled := index .Values "opentelemetry-operator" "enabled" }}
{{ $tracesEnabled := .Values.sumologic.traces.enabled }}
{{ $createDefaultInstrumentation := index .Values "opentelemetry-operator" "createDefaultInstrumentation" }}
{{ $createDefaultInstrumentation := .Values.instrumentation.createDefaultInstrumentation }}
{{- if and $operatorEnabled $tracesEnabled $createDefaultInstrumentation }}
{{ $instrumentationJobImage := index .Values "opentelemetry-operator" "instrumentationJobImage" "image" }}
{{ $instrumentationJobImage := .Values.instrumentation.instrumentationJobImage.image }}
apiVersion: batch/v1
kind: Job
metadata:
Expand Down
137 changes: 65 additions & 72 deletions deploy/helm/sumologic/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2438,78 +2438,6 @@ tailing-sidecar-operator:
opentelemetry-operator:
enabled: true

## Specific for Sumo Logic chart - Instrumentation resource creation
instrumentationJobImage:
image:
repository: public.ecr.aws/sumologic/kubernetes-tools-kubectl
tag: 2.22.0

createDefaultInstrumentation: false
instrumentationNamespaces: ""

instrumentation:
dotnet:
repository: public.ecr.aws/sumologic/autoinstrumentation-dotnet
tag: 0.7.0

## image is deprecated, it should be specified in ${repository}:${tag} format
image: ""
traces:
enabled: true
metrics:
enabled: true

## Extra Environment Values - allows yaml definitions
# extraEnvVars:
# - name: OTEL_CUSTOM_ENV_VAR
# value: my_value

java:
repository: public.ecr.aws/sumologic/autoinstrumentation-java
tag: 1.26.0

## image is deprecated, it should be specified in ${repository}:${tag} format
image: ""
traces:
enabled: true
metrics:
enabled: true

## Extra Environment Values - allows yaml definitions
# extraEnvVars:
# - name: OTEL_CUSTOM_ENV_VAR
# value: my_value

python:
repository: public.ecr.aws/sumologic/autoinstrumentation-python
tag: 0.39b0

## image is deprecated, it should be specified in ${repository}:${tag} format
image: ""
traces:
enabled: true
metrics:
enabled: true

## Extra Environment Values - allows yaml definitions
# extraEnvVars:
# - name: OTEL_CUSTOM_ENV_VAR
# value: my_value

## Current instrumentation doesn't support customization
## for nodejs. Traces are always enabled.
nodejs:
repository: public.ecr.aws/sumologic/autoinstrumentation-nodejs
tag: 0.40.0

## image is deprecated, it should be specified in ${repository}:${tag} format
image: ""

## Extra Environment Values - allows yaml definitions
# extraEnvVars:
# - name: OTEL_CUSTOM_ENV_VAR
# value: my_value

## Specific for OpenTelemetry Operator chart values
admissionWebhooks:
failurePolicy: Fail
Expand All @@ -2532,6 +2460,19 @@ opentelemetry-operator:
collectorImage:
repository: "public.ecr.aws/sumologic/sumologic-otel-collector"
tag: "0.99.0-sumo-0"
autoInstrumentationImage:
java:
repository: public.ecr.aws/sumologic/autoinstrumentation-java
tag: 1.26.0
dotnet:
repository: public.ecr.aws/sumologic/autoinstrumentation-dotnet
tag: 0.7.0
python:
repository: public.ecr.aws/sumologic/autoinstrumentation-python
tag: 0.39b0
nodejs:
repository: public.ecr.aws/sumologic/autoinstrumentation-nodejs
tag: 0.40.0
env:
{}
# ENABLE_WEBHOOKS: "true"
Expand Down Expand Up @@ -2596,6 +2537,58 @@ pvcCleaner:
securityContext:
runAsUser: 1000

## Configure instrumentation for OpenTelemetry-Operator
instrumentation:
## Specific for Sumo Logic chart - Instrumentation resource creation
instrumentationJobImage:
image:
repository: public.ecr.aws/sumologic/kubernetes-tools-kubectl
tag: 2.22.0

createDefaultInstrumentation: false
instrumentationNamespaces: ""

dotnet:
traces:
enabled: true
metrics:
enabled: true
## Extra Environment Values - allows yaml definitions
# extraEnvVars:
# - name: OTEL_CUSTOM_ENV_VAR
# value: my_value

java:
traces:
enabled: true
metrics:
enabled: true

## Extra Environment Values - allows yaml definitions
# extraEnvVars:
# - name: OTEL_CUSTOM_ENV_VAR
# value: my_value

python:
traces:
enabled: true
metrics:
enabled: true

## Extra Environment Values - allows yaml definitions
# extraEnvVars:
# - name: OTEL_CUSTOM_ENV_VAR
# value: my_value

## Current instrumentation doesn't support customization
## for nodejs. Traces are always enabled.
nodejs:
{}
## Extra Environment Values - allows yaml definitions
# extraEnvVars:
# - name: OTEL_CUSTOM_ENV_VAR
# value: my_value

## The following section is not a subject of standard support scope and should be considered experimental
## All of them are meant for debugging purposed and shouldn't be used on production environments
debug:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,39 @@
opentelemetry-operator:
enabled: true
manager:
autoInstrumentationImage:
dotnet:
repository: myrepo
tag: mytag
python:
repository: myrepo
tag: mytag
nodejs:
repository: myrepo
tag: mytag
java:
repository: myrepo
tag: mytag
instrumentation:
createDefaultInstrumentation: true
instrumentationNamespaces: "ot-operator1,ot-operator2"
instrumentation:
dotnet:
repository: myrepo
tag: mytag
image: dotnetimg
extraEnvVars:
- name: "test"
value: "dotnetval"
python:
repository: myrepo
tag: mytag
image: pythonimg
extraEnvVars:
- name: "test"
value: "pythonval"
nodejs:
repository: myrepo
tag: mytag
image: nodejsimg
extraEnvVars:
- name: "test"
value: "nodeval"
java:
repository: myrepo
tag: mytag
image: javaimg
extraEnvVars:
- name: "test"
value: "javaval"
instrumentationJobImage:
image:
repository: asd
tag: asd
dotnet:
extraEnvVars:
- name: "test"
value: "dotnetval"
python:
extraEnvVars:
- name: "test"
value: "pythonval"
nodejs:
extraEnvVars:
- name: "test"
value: "nodeval"
java:
extraEnvVars:
- name: "test"
value: "javaval"
Loading
Loading