Add optional service replica selector (#19398)

When using a replicaset for the server (for redundancy purposes),
this allows to select which replica the service will talk to in
order to have a consistent view of the data.

Signed-off-by: rabadin <rvbadin@gmail.com>
This commit is contained in:
Raphaël
2019-12-18 08:21:57 -08:00
committed by Kubernetes Prow Robot
parent f13d9649ab
commit a494c6bb4a
4 changed files with 14 additions and 1 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
apiVersion: v1
name: prometheus
version: 9.5.5
version: 9.5.6
appVersion: 2.13.1
description: Prometheus is a monitoring system and time series database.
home: https://prometheus.io/
+2
View File
@@ -313,6 +313,8 @@ Parameter | Description | Default
`server.service.servicePort` | Prometheus server service port | `80`
`server.service.sessionAffinity` | Session Affinity for server service, can be `None` or `ClientIP` | `None`
`server.service.type` | type of Prometheus server service to create | `ClusterIP`
`server.service.statefulsetReplica.enabled` | If true, send the traffic from the service to only one replica of the replicaset | `false`
`server.service.statefulsetReplica.replica` | Which replica to send the traffice to | `0`
`server.sidecarContainers` | array of snippets with your sidecar containers for prometheus server | `""`
`serviceAccounts.alertmanager.create` | If true, create the alertmanager service account | `true`
`serviceAccounts.alertmanager.name` | name of the alertmanager service account to use or create | `{{ prometheus.alertmanager.fullname }}`
@@ -38,9 +38,13 @@ spec:
nodePort: {{ .Values.server.service.nodePort }}
{{- end }}
selector:
{{- if and .Values.server.statefulSet.enabled .Values.server.service.statefulsetReplica.enabled }}
statefulset.kubernetes.io/pod-name: {{ .Release.Name }}-{{ .Values.server.name }}-{{ .Values.server.service.statefulsetReplica.replica }}
{{- else -}}
{{- include "prometheus.server.matchLabels" . | nindent 4 }}
{{- if .Values.server.service.sessionAffinity }}
sessionAffinity: {{ .Values.server.service.sessionAffinity }}
{{- end }}
{{- end }}
type: "{{ .Values.server.service.type }}"
{{- end -}}
+7
View File
@@ -858,6 +858,13 @@ server:
sessionAffinity: None
type: ClusterIP
## If using a statefulSet (statefulSet.enabled=true), configure the
## service to connect to a specific replica to have a consistent view
## of the data.
statefulsetReplica:
enabled: false
replica: 0
## Prometheus server pod termination grace period
##
terminationGracePeriodSeconds: 300