| # 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 not .Values.global.redis.sentinel.enabled }} |
| apiVersion: v1 |
| kind: Service |
| metadata: |
| name: {{ template "redis.fullname" . }} |
| namespace: {{ .Release.Namespace | quote }} |
| labels: |
| app: {{ template "redis.name" . }} |
| chart: {{ template "redis.chart" . }} |
| release: {{ .Release.Name }} |
| heritage: {{ .Release.Service }} |
| {{- if .Values.master.service.labels -}} |
| {{- toYaml .Values.master.service.labels | nindent 4 }} |
| {{- end -}} |
| {{- if .Values.master.service.annotations }} |
| annotations: {{- toYaml .Values.master.service.annotations | nindent 4 }} |
| {{- end }} |
| spec: |
| type: {{ .Values.master.service.type }} |
| {{ if eq .Values.master.service.type "LoadBalancer" }} |
| externalTrafficPolicy: {{ .Values.master.service.externalTrafficPolicy }} |
| {{- end }} |
| {{- if and (eq .Values.master.service.type "LoadBalancer") .Values.master.service.loadBalancerIP }} |
| loadBalancerIP: {{ .Values.master.service.loadBalancerIP }} |
| {{- end }} |
| {{- if and (eq .Values.master.service.type "LoadBalancer") .Values.master.service.loadBalancerSourceRanges }} |
| loadBalancerSourceRanges: |
| {{- with .Values.master.service.loadBalancerSourceRanges }} |
| {{- toYaml . | nindent 4 }} |
| {{- end }} |
| {{- end }} |
| ports: |
| - name: redis |
| port: {{ .Values.master.service.port }} |
| targetPort: redis |
| {{- if .Values.master.service.nodePort }} |
| nodePort: {{ .Values.master.service.nodePort }} |
| {{- end }} |
| selector: |
| app: {{ template "redis.name" . }} |
| release: {{ .Release.Name }} |
| role: master |
| {{- end }} |