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 configuration is confusing in Helm chart #7913

Open
darnone opened this issue Mar 12, 2025 · 0 comments
Open

ServiceMonitor configuration is confusing in Helm chart #7913

darnone opened this issue Mar 12, 2025 · 0 comments
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@darnone
Copy link

darnone commented Mar 12, 2025

Which component are you using?:

Cluster-autoscaler Helm chart

What version of the component are you using?
App 1.32.0, chart 9.46.3:

Component version: chart 9.46.3

What k8s version are you using (kubectl version)?: 1.30.9

kubectl version Output
$ kubectl version

What environment is this in?:
AWS EKS

What did you expect to happen?:

Proper coordinfination of labels in service monitor

What happened instead?:

The service monitor template uses the following for metadata.labels:

{{- range $key, $value := .Values.serviceMonitor.selector }}
    {{ $key }}: {{ $value | quote }}
{{- end }}

which are set in the helm chart values. However, the match labels uses:

selector:
    matchLabels:
{{ include "cluster-autoscaler.instance-name" . | indent 6 }}

Which comes from the _helper.tpl and is defined as:

{{- define "cluster-autoscaler.instance-name" -}}
app.kubernetes.io/instance: {{ .Release.Name | quote }}
app.kubernetes.io/name: {{ include "cluster-autoscaler.name" . | quote }}
{{- end -}}

and in addition name is prepended:

{{- define "cluster-autoscaler.name" -}}
{{- default (printf "%s-%s" .Values.cloudProvider .Chart.Name) .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

This requires the user:

  • to know the instance name
  • to understand the match labels have 2 parameters
  • to understand the cloud provider is prepended with the cloud provide name

How to reproduce it (as minimally and precisely as possible):

add following to chart values:

serviceMonitor:
  enabled: "true"
  interval: 10s
  namespace: monitoring
  selector:
    release: kube-prometheus-stack
    app.kubernetes.io/instance: "cluster-autoscaler"
    app.kubernetes.io/name: "aws-cluster-autoscaler"
  path: /metrics

Anything else we need to know?:

this is confusing

@darnone darnone added the kind/bug Categorizes issue or PR as related to a bug. label Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

1 participant