appsody / appsody-operator

An Operator for deploying Appsody based applications to Kubernetes. This repo will be archived soon.
Apache License 2.0
18 stars 15 forks source link

Created ServiceMonitor has incorrect matchLabel #182

Closed seabaylea closed 4 years ago

seabaylea commented 4 years ago

Bug Report

What did you do?

When deploying an Appsody Application that enables monitoring, the operator adds the following label onto the Application service:

app.appsody.dev/monitor: "true"

It then creates a ServiceMonitor with the following matchLabel:

app.appsody.dev/monitor:  true

The mismatch of the use of quotes around true means that the Service Monitor doesn't pick up the Appsody Application.

What did you expect to see?

Monitoring data in Prometheus

What did you see instead?

No monitoring data in Prometheus

Environment

appsody 0.4.10
java-microprofile

Possible solution

Additional context

Add any other context about the problem here.

arturdzm commented 4 years ago

I just tested 0.2.2 and I see this on my 4.2 cluster in ServiceMonitor Perhaps your issues with the spec.monitoring.labels not matching the Prometheus's CR serviceMonitorSelector

  selector:
    matchLabels:
      app.appsody.dev/monitor: 'true'
      app.kubernetes.io/name: example-appsodyapplication

Having no quotes would be a bool and illegal as the MatchLabels type is map[string]string https://github.com/appsody/appsody-operator/blob/d035516488c2019108ea260cfb94b05e6a160827/pkg/utils/utils.go#L384

arthurdm commented 4 years ago

Perhaps we can close this issue, if it's not a bug?

arturdzm commented 4 years ago

Afaik it works on 0.4.x I've recently had to use monitoring