redhat-cop / redhat-cop/group-sync-operator

ServiceMonitor's serverName is wrong when not in the default namespace

Open
#199 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
132
Forks
71
PR merge metrics
No merged PRs in 30d

Description

Hi,

when you've deployed the operator through the operatorhub on openshift 4.10 in a different namespace than 'group-sync-operator'
prometheus gets a tls error when trying to scrape for metrics.

that is because the servicemonitor get the wrong serverName :

❯ oc -n my-namespace get servicemonitor group-sync-operator-controller-manager-metrics-monitor -o yaml | kubectl-neat
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
control-plane: controller-manager
name: group-sync-operator-controller-manager-metrics-monitor
namespace: my-namespace
spec:
endpoints:

  • bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
    interval: 30s
    port: https
    scheme: https
    tlsConfig:
    caFile: /etc/prometheus/configmaps/serving-certs-ca-bundle/service-ca.crt
    serverName: group-sync-operator-controller-manager-metrics-service.group-sync-operator.svc
    selector:
    matchLabels:
    control-plane: controller-manager

seems that the namespace part of the serverName is hardcoded don't you think ?

regards

Ludovic

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the ServiceMonitor generation that produces group-sync-operator-controller-manager-metrics-monitor and compare it with the YAML shown here. Trace where the serverName namespace is selected; done means it uses the deployed namespace instead of group-sync-operator and Prometheus can scrape the metrics endpoint without a TLS error.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes, prometheus
Domain
observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.