Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ServiceMonitor should allow specifying custom labels so that prometheus-operator can discover them #742

Closed
AshutoshNirkhe opened this issue Nov 26, 2020 · 3 comments · Fixed by #757
Assignees
Labels
feature request A request for a specific feature to be added to Kuberhealthy good first issue Good for newcomers

Comments

@AshutoshNirkhe
Copy link
Contributor

AshutoshNirkhe commented Nov 26, 2020

Describe the feature you would like and why you want it
Currently ServiceMonitor template has fixed set of labels and doesn't allow specifying additional labels. If we allow specifying that, then existing prometheus-operator that are configured to discover ServiceMonitors based on some label will work fine. As of now, we have to disable ServiceMonitor template and deploy custom one with the matching label(which our prometheus-operator uses).

Additional context
Add any other context or screenshots about the feature request here.

additional_labels should be a map of additional labels, which can be inserted in template ar at runtime.

Something on these lines,

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  labels:
    app: {{ template "kuberhealthy.name" . }}
    prometheus: {{ .Values.prometheus.name }}
    release: {{ .Values.prometheus.release }}
    {{ .Values.prometheus.serviceMonitor.additional_labels }}
  name: {{ template "kuberhealthy.name" . }}
  namespace: {{ .Release.Namespace }}
@AshutoshNirkhe AshutoshNirkhe added the feature request A request for a specific feature to be added to Kuberhealthy label Nov 26, 2020
@integrii
Copy link
Collaborator

integrii commented Dec 2, 2020

Makes sense... It looks like we need an additional set of labels supplied here and then here on the Kuberhealthy service.

@integrii integrii added the good first issue Good for newcomers label Dec 2, 2020
@zjhans zjhans self-assigned this Dec 10, 2020
@zjhans zjhans linked a pull request Dec 10, 2020 that will close this issue
@AshutoshNirkhe
Copy link
Contributor Author

AshutoshNirkhe commented Jul 1, 2021

Sorry for bugging @joshulyne @integrii on this, but 'additionalLabels' key shouldn't be present in servicemonitor template. Its only required in values.yaml for input.

{{- if .Values.prometheus.additionalLabels}} 
additionalLabels: {{ .Values.prometheus.additionalLabels | nindent 6}} 
{{- end }}

should be updated to,

{{- if .Values.prometheus.additionalLabels}} 
{{ .Values.prometheus.additionalLabels | nindent 6}} 
{{- end }} 

@integrii integrii reopened this Jul 1, 2021
@zjhans
Copy link
Collaborator

zjhans commented Jul 15, 2021

This was already fixed in #962
Closing.

@zjhans zjhans closed this as completed Jul 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request A request for a specific feature to be added to Kuberhealthy good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants