{{- if .Values.httpPort }} apiVersion: v1 kind: Service metadata: name: {{ .Values.name }} namespace: {{ .Release.Namespace }} labels: app: {{ .Values.name }} type: {{ .Values.type | default "service" }} {{- if $.Values.labels }} {{ toYaml $.Values.labels | indent 4 }} {{- end }} chart: {{ template "chart.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} spec: ports: - port: 80 targetPort: {{ .Values.httpPort }} protocol: TCP name: http {{- if (.Values.health.port) and (not (eq .Values.health.port .Values.httpPort)) }} - port: {{ .Values.health.port }} protocol: TCP name: health {{- end }} {{- range $p := .Values.ports }} - port: {{ $p.port }} protocol: {{ $p.protocol }} name: {{ $p.name }} {{- end }} selector: app: {{ .Values.name }} release: {{ .Release.Name }} {{- end }}