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(opentelemetry-operator): upgrade opentelemetry-operator subchart to 0.13.0 #2561

Merged
merged 23 commits into from
Oct 18, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
75f017f
chore(chart): update version
mat-rumian Oct 7, 2022
b53f0d9
chore(tls): remove certificate creation, supported by operator chart
mat-rumian Oct 7, 2022
9978d72
chore(clusterole): add opentelemetry-operator api group
mat-rumian Oct 10, 2022
1bd7de7
chore(instrumentation): add instrumentation configmap and job
mat-rumian Oct 12, 2022
c18bf9c
chore(helpers): add instrumentation cr generator, cleanup
mat-rumian Oct 12, 2022
4cef75e
chore(operator): enable webhooks
mat-rumian Oct 12, 2022
9692567
chore(helpers): +\n
mat-rumian Oct 12, 2022
cdb1f6c
chore(docs): update instrumentation url
mat-rumian Oct 12, 2022
a485431
chore(instrumentation): update configuration for dotnet and java
mat-rumian Oct 12, 2022
a2c6daf
chore(tests): update instrumentation cm helm tests
mat-rumian Oct 12, 2022
5e8c596
chore(tests): add instrumentation job helm tests
mat-rumian Oct 12, 2022
46d3d43
chore(tests): cleanup operator tests
mat-rumian Oct 12, 2022
e19ac88
chore(instrumentatio-cr): move instrumentation cr to confs
mat-rumian Oct 17, 2022
d7e9c53
chore(instrumentation-cr): fix helm tests
mat-rumian Oct 17, 2022
1a471f6
chore(changelog): update
mat-rumian Oct 17, 2022
4dbda75
Merge branch 'main' into update-opentelemetry-operator-chart
mat-rumian Oct 17, 2022
0851115
chore(changelog): fix
mat-rumian Oct 17, 2022
7486256
chore(changelog): fix
mat-rumian Oct 17, 2022
c64bd72
chore(tests): update tests
mat-rumian Oct 18, 2022
ede0550
chore(opentelemetry-operator): split instrumentation resource creation
mat-rumian Oct 18, 2022
5ed5253
chore(opentelemetry-operator): split instrumentation resource creation
mat-rumian Oct 18, 2022
47d4004
chore(readme): update parameters list
mat-rumian Oct 18, 2022
6383f80
Merge branch 'main' into update-opentelemetry-operator-chart
mat-rumian Oct 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- feat: enable remote write proxy by default [#2483]
- chore: update kubernetes-tools to 2.13.0 [#2515]
- feat(metadata): upgrade otelcol to v0.57.2-sumo-1 [#2526]
- chore(opentelemetry-operator): upgrade opentelemetry-operator subchart to 0.13.0 [#2561]

### Fixed

Expand All @@ -30,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[#2510]: https://github.com/SumoLogic/sumologic-kubernetes-collection/pull/2510
[#2526]: https://github.com/SumoLogic/sumologic-kubernetes-collection/pull/2526
[#2544]: https://github.com/SumoLogic/sumologic-kubernetes-collection/pull/2544
[#2561]: https://github.com/SumoLogic/sumologic-kubernetes-collection/pull/2561
[Unreleased]: https://github.com/SumoLogic/sumologic-kubernetes-collection/compare/v2.17.0...main

## [v2.17.0]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{{- $ctx := . -}}
{{ $watchNamespace := index .Values "opentelemetry-operator" "manager" "env" }}
{{- if eq ( get $watchNamespace "WATCH_NAMESPACE" ) "" }}
{{ fail "It is mandatory to set value for \"opentelemetry-operator.manager.env.WATCH_NAMESPACE\" when opentelemetry-operator is enabled. Value is comma separated namespaces e.g. \"ns1\\,ns2\"" }}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this mandatory, actually? A user may not want to use Instrumentation at all and just have the operator manage OT in all namespaces.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If WATCH_NAMESPACE is not provided then in theory Operator should watch for all namespaces but it doesn't. At least in case of Instrumentation.

Logs say that Instrumentation resource exists and became default

{"level":"info","ts":1666018961.0456557,"logger":"instrumentation-resource","msg":"default","name":"collection-sumologic-ot-operator-instr"}
{"level":"info","ts":1666018961.0561447,"logger":"instrumentation-resource","msg":"validate update","name":"collection-sumologic-ot-operator-instr"}

But when I add annotation to the e.g. Deployment I'm getting this kind of error. Doesn't matter if annotation value is true or name-of-the-instrumentation-resource.

{"level":"error","ts":1666018765.0062091,"msg":"failed to select an OpenTelemetry Instrumentation instance for this pod","namespace":"","name":"","error":"no OpenTelemetry Instrumentation instances available","stacktrace":"github.com/open-telemetry/opentelemetry-operator/pkg/instrumentation.(*instPodMutator).Mutate\n\t/workspace/pkg/instrumentation/podmutator.go:102\ngithub.com/open-telemetry/opentelemetry-operator/internal/webhookhandler.(*podSidecarInjector).Handle\n\t/workspace/internal/webhookhandler/webhookhandler.go:92\nsigs.k8s.io/controller-runtime/pkg/webhook/admission.(*Webhook).Handle\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.13.0/pkg/webhook/admission/webhook.go:169\nsigs.k8s.io/controller-runtime/pkg/webhook/admission.(*Webhook).ServeHTTP\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.13.0/pkg/webhook/admission/http.go:98\ngithub.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerInFlight.func1\n\t/go/pkg/mod/github.com/prometheus/client_golang@v1.12.2/prometheus/promhttp/instrument_server.go:40\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2109\ngithub.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerCounter.func1\n\t/go/pkg/mod/github.com/prometheus/client_golang@v1.12.2/prometheus/promhttp/instrument_server.go:117\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2109\ngithub.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerDuration.func2\n\t/go/pkg/mod/github.com/prometheus/client_golang@v1.12.2/prometheus/promhttp/instrument_server.go:84\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2109\nnet/http.(*ServeMux).ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2487\nnet/http.serverHandler.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2947\nnet/http.(*conn).serve\n\t/usr/local/go/src/net/http/server.go:1991"}

I believe this is something to improve in the upstream.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, but what if you don't want instrumentation at all? I think we used to have a setting to disable default instrumentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're getting instrumentation out of the box. It's just a matter of creation of Instrumentation resource in the specific namespace.

{{ else }}
{{- range $ns := splitList "," ( index .Values "opentelemetry-operator" "manager" "env" "WATCH_NAMESPACE" ) }}
---
apiVersion: opentelemetry.io/v1alpha1
kind: Instrumentation
metadata:
namespace: {{ $ns }}
name: {{ template "sumologic.metadata.name.opentelemetry.operator.instrumentation" $ctx }}
labels:
app: {{ template "sumologic.labels.app.opentelemetry.operator.instrumentation" $ctx }}
{{- include "sumologic.labels.common" $ctx | nindent 4 }}
spec:
propagators:
- tracecontext
- baggage
- b3
- xray
resource:
addK8sUIDAttributes: false
sampler:
type: always_on
env:
- name: OTEL_APPLICATION_NAMESPACE_NAME
value: {{ $ns }}
- name: OTEL_RESOURCE_ATTRIBUTES
value: application={{ $ns }}
dotnet:
image: ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-dotnet:0.3.1-beta.1
env:
- name: OTEL_PROPAGATORS
value: tracecontext,baggage
- name: OTEL_METRICS_EXPORTER
value: none
- name: OTEL_LOGS_EXPORTER
value: none
- name: OTEL_TRACES_EXPORTER
value: otlp
- name: OTEL_EXPORTER_OTLP_PROTOCOL
value: http/protobuf
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: http://{{- include "sumologic.opentelemetry.operator.instrumentation.collector.endpoint" $ctx }}:4318
python:
# Force to use older image because of LOGS exporting issue
# https://github.com/open-telemetry/opentelemetry-python/issues/2594
image: ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-python:0.28b1
env:
- name: OTEL_TRACES_EXPORTER
value: otlp_proto_http
- name: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
value: http://{{- include "sumologic.opentelemetry.operator.instrumentation.collector.endpoint" $ctx }}:4318/v1/traces
nodejs:
image: ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-nodejs:0.27.0
env:
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: http://{{- include "sumologic.opentelemetry.operator.instrumentation.collector.endpoint" $ctx }}:4317
java:
image: ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-java:1.16.0
env:
- name: OTEL_METRICS_EXPORTER
value: none
- name: OTEL_TRACES_EXPORTER
value: otlp
- name: OTEL_EXPORTER_OTLP_PROTOCOL
value: http/protobuf
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: http://{{- include "sumologic.opentelemetry.operator.instrumentation.collector.endpoint" $ctx }}:4318
{{- end -}}
{{- end -}}
81 changes: 0 additions & 81 deletions deploy/helm/sumologic/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -1529,84 +1529,3 @@ Example Usage:
{{- define "opentelemetry-operator.controller.manager.metrics.service.url" -}}
http://opentelemetry-operator-controller-manager-metrics-service.{{ .Release.Namespace }}:8080/metrics
{{- end -}}

{{/*
Generate Instrumentation Custom Resource for specified namespaces.
*/}}

{{- define "opentelemetry-operator.instrumentation.custom.resource" -}}
{{- $ctx := . -}}
{{ $watchNamespace := index .Values "opentelemetry-operator" "manager" "env" }}
{{- if eq ( get $watchNamespace "WATCH_NAMESPACE" ) "" }}
{{ fail "It is mandatory to set value for \"opentelemetry-operator.manager.env.WATCH_NAMESPACE\" when opentelemetry-operator is enabled. Value is comma separated namespaces e.g. \"ns1\\,ns2\"" }}
{{ else }}
{{- range $ns := splitList "," ( index .Values "opentelemetry-operator" "manager" "env" "WATCH_NAMESPACE" ) }}
---
apiVersion: opentelemetry.io/v1alpha1
kind: Instrumentation
metadata:
namespace: {{ $ns }}
name: {{ template "sumologic.metadata.name.opentelemetry.operator.instrumentation" $ctx }}
labels:
app: {{ template "sumologic.labels.app.opentelemetry.operator.instrumentation" $ctx }}
{{- include "sumologic.labels.common" $ctx | nindent 4 }}
annotations:
"helm.sh/hook": "post-install,post-upgrade"
spec:
propagators:
- tracecontext
- baggage
- b3
- xray
resource:
addK8sUIDAttributes: false
sampler:
type: always_on
env:
- name: OTEL_APPLICATION_NAMESPACE_NAME
value: {{ $ns }}
- name: OTEL_RESOURCE_ATTRIBUTES
value: application={{ $ns }}
dotnet:
image: ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-dotnet:0.3.1-beta.1
env:
- name: OTEL_PROPAGATORS
value: tracecontext,baggage
- name: OTEL_METRICS_EXPORTER
value: none
- name: OTEL_LOGS_EXPORTER
value: none
- name: OTEL_TRACES_EXPORTER
value: otlp
- name: OTEL_EXPORTER_OTLP_PROTOCOL
value: http/protobuf
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: http://{{- include "sumologic.opentelemetry.operator.instrumentation.collector.endpoint" $ctx }}:4318
python:
# Force to use older image because of LOGS exporting issue
# https://github.com/open-telemetry/opentelemetry-python/issues/2594
image: ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-python:0.28b1
env:
- name: OTEL_TRACES_EXPORTER
value: otlp_proto_http
- name: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
value: http://{{- include "sumologic.opentelemetry.operator.instrumentation.collector.endpoint" $ctx }}:4318/v1/traces
nodejs:
image: ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-nodejs:0.27.0
env:
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: http://{{- include "sumologic.opentelemetry.operator.instrumentation.collector.endpoint" $ctx }}:4317
java:
image: ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-java:1.16.0
env:
- name: OTEL_METRICS_EXPORTER
value: none
- name: OTEL_TRACES_EXPORTER
value: otlp
- name: OTEL_EXPORTER_OTLP_PROTOCOL
value: http/protobuf
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: http://{{- include "sumologic.opentelemetry.operator.instrumentation.collector.endpoint" $ctx }}:4318
{{- end -}}
{{- end -}}
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ metadata:
app: {{ template "sumologic.labels.app.opentelemetry.operator.instrumentation.configmap" . }}
{{- include "sumologic.labels.common" . | nindent 4 }}
data:
instrumentation: |
{{- include "opentelemetry-operator.instrumentation.custom.resource" . | nindent 4 }}
instrumentation.cr.yaml: |
{{- (tpl (.Files.Get "conf/opentelemetry-operator/instrumentation.cr.yaml") .) | nindent 4 }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ spec:
volumeMounts:
- name: instrumentation-cr-configmap
mountPath: /tmp/instrumentation-cr.yaml
subPath: instrumentation
subPath: instrumentation.cr.yaml
command: ["/bin/bash", "-c"]
args:
- |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ metadata:
release: "RELEASE-NAME"
heritage: "Helm"
data:
instrumentation: |
instrumentation.cr.yaml: |

---
apiVersion: opentelemetry.io/v1alpha1
Expand All @@ -23,8 +23,6 @@ data:
chart: "sumologic-%CURRENT_CHART_VERSION%"
release: "RELEASE-NAME"
heritage: "Helm"
annotations:
"helm.sh/hook": "post-install,post-upgrade"
spec:
propagators:
- tracecontext
Expand Down Expand Up @@ -91,8 +89,6 @@ data:
chart: "sumologic-%CURRENT_CHART_VERSION%"
release: "RELEASE-NAME"
heritage: "Helm"
annotations:
"helm.sh/hook": "post-install,post-upgrade"
spec:
propagators:
- tracecontext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ spec:
volumeMounts:
- name: instrumentation-cr-configmap
mountPath: /tmp/instrumentation-cr.yaml
subPath: instrumentation
subPath: instrumentation.cr.yaml
command: ["/bin/bash", "-c"]
args:
- |
Expand Down