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" . }}