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

ServiceMonitor is created with invalid serverName value #33

Open
X-dark opened this issue Jul 20, 2022 · 6 comments
Open

ServiceMonitor is created with invalid serverName value #33

X-dark opened this issue Jul 20, 2022 · 6 comments

Comments

@X-dark
Copy link

X-dark commented Jul 20, 2022

Hi,

I have installed patch-operator version 0.1.4 through OperatorHub in a namespace named scale-patch-operator.

I can see that the serverName in the serviceMonitor is created with an invalid namespace name:

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  resourceVersion: '57137052'
  name: patch-operator-controller-manager-metrics-monitor
[...]
  namespace: scale-patch-operator
  ownerReferences:
    - apiVersion: operators.coreos.com/v1alpha1
      blockOwnerDeletion: false
      controller: false
      kind: ClusterServiceVersion
      name: patch-operator.v0.1.4
      uid: 31655a3d-0f41-4612-a0a0-428236ffa20f
[...]
spec:
  endpoints:
    - bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
[...]
      tlsConfig:
        ca:
[...]
        serverName: patch-operator-controller-manager-metrics-service.patch-operator.svc
[...]

I would expect to see patch-operator-controller-manager-metrics-service.scale-patch-operator.svc there.

Looking at the code I do not understand the root cause as I see the value should come from METRICS_SERVICE_NAMESPACE variable:

serverName: $(METRICS_SERVICE_NAME).$(METRICS_SERVICE_NAMESPACE).svc
which is initialized at metadata.namespace value:
fieldpath: metadata.namespace
.

Or am I looking at the wrong location?

@raffaelespazzoli
Copy link
Collaborator

raffaelespazzoli commented Jul 20, 2022 via email

@X-dark
Copy link
Author

X-dark commented Jul 20, 2022

OK, understood. Is this already tracked in another issue?

@raffaelespazzoli
Copy link
Collaborator

@davgordo where are we tracking this?

@donflavour
Copy link

@raffaelespazzoli any updates or workaround on this? What is the recommended namespace?

@raffaelespazzoli
Copy link
Collaborator

the only namespace that works when installing via OLM is patch-operator. If you want to sue another namespace, you can use the helm chart.

@davgordo
Copy link
Contributor

@davgordo where are we tracking this?

We discussed in depth and determined that the path forward would be to move the service monitor configuration out of the operator manifest and use the operator to create a service monitor instead.
redhat-cop/operator-utils#86

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

No branches or pull requests

4 participants