diff --git a/charts/zigbee2mqtt/templates/httproute.yaml b/charts/zigbee2mqtt/templates/httproute.yaml new file mode 100644 index 0000000..0aeb486 --- /dev/null +++ b/charts/zigbee2mqtt/templates/httproute.yaml @@ -0,0 +1,49 @@ +{{- if .Values.httproute.enabled -}} +{{- $servicePort := .Values.service.port -}} +{{- $fullName := include "zigbee2mqtt.fullname" . }} +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: {{ $fullName }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "zigbee2mqtt.labels" . | nindent 4 }} + {{- with .Values.httproute.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.httproute.annotations }} + annotations: + {{- range $key, $value := . }} + {{ $key }}: {{ tpl $value $ | quote }} + {{- end }} + {{- end }} +spec: + {{- with .Values.httproute.parentRefs }} + parentRefs: + {{- range . }} + - group: {{ .group | default "gateway.networking.k8s.io" }} + kind: {{ .kind | default "Gateway" }} + name: {{ .name }} + {{- with .namespace }} + namespace: {{ . }} + {{- end }} + {{- with .sectionName }} + sectionName: {{ . }} + {{- end }} + {{- end }} + {{- end }} + {{- with .Values.httproute.hostnames }} + hostnames: + {{- range . }} + - {{ . | quote }} + {{- end }} + {{- end }} + rules: + - matches: + - path: + type: {{ .Values.httproute.pathType | default "PathPrefix" }} + value: {{ .Values.httproute.path | default "/" }} + backendRefs: + - name: {{ $fullName }} + port: {{ $servicePort }} +{{- end }} diff --git a/charts/zigbee2mqtt/values.yaml b/charts/zigbee2mqtt/values.yaml index 2274d96..8c2bebe 100644 --- a/charts/zigbee2mqtt/values.yaml +++ b/charts/zigbee2mqtt/values.yaml @@ -283,6 +283,31 @@ ingress: hosts: - yourdomain.com +httproute: + # -- Setting that allows Zigbee2mqtt to generate HTTPRoute records for the Zigbee2mqtt UI service using Gateway API. + enabled: false + # -- Gateway references for HTTPRoute. Specify which Gateway(s) should handle this route. + parentRefs: [] + ## Example: + # - name: gateway-name + # namespace: gateway-namespace + # # Optional fields with defaults: + # # group: gateway.networking.k8s.io # default + # # kind: Gateway # default + # # sectionName: https # optional, targets a specific listener + # -- List of hostnames for the HTTPRoute. Multiple hostnames are supported. + hostnames: [] + ## Example: + # - zigbee2mqtt.example.com + # - zigbee2mqtt.example.org + # -- Default path for HTTPRoute. You can access the Zigbee2mqtt UI by following the full path. + path: / + # -- Path match type for HTTPRoute. (Options: "Exact", "PathPrefix") + pathType: PathPrefix + # -- Annotations for the HTTPRoute resource in the form of key-value pairs. + annotations: {} + ## Example: + # -- Extra Resources. Define some extra resources to be created, such as ExternalResource or Secrets, etc. extraResources: [] # - apiVersion: v1