apiVersion: v1 kind: Service metadata: {{- if .Values.service.annotations }} annotations: {{ toYaml .Values.service.annotations | indent 4 }} {{- end }} labels: app: {{ template "nginx.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version }} heritage: {{ .Release.Service }} release: {{ .Release.Name }} name: {{ template "nginx.fullname" . }} spec: # Provides options for the service so chart users have the full choice type: "{{ .Values.service.type }}" clusterIP: "{{ .Values.service.clusterIP }}" {{- if .Values.service.externalIPs }} externalIPs: {{ toYaml .Values.service.externalIPs | indent 4 }} {{- end }} {{- if .Values.service.loadBalancerIP }} loadBalancerIP: "{{ .Values.service.loadBalancerIP }}" {{- end }} {{- if .Values.service.loadBalancerSourceRanges }} loadBalancerSourceRanges: {{ toYaml .Values.service.loadBalancerSourceRanges | indent 4 }} {{- end }} ports: - name: http port: {{ .Values.service.port }} protocol: TCP targetPort: http {{- if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePort))) }} nodePort: {{ .Values.service.nodePort }} {{- end }} selector: app: {{ template "nginx.name" . }} release: {{ .Release.Name }}