diff --git a/deploy/helm/sumologic/templates/_helpers.tpl b/deploy/helm/sumologic/templates/_helpers.tpl index 9868cacbdc..5331e33426 100644 --- a/deploy/helm/sumologic/templates/_helpers.tpl +++ b/deploy/helm/sumologic/templates/_helpers.tpl @@ -675,7 +675,11 @@ sumologic.com/component: metrics {{- end -}} {{- define "sumologic.labels.events" -}} +{{- if eq .Values.sumologic.events.provider "fluentd" -}} sumologic.com/app: fluentd-events +{{- else -}} +sumologic.com/app: otelcol-events +{{- end }} sumologic.com/component: events {{- end -}} diff --git a/deploy/helm/sumologic/templates/events/otelcol/statefulset.yaml b/deploy/helm/sumologic/templates/events/otelcol/statefulset.yaml index 88be7a64a5..740611e400 100644 --- a/deploy/helm/sumologic/templates/events/otelcol/statefulset.yaml +++ b/deploy/helm/sumologic/templates/events/otelcol/statefulset.yaml @@ -25,6 +25,7 @@ spec: {{- end }} labels: app: {{ template "sumologic.labels.app.events.pod" . }} + {{- include "sumologic.labels.scrape.events" . | nindent 8 }} {{- include "sumologic.labels.common" . | nindent 8 }} {{- if .Values.sumologic.podLabels }} {{ toYaml .Values.sumologic.podLabels | indent 8 }} diff --git a/deploy/helm/sumologic/values.yaml b/deploy/helm/sumologic/values.yaml index 97e4248d39..6f5a753bfa 100644 --- a/deploy/helm/sumologic/values.yaml +++ b/deploy/helm/sumologic/values.yaml @@ -520,6 +520,18 @@ sumologic: matchLabels: sumologic.com/app: otelcol-logs-collector sumologic.com/scrape: "true" + - name: collection-sumologic-otelcol-events + additionalLabels: + sumologic.com/app: otelcol-events + endpoints: + - port: otelcol-metrics + namespaceSelector: + matchNames: + - $(NAMESPACE) + selector: + matchLabels: + sumologic.com/app: otelcol-events + sumologic.com/scrape: "true" - name: collection-sumologic-otelcol-traces additionalLabels: sumologic.com/app: otelcol diff --git a/tests/helm/events_otc_statefulset/static/annotations_labels.output.yaml b/tests/helm/events_otc_statefulset/static/annotations_labels.output.yaml index b36e1ae4a9..91d223dcfc 100644 --- a/tests/helm/events_otc_statefulset/static/annotations_labels.output.yaml +++ b/tests/helm/events_otc_statefulset/static/annotations_labels.output.yaml @@ -28,6 +28,8 @@ spec: release: "RELEASE-NAME" heritage: "Helm" sumoLabel: sumoValue + sumologic.com/app: otelcol-events + sumologic.com/component: events statefulsetLabel: statefulsetValue spec: serviceAccountName: RELEASE-NAME-sumologic diff --git a/tests/helm/events_otc_statefulset/static/basic.output.yaml b/tests/helm/events_otc_statefulset/static/basic.output.yaml index 81e01ecc0d..741b26c9df 100644 --- a/tests/helm/events_otc_statefulset/static/basic.output.yaml +++ b/tests/helm/events_otc_statefulset/static/basic.output.yaml @@ -27,6 +27,8 @@ spec: release: "RELEASE-NAME" heritage: "Helm" someLabel: someValue + sumologic.com/app: otelcol-events + sumologic.com/component: events spec: serviceAccountName: RELEASE-NAME-sumologic nodeSelector: diff --git a/tests/helm/kube-prometheus-stack/servicemonitors/basic-sumo.output.yaml b/tests/helm/kube-prometheus-stack/servicemonitors/basic-sumo.output.yaml index eb7ec1fd27..545ba75eb2 100644 --- a/tests/helm/kube-prometheus-stack/servicemonitors/basic-sumo.output.yaml +++ b/tests/helm/kube-prometheus-stack/servicemonitors/basic-sumo.output.yaml @@ -186,6 +186,32 @@ items: matchLabels: sumologic.com/app: otelcol-logs-collector sumologic.com/scrape: "true" + - apiVersion: monitoring.coreos.com/v1 + kind: ServiceMonitor + metadata: + name: collection-sumologic-otelcol-events + namespace: sumologic + labels: + app: sumologic-prometheus + + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/version: "%CURRENT_CHART_VERSION%" + app.kubernetes.io/part-of: sumologic + chart: sumologic-%CURRENT_CHART_VERSION% + release: "RELEASE-NAME" + heritage: "Helm" + sumologic.com/app: otelcol-events + spec: + endpoints: + - port: metrics + namespaceSelector: + matchNames: + - $(NAMESPACE) + selector: + matchLabels: + sumologic.com/app: otelcol-events + sumologic.com/scrape: "true" - apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: diff --git a/tests/helm/prometheus_test.go b/tests/helm/prometheus_test.go index be8a7b0ec6..94dd3e3699 100644 --- a/tests/helm/prometheus_test.go +++ b/tests/helm/prometheus_test.go @@ -46,6 +46,7 @@ kube-prometheus-stack: "collection-sumologic-fluentd-events", "collection-fluent-bit", "collection-sumologic-otelcol-logs-collector", + "collection-sumologic-otelcol-events", "collection-sumologic-otelcol-traces", "collection-sumologic-prometheus", "collection-sumologic-fluentd-logs-test", @@ -80,7 +81,7 @@ sumologic: TemplatePaths: allTemplatePaths, }, { - Name: "default", + Name: "default", ValuesYaml: "", ExpectedNames: []string{ "collection-sumologic-fluentd-logs", @@ -90,6 +91,7 @@ sumologic: "collection-sumologic-fluentd-events", "collection-fluent-bit", "collection-sumologic-otelcol-logs-collector", + "collection-sumologic-otelcol-events", "collection-sumologic-otelcol-traces", "collection-sumologic-prometheus", },