From 00b22662a3789c36913311b0495b498229f7e6cb Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Mon, 26 Sep 2022 12:04:00 +0200 Subject: [PATCH] Update common.yaml Signed-off-by: Kjeld Schouten-Lebbing --- .../enterprise/blocky/templates/common.yaml | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/charts/enterprise/blocky/templates/common.yaml b/charts/enterprise/blocky/templates/common.yaml index a0a743360bf..2068554237e 100644 --- a/charts/enterprise/blocky/templates/common.yaml +++ b/charts/enterprise/blocky/templates/common.yaml @@ -46,5 +46,34 @@ volumeSpec: {{- $_ := set .Values.additionalContainers "k8sgateway" (include "k8sgateway.container" . | fromYaml) -}} {{- end -}} +{{/* Define path for api */}} +{{- define "blocky.api" -}} +{{- $fullname := include "tc.common.names.fullname" . -}} +path: "/api" +# -- Ignored if not kubeVersion >= 1.14-0 +pathType: Prefix +service: + # -- Overrides the service name reference for this path + name: {{ printf "%s-http" $fullname }} + port: {{ .Values.service.http.ports.http.port }} +{{- end -}} + +{{/* inject websocket path to all main ingress hosts*/}} +{{- define "blocky.apiinjector" -}} +{{- $path := list (include "blocky.api" . | fromYaml) -}} +{{- if .Values.ingress.main.enabled }} +{{- range .Values.ingress.main.hosts }} +{{- $newpaths := list }} +{{- $newpaths := concat .paths $path }} +{{- $_ := set . "paths" ( deepCopy $newpaths ) -}} +{{- end }} +{{- end }} +{{- end -}} + +{{/* inject api paths in ingress */}} +{{- if .Values.blocky.apiIngress -}} +{{- include "blocky.apiinjector" . }} +{{- end }} + {{/* Render the templates */}} {{ include "tc.common.loader.apply" . }}