{{- if .Values.configurator.enabled }} apiVersion: v1 kind: Service metadata: name: {{ template "home-assistant.configurator.fullname" . }} labels: app: {{ template "home-assistant.name" . }} chart: {{ template "home-assistant.chart" . }} component: "{{ .Release.Name }}-{{ .Values.configurator.name }}" release: {{ .Release.Name }} heritage: {{ .Release.Service }} {{- if .Values.configurator.service.labels }} {{ toYaml .Values.configurator.service.labels | indent 4 }} {{- end }} {{- with .Values.configurator.service.annotations }} annotations: {{ toYaml . | indent 4 }} {{- end }} spec: {{- if (or (eq .Values.configurator.service.type "ClusterIP") (empty .Values.configurator.service.type)) }} type: ClusterIP {{- if .Values.configurator.service.clusterIP }} clusterIP: {{ .Values.configurator.service.clusterIP }} {{end}} {{- else if eq .Values.configurator.service.type "LoadBalancer" }} type: {{ .Values.configurator.service.type }} {{- if .Values.configurator.service.loadBalancerIP }} loadBalancerIP: {{ .Values.configurator.service.loadBalancerIP }} {{- end }} {{- if .Values.configurator.service.loadBalancerSourceRanges }} loadBalancerSourceRanges: {{ toYaml .Values.configurator.service.loadBalancerSourceRanges | indent 4 }} {{- end -}} {{- else }} type: {{ .Values.configurator.service.type }} {{- end }} {{- if .Values.configurator.service.externalIPs }} externalIPs: {{ toYaml .Values.configurator.service.externalIPs | indent 4 }} {{- end }} ports: - name: http port: {{ .Values.configurator.service.port }} protocol: TCP targetPort: 3218 {{ if (and (eq .Values.configurator.service.type "NodePort") (not (empty .Values.configurator.service.nodePort))) }} nodePort: {{.Values.configurator.service.nodePort}} {{ end }} selector: component: "{{ .Release.Name }}-{{ .Values.configurator.name }}" {{- end }}