Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

2.8 KB
Raw Blame
apiVersion: v1
kind: Service
metadata:
  name: {{ include "proxy.fullname" . }}
  labels:
    {{- include "proxy.labels" . | nindent 4 }}
    {{- if and .Values.dns.enabled (eq .Values.service.http.type "LoadBalancer") }}
    openremote.io/managed-dns: "true"
    {{- end }}
  {{- if or .Values.service.http.annotations (and .Values.dns.enabled (eq .Values.service.http.type "LoadBalancer")) }}
  annotations:
    {{- with .Values.service.http.annotations }}
    {{- toYaml . | nindent 4 }}
    {{- end }}
    {{- if and .Values.dns.enabled (eq .Values.service.http.type "LoadBalancer") }}
    external-dns.kubernetes.io/hostname: {{ required "dns.hostname is required when dns.enabled is true" .Values.dns.hostname | quote }}
    {{- end }}
  {{- end }}
spec:
  type: {{ .Values.service.http.type }}
  ports:
    - port: {{ .Values.service.http.port }}
      targetPort: {{ .Values.or.httpPort }}
      protocol: TCP
      name: http
    {{- if .Values.service.https.enabled }}
    - port: {{ .Values.service.https.port }}
      targetPort: {{ .Values.or.httpsPort }}
      protocol: TCP
      name: https
    {{- end }}
    {{- if and .Values.service.mqtts.enabled (not .Values.service.mqtts.separate) }}
    - port: {{ .Values.service.mqtts.port }}
      targetPort: {{ .Values.or.mqttPort }}
      protocol: TCP
      name: mqtts
    {{- end }}
  selector:
    {{- include "proxy.selectorLabels" . | nindent 4 }}
---
{{- if .Values.service.metrics.enabled }}
apiVersion: v1
kind: Service
metadata:
  name: proxy-metrics
  {{- with .Values.service.metrics.annotations }}
  annotations:
    {{- toYaml . | nindent 4 }}
  {{- end }}
spec:
  type: {{ .Values.service.metrics.type }}
  ports:
    - name: metrics
      port: {{ .Values.service.metrics.port }}
      targetPort: 8404
      protocol: TCP
  selector:
    {{- include "proxy.selectorLabels" . | nindent 4 }}
{{- end }}
---
{{- if and .Values.service.mqtts.enabled .Values.service.mqtts.separate }}
apiVersion: v1
kind: Service
metadata:
  name: {{ include "proxy.fullname" . }}-mqtts
  labels:
    {{- include "proxy.labels" . | nindent 4 }}
    {{- if .Values.service.mqtts.dns.enabled }}
    openremote.io/managed-dns: "true"
    {{- end }}
  {{- if or .Values.service.mqtts.annotations .Values.service.mqtts.dns.enabled }}
  annotations:
    {{- with .Values.service.mqtts.annotations }}
    {{- toYaml . | nindent 4 }}
    {{- end }}
    {{- if .Values.service.mqtts.dns.enabled }}
    external-dns.kubernetes.io/hostname: {{ required "service.mqtts.dns.hostname is required when service.mqtts.dns.enabled is true" .Values.service.mqtts.dns.hostname | quote }}
    {{- end }}
  {{- end }}
spec:
  type: {{ .Values.service.mqtts.type }}
  ports:
    - port: {{ .Values.service.mqtts.port }}
      targetPort: {{ .Values.or.mqttPort }}
      protocol: TCP
      name: mqtts
  selector:
    {{- include "proxy.selectorLabels" . | nindent 4 }}
{{- end }}