blob: c56aa1dda27ca44f2d417917a298475ab43f3160 [file] [log] [blame]
# Copyright 2022-present Open Networking Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
{{- if and .Values.global.redis.cluster.enabled (not .Values.global.redis.sentinel.enabled) }}
apiVersion: v1
kind: Service
metadata:
name: {{ template "redis.fullname" . }}-slave
namespace: {{ .Release.Namespace | quote }}
labels:
app: {{ template "redis.name" . }}
chart: {{ template "redis.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if .Values.slave.service.labels -}}
{{- toYaml .Values.slave.service.labels | nindent 4 }}
{{- end -}}
{{- if .Values.slave.service.annotations }}
annotations: {{- toYaml .Values.slave.service.annotations | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.slave.service.type }}
{{ if eq .Values.slave.service.type "LoadBalancer" }}
externalTrafficPolicy: {{ .Values.slave.service.externalTrafficPolicy }}
{{- end }}
{{- if and (eq .Values.slave.service.type "LoadBalancer") .Values.slave.service.loadBalancerIP }}
loadBalancerIP: {{ .Values.slave.service.loadBalancerIP }}
{{- end }}
{{- if and (eq .Values.slave.service.type "LoadBalancer") .Values.slave.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{- with .Values.slave.service.loadBalancerSourceRanges }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
ports:
- name: redis
port: {{ .Values.slave.service.port }}
targetPort: redis
{{- if .Values.slave.service.nodePort }}
nodePort: {{ .Values.slave.service.nodePort }}
{{- end }}
selector:
app: {{ template "redis.name" . }}
release: {{ .Release.Name }}
role: slave
{{- end }}