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

[kube-prometheus-stack] add serviceName option to prometheus CR #5273

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions charts/kube-prometheus-stack/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ name: kube-prometheus-stack
sources:
- https://github.com/prometheus-community/helm-charts
- https://github.com/prometheus-operator/kube-prometheus
version: 68.4.5
appVersion: v0.79.2
version: 68.5.0
appVersion: v0.80.0
kubeVersion: ">=1.19.0-0"
home: https://github.com/prometheus-operator/kube-prometheus
keywords:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5544,6 +5544,10 @@ spec:
type: string
type: object
type: object
serviceName:
description: |-
serviceName is optional: name of the service used by the underlying StatefulSet(s) as the governing service.
type: string
serviceAccountName:
description: |-
ServiceAccountName is the name of the ServiceAccount to use to run the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7141,6 +7141,10 @@ spec:
type: string
type: object
type: object
serviceName:
description: |-
serviceName is optional: name of the service used by the underlying StatefulSet(s) as the governing service.
type: string
serviceAccountName:
description: |-
ServiceAccountName is the name of the ServiceAccount to use to run the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8849,6 +8849,10 @@ spec:
type: string
type: object
type: object
serviceName:
description: |-
serviceName is optional: name of the service used by the underlying StatefulSet(s) as the governing service.
type: string
serviceAccountName:
description: |-
ServiceAccountName is the name of the ServiceAccount to use to run the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4937,6 +4937,10 @@ spec:
type: string
type: object
type: object
serviceName:
description: |-
serviceName is optional: name of the service used by the underlying StatefulSet(s) as the governing service.
type: string
serviceAccountName:
description: |-
ServiceAccountName is the name of the ServiceAccount to use to run the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ spec:
{{- end }}
replicas: {{ .Values.alertmanager.alertmanagerSpec.replicas }}
listenLocal: {{ .Values.alertmanager.alertmanagerSpec.listenLocal }}
{{- if .Values.alertmanager.alertmanagerSpec.serviceName }}
serviceName: {{ .Values.alertmanager.alertmanagerSpec.serviceName }}
{{- end }}
serviceAccountName: {{ template "kube-prometheus-stack.alertmanager.serviceAccountName" . }}
automountServiceAccountToken: {{ .Values.alertmanager.alertmanagerSpec.automountServiceAccountToken }}
{{- if .Values.alertmanager.alertmanagerSpec.externalUrl }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }}
{{- if .Values.alertmanager.enabled }}
{{- if and .Values.alertmanager.enabled .Values.alertmanager.service.enabled }}
apiVersion: v1
kind: Service
metadata:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ data:
- name: "{{ $.Values.grafana.sidecar.datasources.name }}-{{ . }}"
type: prometheus
uid: {{ $.Values.grafana.sidecar.datasources.uid }}-replica-{{ . }}
url: http://prometheus-{{ template "kube-prometheus-stack.prometheus.crname" $ }}-{{ . }}.prometheus-operated:9090/{{ trimPrefix "/" $.Values.prometheus.prometheusSpec.routePrefix }}
url: http://prometheus-{{ template "kube-prometheus-stack.prometheus.crname" $ }}-{{ . }}.{{ $.Values.grafana.sidecar.datasources.prometheusServiceName}}:9090/{{ trimPrefix "/" $.Values.prometheus.prometheusSpec.routePrefix }}
access: proxy
isDefault: false
jsonData:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ spec:
{{- if .Values.prometheus.prometheusSpec.configMaps }}
configMaps:
{{ toYaml .Values.prometheus.prometheusSpec.configMaps | indent 4 }}
{{- end }}
{{- if .Values.prometheus.prometheusSpec.serviceName }}
serviceName: {{.Values.prometheus.prometheusSpec.serviceName }}
{{- end }}
serviceAccountName: {{ template "kube-prometheus-stack.prometheus.serviceAccountName" . }}
{{- if .Values.prometheus.prometheusSpec.serviceMonitorSelector }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }}
{{- if .Values.prometheus.enabled }}
{{- if and .Values.prometheus.enabled .Values.prometheus.service.enabled }}
apiVersion: v1
kind: Service
metadata:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ spec:
{{- end }}
replicas: {{ .Values.thanosRuler.thanosRulerSpec.replicas }}
listenLocal: {{ .Values.thanosRuler.thanosRulerSpec.listenLocal }}
{{- if .Values.thanosRuler.thanosRulerSpec.serviceName }}
serviceName: {{.Values.thanosRuler.thanosRulerSpec.serviceName }}
{{- end }}
serviceAccountName: {{ template "kube-prometheus-stack.thanosRuler.serviceAccountName" . }}
{{- if .Values.thanosRuler.thanosRulerSpec.externalPrefix }}
externalPrefix: "{{ tpl .Values.thanosRuler.thanosRulerSpec.externalPrefix . }}"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.thanosRuler.enabled }}
{{- if and .Values.thanosRuler.enabled .Values.thanosRuler.service.enabled }}
apiVersion: v1
kind: Service
metadata:
Expand Down
18 changes: 16 additions & 2 deletions charts/kube-prometheus-stack/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,7 @@ alertmanager:
## Configuration for Alertmanager service
##
service:
enabled: true
annotations: {}
labels: {}
clusterIP: ""
Expand Down Expand Up @@ -823,6 +824,9 @@ alertmanager:
##
podMetadata: {}

##
serviceName:

## Image of Alertmanager
##
image:
Expand Down Expand Up @@ -1259,10 +1263,12 @@ grafana:
httpMethod: POST

## Create datasource for each Pod of Prometheus StatefulSet;
## this uses headless service `prometheus-operated` which is
## created by Prometheus Operator
## this uses by default the headless service `prometheus-operated` which is
## created by Prometheus Operator. In case you deployed your own Service for your
## Prometheus instance, you can specifiy it with the field `prometheusServiceName`
## ref: https://github.com/prometheus-operator/prometheus-operator/blob/0fee93e12dc7c2ea1218f19ae25ec6b893460590/pkg/prometheus/statefulset.go#L255-L286
createPrometheusReplicasDatasources: false
prometheusServiceName: prometheus-operated
label: grafana_datasource
labelValue: "1"

Expand Down Expand Up @@ -3359,6 +3365,7 @@ prometheus:
## Configuration for Prometheus service
##
service:
enabled: true
annotations: {}
labels: {}
clusterIP: ""
Expand Down Expand Up @@ -3801,6 +3808,9 @@ prometheus:
enableFeatures: []
# - exemplar-storage

##
serviceName:

## Image of Prometheus.
##
image:
Expand Down Expand Up @@ -4748,6 +4758,7 @@ thanosRuler:
## Configuration for ThanosRuler service
##
service:
enabled: true
annotations: {}
labels: {}
clusterIP: ""
Expand Down Expand Up @@ -4867,6 +4878,9 @@ thanosRuler:
##
podMetadata: {}

##
serviceName:

## Image of ThanosRuler
##
image:
Expand Down