sloth
sloth copied to clipboard
Add extra labels to prometheusRule object
Why?
In our case, PrometheusRule requires labels to be picked up.
Disclaimer
I think I did it right? It works (tested on my clusters), but Golang development is a hobby for me xD I'm a system administrator. Let me know if you want me to change something
Hi @Typositoire
The Kubernetes CR labels will be set on the resulting generated Prometheus operator CRs automatically. E.g:
apiVersion: sloth.slok.dev/v1
kind: PrometheusServiceLevel
metadata:
name: test
labels:
prometheus: custom-prometheus-instance
->
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
labels:
app.kubernetes.io/component: SLO
app.kubernetes.io/managed-by: sloth
prometheus: custom-prometheus-instance
name: test
The resulting generated k8s resources will have prometheus: custom-prometheus-instance
.
Can this be merged?
Doesn't this work for you? https://github.com/slok/sloth/pull/315#issuecomment-1159643273
Works!
Closing so people don't get confused that without this PR, can't be achieved the extra-labels on generated prometheus-operator rules. Use https://github.com/slok/sloth/pull/315#issuecomment-1159643273
Thanks @Typositoire!