diff --git a/pkg/reconcilermanager/controllers/otel_controller_test.go b/pkg/reconcilermanager/controllers/otel_controller_test.go index 0d52054bf..8b785c56e 100644 --- a/pkg/reconcilermanager/controllers/otel_controller_test.go +++ b/pkg/reconcilermanager/controllers/otel_controller_test.go @@ -49,7 +49,7 @@ const ( // otel-collector ConfigMap. // See `CollectorConfigGooglecloud` in `pkg/metrics/otel.go` // Used by TestOtelReconcilerGooglecloud. - depAnnotationGooglecloud = "bfa02552b80a227256e825c807254b40" + depAnnotationGooglecloud = "5e22170ef10a382f587d3d7595fdaebc" // depAnnotationGooglecloud is the expected hash of the custom // otel-collector ConfigMap test artifact. // Used by TestOtelReconcilerCustom. diff --git a/test/kustomization/expected.yaml b/test/kustomization/expected.yaml index df1f6203e..d7932ce20 100644 --- a/test/kustomization/expected.yaml +++ b/test/kustomization/expected.yaml @@ -5618,9 +5618,10 @@ data: otel-collector-config.yaml: | receivers: opencensus: + endpoint: 0.0.0.0:55678 exporters: prometheus: - endpoint: :8675 + endpoint: 0.0.0.0:8675 namespace: config_sync resource_to_telemetry_conversion: enabled: true @@ -5651,6 +5652,47 @@ data: otel-agent-config.yaml: | receivers: opencensus: + endpoint: 0.0.0.0:55678 + exporters: + opencensus: + endpoint: otel-collector.config-management-monitoring:55678 + tls: + insecure: true + processors: + batch: + # Populate resource attributes from OTEL_RESOURCE_ATTRIBUTES env var and + # the GCE metadata service, if available. + resourcedetection: + detectors: [env, gcp] + extensions: + health_check: + endpoint: 0.0.0.0:13133 + service: + extensions: [health_check] + pipelines: + metrics: + receivers: [opencensus] + processors: [batch, resourcedetection] + exporters: [opencensus] + telemetry: + logs: + level: "INFO" +kind: ConfigMap +metadata: + labels: + app: opentelemetry + component: otel-agent + configmanagement.gke.io/arch: csmr + configmanagement.gke.io/system: "true" + name: otel-agent + namespace: config-management-system +--- +apiVersion: v1 +data: + otel-agent-reconciler-config.yaml: | + receivers: + opencensus: + endpoint: 0.0.0.0:55678 exporters: opencensus: endpoint: otel-collector.config-management-monitoring:55678 @@ -5668,13 +5710,13 @@ data: actions: - key: configsync.sync.kind action: upsert - value: $CONFIGSYNC_SYNC_KIND + value: ${CONFIGSYNC_SYNC_KIND} - key: configsync.sync.name action: upsert - value: $CONFIGSYNC_SYNC_NAME + value: ${CONFIGSYNC_SYNC_NAME} - key: configsync.sync.namespace action: upsert - value: $CONFIGSYNC_SYNC_NAMESPACE + value: ${CONFIGSYNC_SYNC_NAMESPACE} batch: # Populate resource attributes from OTEL_RESOURCE_ATTRIBUTES env var and # the GCE metadata service, if available. @@ -5700,7 +5742,7 @@ metadata: component: otel-agent configmanagement.gke.io/arch: csmr configmanagement.gke.io/system: "true" - name: otel-agent + name: otel-agent-reconciler namespace: config-management-system --- apiVersion: v1 @@ -5859,7 +5901,7 @@ data: command: - /otelcontribcol args: - - "--config=/conf/otel-agent-config.yaml" + - "--config=/conf/otel-agent-reconciler-config.yaml" # 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 # Add the feature gate to enable metric suffix trimming. - "--feature-gates=-pkg.translator.prometheus.NormalizeName" @@ -5874,8 +5916,10 @@ data: protocol: TCP - containerPort: 8888 # Metrics. protocol: TCP + - containerPort: 13133 # Health check + protocol: TCP volumeMounts: - - name: otel-agent-config-vol + - name: otel-agent-config-reconciler-vol mountPath: /conf readinessProbe: httpGet: @@ -5966,9 +6010,9 @@ data: secret: secretName: git-creds defaultMode: 288 - - name: otel-agent-config-vol + - name: otel-agent-config-reconciler-vol configMap: - name: otel-agent + name: otel-agent-reconciler defaultMode: 420 - name: service-account emptyDir: {} @@ -5992,6 +6036,7 @@ data: otel-agent-config.yaml: | receivers: opencensus: + endpoint: 0.0.0.0:55678 exporters: opencensus: endpoint: otel-collector.config-management-monitoring:55678 @@ -6052,6 +6097,8 @@ spec: port: 8888 - name: metrics port: 8675 + - name: health-check + port: 13133 selector: app: opentelemetry component: otel-collector @@ -6124,6 +6171,7 @@ spec: - containerPort: 55678 - containerPort: 8888 - containerPort: 8675 + - containerPort: 13133 readinessProbe: httpGet: path: / @@ -6335,6 +6383,7 @@ spec: ports: - containerPort: 55678 - containerPort: 8888 + - containerPort: 13133 readinessProbe: httpGet: path: / @@ -6458,6 +6507,7 @@ spec: ports: - containerPort: 55678 - containerPort: 8888 + - containerPort: 13133 readinessProbe: httpGet: path: / @@ -6488,6 +6538,23 @@ spec: name: resource-group-otel-agent name: otel-agent-config-vol --- +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: allow-port-ingress + namespace: config-management-monitoring +spec: + ingress: + - from: + - namespaceSelector: {} + ports: + - port: 55678 + protocol: TCP + podSelector: + matchLabels: + app: opentelemetry + component: otel-collector +--- apiVersion: admissionregistration.k8s.io/v1 kind: ValidatingWebhookConfiguration metadata: