Skip to content

Commit c8c1af0

Browse files
committed
Update otelcontribcol to 0.106.0-gke.2
This change updates otelcoontribcol to latest and modifies to fit breaking changes from 0.104.0 and 0.106.0. Breaking change in 0.104.0 https://github.com/open-telemetry/opentelemetry-collector-contrib/releases/tag/v0.104.0 Breaking change in 0.106.0 open-telemetry/opentelemetry-collector-contrib#34430 - Localhost is now the default setting, while otel-agent and otel-collector require 0.0.0.0, so the feature gate has been removed. - The format of the environment variable was updated to meet the new syntax requirements. The otel-agent ConfigMap was split between the reconciler and controllers, ensuring that sync-related labels are only applied to reconcilers. - A `no_op_label` has been added to ensure that the aggregation in the metricstransform processor filters on all metric labels. This is a temporary workaround until a permanent fix is implemented upstream.
1 parent f19cd05 commit c8c1af0

File tree

10 files changed

+96
-30
lines changed

10 files changed

+96
-30
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ COSIGN := $(BIN_DIR)/cosign
8989
GIT_SYNC_VERSION := v4.3.0-gke.4__linux_amd64
9090
GIT_SYNC_IMAGE_NAME := gcr.io/config-management-release/git-sync:$(GIT_SYNC_VERSION)
9191

92-
OTELCONTRIBCOL_VERSION := v0.103.0-gke.5
92+
OTELCONTRIBCOL_VERSION := v0.106.0-gke.2
9393
OTELCONTRIBCOL_IMAGE_NAME := gcr.io/config-management-release/otelcontribcol:$(OTELCONTRIBCOL_VERSION)
9494

9595
# Directory used for staging Docker contexts.

manifests/base/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ resources:
2323
- ../ns-reconciler-base-cluster-role.yaml
2424
- ../root-reconciler-base-cluster-role.yaml
2525
- ../otel-agent-cm.yaml
26+
- ../otel-agent-reconciler-cm.yaml
2627
- ../reconciler-manager-service-account.yaml
2728
- ../reposync-crd.yaml
2829
- ../rootsync-crd.yaml

manifests/otel-agent-cm.yaml

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,6 @@ data:
3232
tls:
3333
insecure: true
3434
processors:
35-
# Attributes processor adds custom configsync metric labels to applicable
36-
# metrics to identify the sync object used to configure this deployment.
37-
#
38-
# Note: configsync.sync.generation is explicitly excluded here, because it
39-
# is high cardinality. So we don't want to send it as a label, only as a
40-
# resource attribute. That way it's only propagated to Prometheus, and not
41-
# Monarch or Cloud Monitoring, which ignore custom resource attributes.
42-
attributes:
43-
actions:
44-
- key: configsync.sync.kind
45-
action: upsert
46-
value: $CONFIGSYNC_SYNC_KIND
47-
- key: configsync.sync.name
48-
action: upsert
49-
value: $CONFIGSYNC_SYNC_NAME
50-
- key: configsync.sync.namespace
51-
action: upsert
52-
value: $CONFIGSYNC_SYNC_NAMESPACE
5335
batch:
5436
# Populate resource attributes from OTEL_RESOURCE_ATTRIBUTES env var and
5537
# the GCE metadata service, if available.
@@ -62,7 +44,7 @@ data:
6244
pipelines:
6345
metrics:
6446
receivers: [opencensus]
65-
processors: [batch, resourcedetection, attributes]
47+
processors: [batch, resourcedetection]
6648
exporters: [opencensus]
6749
telemetry:
6850
logs:
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Copyright 2024 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: v1
16+
kind: ConfigMap
17+
metadata:
18+
name: otel-agent-reconciler
19+
namespace: config-management-system
20+
labels:
21+
app: opentelemetry
22+
component: otel-agent
23+
configmanagement.gke.io/system: "true"
24+
configmanagement.gke.io/arch: "csmr"
25+
data:
26+
otel-agent-reconciler-config.yaml: |
27+
receivers:
28+
opencensus:
29+
exporters:
30+
opencensus:
31+
endpoint: otel-collector.config-management-monitoring:55678
32+
tls:
33+
insecure: true
34+
processors:
35+
# Attributes processor adds custom configsync metric labels to applicable
36+
# metrics to identify the sync object used to configure this deployment.
37+
#
38+
# Note: configsync.sync.generation is explicitly excluded here, because it
39+
# is high cardinality. So we don't want to send it as a label, only as a
40+
# resource attribute. That way it's only propagated to Prometheus, and not
41+
# Monarch or Cloud Monitoring, which ignore custom resource attributes.
42+
attributes:
43+
actions:
44+
- key: configsync.sync.kind
45+
action: upsert
46+
value: ${CONFIGSYNC_SYNC_KIND}
47+
- key: configsync.sync.name
48+
action: upsert
49+
value: ${CONFIGSYNC_SYNC_NAME}
50+
- key: configsync.sync.namespace
51+
action: upsert
52+
value: ${CONFIGSYNC_SYNC_NAMESPACE}
53+
batch:
54+
# Populate resource attributes from OTEL_RESOURCE_ATTRIBUTES env var and
55+
# the GCE metadata service, if available.
56+
resourcedetection:
57+
detectors: [env, gcp]
58+
extensions:
59+
health_check:
60+
service:
61+
extensions: [health_check]
62+
pipelines:
63+
metrics:
64+
receivers: [opencensus]
65+
processors: [batch, resourcedetection, attributes]
66+
exporters: [opencensus]
67+
telemetry:
68+
logs:
69+
level: "INFO"

manifests/templates/otel-collector.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ spec:
101101
# The prometheus transformer appends `_ratio` to gauge metrics: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/v0.86.0/pkg/translator/prometheus/normalize_name.go#L149
102102
# Add the feature gate to enable metric suffix trimming.
103103
- "--feature-gates=-pkg.translator.prometheus.NormalizeName"
104+
- "--feature-gates=-component.UseLocalHostAsDefaultHost"
104105
resources:
105106
limits:
106107
cpu: 1

manifests/templates/reconciler-manager-configmap.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,11 @@ data:
175175
command:
176176
- /otelcontribcol
177177
args:
178-
- "--config=/conf/otel-agent-config.yaml"
178+
- "--config=/conf/otel-agent-reconciler-config.yaml"
179179
# The prometheus transformer appends `_ratio` to gauge metrics: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/v0.86.0/pkg/translator/prometheus/normalize_name.go#L149
180180
# Add the feature gate to enable metric suffix trimming.
181181
- "--feature-gates=-pkg.translator.prometheus.NormalizeName"
182+
- "--feature-gates=-component.UseLocalHostAsDefaultHost"
182183
securityContext:
183184
allowPrivilegeEscalation: false
184185
readOnlyRootFilesystem: true
@@ -191,7 +192,7 @@ data:
191192
- containerPort: 8888 # Metrics.
192193
protocol: TCP
193194
volumeMounts:
194-
- name: otel-agent-config-vol
195+
- name: otel-agent-config-reconciler-vol
195196
mountPath: /conf
196197
readinessProbe:
197198
httpGet:
@@ -282,9 +283,9 @@ data:
282283
secret:
283284
secretName: git-creds
284285
defaultMode: 288
285-
- name: otel-agent-config-vol
286+
- name: otel-agent-config-reconciler-vol
286287
configMap:
287-
name: otel-agent
288+
name: otel-agent-reconciler
288289
defaultMode: 420
289290
- name: service-account
290291
emptyDir: {}

manifests/templates/reconciler-manager.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ spec:
7171
# The prometheus transformer appends `_ratio` to gauge metrics: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/v0.86.0/pkg/translator/prometheus/normalize_name.go#L149
7272
# Add the feature gate to enable metric suffix trimming.
7373
- "--feature-gates=-pkg.translator.prometheus.NormalizeName"
74+
- "--feature-gates=-component.UseLocalHostAsDefaultHost"
7475
resources:
7576
limits:
7677
cpu: 1

manifests/templates/resourcegroup-manifest.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ spec:
232232
- args:
233233
- --config=/conf/otel-agent-config.yaml
234234
- --feature-gates=-pkg.translator.prometheus.NormalizeName
235+
- --feature-gates=-component.UseLocalHostAsDefaultHost
235236
command:
236237
- /otelcontribcol
237238
env:

pkg/metrics/otel.go

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,9 @@ processors:
184184
new_name: current_declared_resources
185185
operations:
186186
- action: aggregate_labels
187-
label_set: []
187+
# Using a no_op_label to get around issue in the upstream
188+
# https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/34430
189+
label_set: [no_op_label]
188190
aggregation_type: max
189191
- include: kcc_resource_count
190192
action: update
@@ -255,14 +257,18 @@ processors:
255257
new_name: resource_conflicts_count
256258
operations:
257259
- action: aggregate_labels
258-
label_set: []
260+
# Using a no_op_label to get around issue in the upstream
261+
# https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/34430
262+
label_set: [no_op_label]
259263
aggregation_type: max
260264
- include: internal_errors_total
261265
action: update
262266
new_name: internal_errors_count
263267
operations:
264268
- action: aggregate_labels
265-
label_set: []
269+
# Using a no_op_label to get around issue in the upstream
270+
# https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/34430
271+
label_set: [no_op_label]
266272
aggregation_type: max
267273
- include: remediate_duration_seconds
268274
action: update
@@ -322,13 +328,17 @@ processors:
322328
action: update
323329
operations:
324330
- action: aggregate_labels
325-
label_set: []
331+
# Using a no_op_label to get around issue in the upstream
332+
# https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/34430
333+
label_set: [no_op_label]
326334
aggregation_type: max
327335
- include: kustomize_build_latency
328336
action: update
329337
operations:
330338
- action: aggregate_labels
331-
label_set: []
339+
# Using a no_op_label to get around issue in the upstream
340+
# https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/34430
341+
label_set: [no_op_label]
332342
aggregation_type: max
333343
extensions:
334344
health_check:

pkg/reconcilermanager/controllers/otel_controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const (
4949
// otel-collector ConfigMap.
5050
// See `CollectorConfigGooglecloud` in `pkg/metrics/otel.go`
5151
// Used by TestOtelReconcilerGooglecloud.
52-
depAnnotationGooglecloud = "c2f6078a9afe1f32721173e9e15bbab5"
52+
depAnnotationGooglecloud = "bfa02552b80a227256e825c807254b40"
5353
// depAnnotationGooglecloud is the expected hash of the custom
5454
// otel-collector ConfigMap test artifact.
5555
// Used by TestOtelReconcilerCustom.

0 commit comments

Comments
 (0)