bitpoke / mysql-operator

Asynchronous MySQL Replication on Kubernetes using Percona Server and Openark's Orchestrator.
https://www.bitpoke.io/docs/mysql-operator/getting-started/
Apache License 2.0
1.03k stars 276 forks source link

Labels for mysql-nodes service #370

Closed smanpathak closed 4 years ago

smanpathak commented 5 years ago

We are trying to use prometheus-operator to scrape mysql metrics for myql instances. Prometheus operator uses a custom resource called ServiceMonitor to link application metrics to a prometheus instance. It identifies the applications to scrape by using label selectors like a service object. To discover mysql instances with prometheus operator, the nodes service need to have labels on it. Can the operator apply some labels like app=mysql-operator and mysql_cluster=? That should be sufficient.

AMecea commented 5 years ago

Hi @smanpathak! In the latest version of the operator(v0.3.1), it adds labels on services. This is the list of labels on all cluster objects:

        "mysql.presslabs.org/cluster": <cluster name>,
        "app.kubernetes.io/name":       "mysql",
        "app.kubernetes.io/instance":   <cluster name>,
        "app.kubernetes.io/version":    <mysql version>,
        "app.kubernetes.io/component":  "database",
        "app.kubernetes.io/managed-by": "mysql.presslabs.org",

We can backport this feature in version 0.2.x, if you need it.

smanpathak commented 5 years ago

@AMecea v0.3.1 should work for us.

Thanks,