{{- range $w := $.Values.workers }} --- {{- if $w.httpPort }} apiVersion: v1 kind: Service metadata: name: {{ $w.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: {{ $w.httpPort }} protocol: TCP name: http selector: app: {{ $w.name }} release: {{ $.Release.Name }} {{- end }} {{- end }}