mirror of
https://github.com/k8s-at-home/charts.git
synced 2025-01-26 00:49:01 +00:00
51 lines
1.7 KiB
YAML
51 lines
1.7 KiB
YAML
{{- if .Values.mqttService.enabled }}
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: {{ template "home-assistant.fullname" . }}-mqtt
|
|
labels:
|
|
app: {{ template "home-assistant.name" . }}
|
|
chart: {{ template "home-assistant.chart" . }}
|
|
component: "{{ .Release.Name }}-{{ .Values.name }}"
|
|
release: {{ .Release.Name }}
|
|
heritage: {{ .Release.Service }}
|
|
{{- if .Values.mqttService.labels }}
|
|
{{ toYaml .Values.mqttService.labels | indent 4 }}
|
|
{{- end }}
|
|
{{- with .Values.mqttService.annotations }}
|
|
annotations:
|
|
{{ toYaml . | indent 4 }}
|
|
{{- end }}
|
|
spec:
|
|
{{- if (or (eq .Values.mqttService.type "ClusterIP") (empty .Values.mqttService.type)) }}
|
|
type: ClusterIP
|
|
{{- if .Values.mqttService.clusterIP }}
|
|
clusterIP: {{ .Values.mqttService.clusterIP }}
|
|
{{end}}
|
|
{{- else if eq .Values.mqttService.type "LoadBalancer" }}
|
|
type: {{ .Values.mqttService.type }}
|
|
{{- if .Values.mqttService.loadBalancerIP }}
|
|
loadBalancerIP: {{ .Values.mqttService.loadBalancerIP }}
|
|
{{- end }}
|
|
{{- if .Values.mqttService.loadBalancerSourceRanges }}
|
|
loadBalancerSourceRanges:
|
|
{{ toYaml .Values.mqttService.loadBalancerSourceRanges | indent 4 }}
|
|
{{- end -}}
|
|
{{- else }}
|
|
type: {{ .Values.mqttService.type }}
|
|
{{- end }}
|
|
{{- if .Values.mqttService.externalIPs }}
|
|
externalIPs:
|
|
{{ toYaml .Values.mqttService.externalIPs | indent 4 }}
|
|
{{- end }}
|
|
ports:
|
|
- name: mqtt
|
|
port: {{ .Values.mqttService.port }}
|
|
protocol: TCP
|
|
targetPort: 1883
|
|
{{ if (and (eq .Values.mqttService.type "NodePort") (not (empty .Values.mqttService.nodePort))) }}
|
|
nodePort: {{.Values.mqttService.nodePort}}
|
|
{{ end }}
|
|
selector:
|
|
component: "{{ .Release.Name }}-{{ .Values.name }}"
|
|
{{- end }} |