patch-operator
patch-operator copied to clipboard
ServiceMonitor is created with invalid serverName value
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: https://github.com/redhat-cop/patch-operator/blob/2766ff49f382fd81a53f557a1461bb28d410d642/config/prometheus/monitor.yaml#L22 which is initialized at metadata.namespace value: https://github.com/redhat-cop/patch-operator/blob/9ee4218d96ccc0e383eba7fc9a17fec7245712e8/config/default/kustomization.yaml#L59.
Or am I looking at the wrong location?
if you are installing with OLM, you need to install in the recommended namespace or else you incur in this problem. This is an OLM problem and so far at least we have not found a solution to it.
On Wed, Jul 20, 2022 at 5:30 AM Cedric Girard @.***> wrote:
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/v1kind: ServiceMonitormetadata: 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: https://github.com/redhat-cop/patch-operator/blob/2766ff49f382fd81a53f557a1461bb28d410d642/config/prometheus/monitor.yaml#L22 which is initialized at metadata.namespace value: https://github.com/redhat-cop/patch-operator/blob/9ee4218d96ccc0e383eba7fc9a17fec7245712e8/config/default/kustomization.yaml#L59 .
Or am I looking at the wrong location?
— Reply to this email directly, view it on GitHub https://github.com/redhat-cop/patch-operator/issues/33, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPERXBDNAWVP45PIP4NWGLVU7BKVANCNFSM54C5KTOA . You are receiving this because you are subscribed to this thread.Message ID: @.***>
-- ciao/bye Raffaele
OK, understood. Is this already tracked in another issue?
@davgordo where are we tracking this?
@raffaelespazzoli any updates or workaround on this? What is the recommended namespace?
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 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. https://github.com/redhat-cop/operator-utils/issues/86