Skip to content

Commit

Permalink
[kube-prometheus-stack] Allow changing port name of built-in ServiceM…
Browse files Browse the repository at this point in the history
…onitors (#4317)
  • Loading branch information
iandrewt authored Feb 29, 2024
1 parent d452d20 commit 4a88ecb
Show file tree
Hide file tree
Showing 17 changed files with 36 additions and 15 deletions.
2 changes: 1 addition & 1 deletion charts/kube-prometheus-stack/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ name: kube-prometheus-stack
sources:
- https://github.com/prometheus-community/helm-charts
- https://github.com/prometheus-operator/kube-prometheus
version: 56.15.0
version: 56.16.0
appVersion: v0.71.2
kubeVersion: ">=1.19.0-0"
home: https://github.com/prometheus-operator/kube-prometheus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ coreDns:
service:
enabled: false
serviceMonitor:
port: metrics
selector:
matchLabels:
k8s-app: '{{ $.Release.Name }}'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ metadata:
spec:
clusterIP: None
ports:
- name: http-metrics
- name: {{ .Values.coreDns.serviceMonitor.port }}
port: {{ .Values.coreDns.service.port }}
protocol: TCP
targetPort: {{ .Values.coreDns.service.targetPort }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
matchNames:
- "kube-system"
endpoints:
- port: http-metrics
- port: {{ .Values.coreDns.serviceMonitor.port }}
{{- if .Values.coreDns.serviceMonitor.interval}}
interval: {{ .Values.coreDns.serviceMonitor.interval }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ subsets:
- ip: {{ . }}
{{- end }}
ports:
- name: http-metrics
- name: {{ .Values.kubeControllerManager.serviceMonitor.port }}
{{- $kubeControllerManagerDefaultInsecurePort := 10252 }}
{{- $kubeControllerManagerDefaultSecurePort := 10257 }}
port: {{ include "kube-prometheus-stack.kubeControllerManager.insecureScrape" (list . $kubeControllerManagerDefaultInsecurePort $kubeControllerManagerDefaultSecurePort .Values.kubeControllerManager.service.port) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ metadata:
spec:
clusterIP: None
ports:
- name: http-metrics
- name: {{ .Values.kubeControllerManager.serviceMonitor.port }}
{{- $kubeControllerManagerDefaultInsecurePort := 10252 }}
{{- $kubeControllerManagerDefaultSecurePort := 10257 }}
port: {{ include "kube-prometheus-stack.kubeControllerManager.insecureScrape" (list . $kubeControllerManagerDefaultInsecurePort $kubeControllerManagerDefaultSecurePort .Values.kubeControllerManager.service.port) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
matchNames:
- "kube-system"
endpoints:
- port: http-metrics
- port: {{ .Values.kubeControllerManager.serviceMonitor.port }}
{{- if .Values.kubeControllerManager.serviceMonitor.interval }}
interval: {{ .Values.kubeControllerManager.serviceMonitor.interval }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ subsets:
- ip: {{ . }}
{{- end }}
ports:
- name: http-metrics
- name: {{ .Values.kubeEtcd.serviceMonitor.port }}
port: {{ .Values.kubeEtcd.service.port }}
protocol: TCP
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ metadata:
spec:
clusterIP: None
ports:
- name: http-metrics
- name: {{ .Values.kubeEtcd.serviceMonitor.port }}
port: {{ .Values.kubeEtcd.service.port }}
protocol: TCP
targetPort: {{ .Values.kubeEtcd.service.targetPort }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
matchNames:
- "kube-system"
endpoints:
- port: http-metrics
- port: {{ .Values.kubeEtcd.serviceMonitor.port }}
{{- if .Values.kubeEtcd.serviceMonitor.interval }}
interval: {{ .Values.kubeEtcd.serviceMonitor.interval }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ subsets:
- ip: {{ . }}
{{- end }}
ports:
- name: http-metrics
- name: {{ .Values.kubeProxy.serviceMonitor.port }}
port: {{ .Values.kubeProxy.service.port }}
protocol: TCP
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ metadata:
spec:
clusterIP: None
ports:
- name: http-metrics
- name: {{ .Values.kubeProxy.serviceMonitor.port }}
port: {{ .Values.kubeProxy.service.port }}
protocol: TCP
targetPort: {{ .Values.kubeProxy.service.targetPort }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
matchNames:
- "kube-system"
endpoints:
- port: http-metrics
- port: {{ .Values.kubeProxy.serviceMonitor.port }}
{{- if .Values.kubeProxy.serviceMonitor.interval }}
interval: {{ .Values.kubeProxy.serviceMonitor.interval }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ subsets:
- ip: {{ . }}
{{- end }}
ports:
- name: http-metrics
- name: {{ .Values.kubeScheduler.serviceMonitor.port }}
{{- $kubeSchedulerDefaultInsecurePort := 10251 }}
{{- $kubeSchedulerDefaultSecurePort := 10259 }}
port: {{ include "kube-prometheus-stack.kubeScheduler.insecureScrape" (list . $kubeSchedulerDefaultInsecurePort $kubeSchedulerDefaultSecurePort .Values.kubeScheduler.service.port) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ metadata:
spec:
clusterIP: None
ports:
- name: http-metrics
- name: {{ .Values.kubeScheduler.serviceMonitor.port }}
{{- $kubeSchedulerDefaultInsecurePort := 10251 }}
{{- $kubeSchedulerDefaultSecurePort := 10259 }}
port: {{ include "kube-prometheus-stack.kubeScheduler.insecureScrape" (list . $kubeSchedulerDefaultInsecurePort $kubeSchedulerDefaultSecurePort .Values.kubeScheduler.service.port) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
matchNames:
- "kube-system"
endpoints:
- port: http-metrics
- port: {{ .Values.kubeScheduler.serviceMonitor.port }}
{{- if .Values.kubeScheduler.serviceMonitor.interval }}
interval: {{ .Values.kubeScheduler.serviceMonitor.interval }}
{{- end }}
Expand Down
20 changes: 20 additions & 0 deletions charts/kube-prometheus-stack/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1486,6 +1486,10 @@ kubeControllerManager:
##
proxyUrl: ""

## port: Name of the port the metrics will be scraped from
##
port: http-metrics

jobLabel: jobLabel
selector: {}
# matchLabels:
Expand Down Expand Up @@ -1567,6 +1571,10 @@ coreDns:
##
proxyUrl: ""

## port: Name of the port the metrics will be scraped from
##
port: http-metrics

jobLabel: jobLabel
selector: {}
# matchLabels:
Expand Down Expand Up @@ -1754,6 +1762,10 @@ kubeEtcd:
certFile: ""
keyFile: ""

## port: Name of the port the metrics will be scraped from
##
port: http-metrics

jobLabel: jobLabel
selector: {}
# matchLabels:
Expand Down Expand Up @@ -1842,6 +1854,10 @@ kubeScheduler:
##
https: null

## port: Name of the port the metrics will be scraped from
##
port: http-metrics

jobLabel: jobLabel
selector: {}
# matchLabels:
Expand Down Expand Up @@ -1926,6 +1942,10 @@ kubeProxy:
##
proxyUrl: ""

## port: Name of the port the metrics will be scraped from
##
port: http-metrics

jobLabel: jobLabel
selector: {}
# matchLabels:
Expand Down

0 comments on commit 4a88ecb

Please sign in to comment.