2022-09-22 22:05:40 +00:00
|
|
|
{{/* Make sure all variables are set properly */}}
|
2023-03-07 11:46:48 +00:00
|
|
|
{{- if eq .Values.queryLog.type "postgresql" -}}
|
|
|
|
{{- $_ := set .Values.cnpg.main "enabled" true -}}
|
|
|
|
{{- end }}
|
2023-03-04 12:42:14 +00:00
|
|
|
{{- include "tc.v1.common.loader.init" . }}
|
2022-09-22 22:05:40 +00:00
|
|
|
|
2023-03-04 12:42:14 +00:00
|
|
|
{{/* Render configmap for blocky */}}
|
|
|
|
{{- $configmapFile := include "blocky.configmap" . | fromYaml -}}
|
|
|
|
{{- if $configmapFile -}}
|
|
|
|
{{- $_ := set .Values.configmap "config" $configmapFile -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- $gatewayconfig := include "k8sgateway.configmap" . | fromYaml -}}
|
|
|
|
{{- if $gatewayconfig -}}
|
|
|
|
{{- $_ := set .Values.configmap "corefile" $gatewayconfig -}}
|
|
|
|
{{- end -}}
|
2022-09-22 22:05:40 +00:00
|
|
|
|
|
|
|
{{/* Always mount the configmap, with the basic config, plus the 'blockyConfig' */}}
|
|
|
|
{{- define "blocky.configmap.mount" -}}
|
|
|
|
enabled: true
|
2023-03-04 12:42:14 +00:00
|
|
|
type: configmap
|
2022-09-24 20:39:59 +00:00
|
|
|
mountPath: /app/config.yml
|
2023-03-04 12:42:14 +00:00
|
|
|
objectName: config
|
2022-09-22 22:05:40 +00:00
|
|
|
readOnly: true
|
2023-03-04 12:42:14 +00:00
|
|
|
subPath: config.yml
|
2022-09-22 22:05:40 +00:00
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{/* Append the general configMap volume to the volumes */}}
|
|
|
|
{{- define "k8sgateway.configvolume" -}}
|
2023-03-04 12:42:14 +00:00
|
|
|
enabled: true
|
|
|
|
type: configmap
|
|
|
|
objectName: corefile
|
|
|
|
items:
|
|
|
|
- key: Corefile
|
|
|
|
path: Corefile
|
2023-03-06 21:50:19 +00:00
|
|
|
targetSelector:
|
|
|
|
main:
|
|
|
|
k8sgateway:
|
|
|
|
mountPath: "/etc/coredns"
|
|
|
|
readOnly: true
|
|
|
|
|
2022-09-22 22:05:40 +00:00
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- $_ := set .Values.persistence "tc-config" (include "blocky.configmap.mount" . | fromYaml) -}}
|
|
|
|
|
|
|
|
{{- if and .Values.k8sgateway.enabled .Values.k8sgateway.domains -}}
|
|
|
|
{{- $_ := set .Values.persistence "config-volume" (include "k8sgateway.configvolume" . | fromYaml) -}}
|
2023-03-04 12:42:14 +00:00
|
|
|
{{- $_ := set .Values.workload.main.podSpec.containers "k8sgateway" (include "k8sgateway.container" . | fromYaml) -}}
|
2022-09-22 22:05:40 +00:00
|
|
|
{{- end -}}
|
|
|
|
|
2022-09-26 10:04:00 +00:00
|
|
|
{{/* Define path for api */}}
|
|
|
|
{{- define "blocky.api" -}}
|
2023-03-04 12:42:14 +00:00
|
|
|
{{- $fullname := include "tc.v1.common.lib.chart.names.fullname" . -}}
|
2022-09-26 10:04:00 +00:00
|
|
|
path: "/api"
|
|
|
|
# -- Ignored if not kubeVersion >= 1.14-0
|
|
|
|
pathType: Prefix
|
|
|
|
service:
|
|
|
|
# -- Overrides the service name reference for this path
|
2023-03-04 12:42:14 +00:00
|
|
|
name: {{ printf "%s-main" $fullname }}
|
|
|
|
port: {{ .Values.service.main.ports.main.port }}
|
2022-09-26 10:04:00 +00:00
|
|
|
{{- 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 */}}
|
|
|
|
{{- include "blocky.apiinjector" . }}
|
|
|
|
|
2022-09-29 20:00:12 +00:00
|
|
|
{{/* Define path for DoH */}}
|
|
|
|
{{- define "blocky.doh" -}}
|
2023-03-04 12:42:14 +00:00
|
|
|
{{- $fullname := include "tc.v1.common.lib.chart.names.fullname" . -}}
|
2022-09-29 20:00:12 +00:00
|
|
|
path: "/dns-query"
|
|
|
|
# -- Ignored if not kubeVersion >= 1.14-0
|
|
|
|
pathType: Prefix
|
|
|
|
service:
|
|
|
|
# -- Overrides the service name reference for this path
|
2023-03-04 12:42:14 +00:00
|
|
|
name: {{ printf "%s-main" $fullname }}
|
|
|
|
port: {{ .Values.service.main.ports.main.port }}
|
2022-09-29 20:00:12 +00:00
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{/* inject websocket path to all main ingress hosts*/}}
|
|
|
|
{{- define "blocky.dohinjector" -}}
|
|
|
|
{{- $path := list (include "blocky.doh" . | 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 */}}
|
|
|
|
{{- include "blocky.dohinjector" . }}
|
|
|
|
|
2022-09-22 22:05:40 +00:00
|
|
|
{{/* Render the templates */}}
|
2023-03-04 12:42:14 +00:00
|
|
|
{{ include "tc.v1.common.loader.apply" . }}
|