2019-01-30 21:23:17 +08:00
|
|
|
{{- $fullName := include "redis-ha.fullname" . }}
|
2020-05-28 21:06:43 +08:00
|
|
|
{{- $namespace := .Release.Namespace -}}
|
|
|
|
{{- $replicas := int (toString .Values.replicas) }}
|
2019-01-30 21:23:17 +08:00
|
|
|
{{- $root := . }}
|
|
|
|
{{- range $i := until $replicas }}
|
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
|
|
kind: Service
|
|
|
|
metadata:
|
|
|
|
name: {{ $fullName }}-announce-{{ $i }}
|
2020-05-28 21:06:43 +08:00
|
|
|
namespace: {{ $namespace }}
|
2019-01-30 21:23:17 +08:00
|
|
|
labels:
|
|
|
|
{{ include "labels.standard" $root | indent 4 }}
|
|
|
|
annotations:
|
|
|
|
service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
|
|
|
|
{{- if $root.Values.serviceAnnotations }}
|
|
|
|
{{ toYaml $root.Values.serviceAnnotations | indent 4 }}
|
|
|
|
{{- end }}
|
|
|
|
spec:
|
|
|
|
publishNotReadyAddresses: true
|
|
|
|
type: ClusterIP
|
|
|
|
ports:
|
|
|
|
- name: server
|
|
|
|
port: {{ $root.Values.redis.port }}
|
|
|
|
protocol: TCP
|
|
|
|
targetPort: redis
|
|
|
|
- name: sentinel
|
|
|
|
port: {{ $root.Values.sentinel.port }}
|
|
|
|
protocol: TCP
|
|
|
|
targetPort: sentinel
|
2020-05-28 21:06:43 +08:00
|
|
|
{{- if $root.Values.exporter.enabled }}
|
|
|
|
- name: exporter
|
|
|
|
port: {{ $root.Values.exporter.port }}
|
|
|
|
protocol: TCP
|
|
|
|
targetPort: exporter-port
|
|
|
|
{{- end }}
|
2019-01-30 21:23:17 +08:00
|
|
|
selector:
|
|
|
|
release: {{ $root.Release.Name }}
|
|
|
|
app: {{ include "redis-ha.name" $root }}
|
|
|
|
"statefulset.kubernetes.io/pod-name": {{ $fullName }}-server-{{ $i }}
|
|
|
|
{{- end }}
|