Description
Bug Report
What did you do?
When deploying a ServiceMonitor object the serverName field should be updated to reflect the namespace in which the operator in begin deployed.
What did you expect to see?
so foir exmaple if this is the ServiceMonitor in the bundle:
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
operator: volume-expander-operator
name: volume-expander-operator-controller-manager-metrics-monitor
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: volume-expander-operator-controller-manager-metrics.volume-expander-operator.svc
selector:
matchLabels:
operator: volume-expander-operator
and the operator is being deployed to the aaabbb
namespace then OLM should change this to be
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
operator: volume-expander-operator
name: volume-expander-operator-controller-manager-metrics-monitor
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: volume-expander-operator-controller-manager-metrics.aaabbb.svc
selector:
matchLabels:
operator: volume-expander-operator
**What did you see instead? Under which circumstances?**
A clear and concise description of what you expected to happen (or insert a code snippet).
**Environment**
* operator-lifecycle-manager version:
quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:4b14ffcea52f9eb5952546634cb26bfb1d523a4dd81382021c71673fed91efa2
* Kubernetes version information:
kubectl version
Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.0", GitCommit:"cb303e613a121a29364f75cc67d3d580833a7479", GitTreeState:"archive", BuildDate:"2021-07-22T00:00:00Z", GoVersion:"go1.16.6", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.3+e790d7f", GitCommit:"3a0f2c90b43e6cffd07f57b5b78dd9f083e47ee2", GitTreeState:"clean", BuildDate:"2021-12-14T02:10:38Z", GoVersion:"go1.16.6", Compiler:"gc", Platform:"linux/amd64"}
- Kubernetes cluster kind:
OCP 4.9
Possible Solution
OLM should scan and fix that field, or even better just support deploying via an helm chart and let the operator packager worry about these kinds of things.
Additional context
Add any other context about the problem here.