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

Create ServiceMonitor for operator metrics programmatically #3371

Merged
merged 15 commits into from
Nov 8, 2024

Conversation

iblancasa
Copy link
Contributor

@iblancasa iblancasa self-assigned this Oct 18, 2024
@iblancasa iblancasa requested a review from a team as a code owner October 18, 2024 17:24
@IshwarKanse
Copy link
Contributor

@iblancasa I tested the PR with operator deployed in non-standard namespaces and enabling the in-cluster monitoring by adding label openshift.io/cluster-monitoring="true". The metrics are scraped by the in-cluster monitoring as well as the targets are shown up for the servicemonitors that are created.

We already have added test case to check the metrics exported by prometheus exporter and using the user workload monitoring stack. I'll add the operator monitoring as well to that test case and verify the metrics using the in-cluster monitoring stack.

@iblancasa
Copy link
Contributor Author

Thanks @IshwarKanse !

internal/operator-metrics/metrics.go Outdated Show resolved Hide resolved
tlsConfig = &monitoringv1.TLSConfig{
SafeTLSConfig: monitoringv1.SafeTLSConfig{
// kube-rbac-proxy uses a self-signed cert by default
InsecureSkipVerify: &t,
Copy link
Member

Choose a reason for hiding this comment

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

I think we talked about this internally as a bug that we should not be using the InsecureSkipVerify it is also not present here https://github.com/os-observability/konflux-opentelemetry/blob/main/bundle-patch/manifests/opentelemetry-operator-metrics-monitor_monitoring.coreos.com_v1_servicemonitor.yaml#L22

Copy link
Contributor Author

@iblancasa iblancasa Oct 28, 2024

Choose a reason for hiding this comment

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

If you review the code, you will see this will be only executed if the ConfigMap containing the CA doesn´t exist. This covers non-OpenShift scenarios.

main.go Outdated Show resolved Hide resolved
internal/operator-metrics/metrics.go Show resolved Hide resolved
@iblancasa
Copy link
Contributor Author

@pavolloffay anything else?

@pavolloffay pavolloffay merged commit 24ead74 into open-telemetry:main Nov 8, 2024
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a ServiceMonitor for the operator metrics endpoint
3 participants