2022-09-22 22:05:40 +00:00
|
|
|
{{- define "k8sgateway.container" -}}
|
|
|
|
image: {{ .Values.k8sgatewayImage.repository }}:{{ .Values.k8sgatewayImage.tag }}
|
|
|
|
imagePullPolicy: {{ .Values.k8sgatewayImage.pullPolicy }}
|
|
|
|
securityContext:
|
|
|
|
runAsUser: 0
|
|
|
|
runAsGroup: 0
|
|
|
|
readOnlyRootFilesystem: true
|
|
|
|
runAsNonRoot: false
|
|
|
|
args: ["-conf", "/etc/coredns/Corefile"]
|
|
|
|
volumeMounts:
|
|
|
|
- name: config-volume
|
|
|
|
mountPath: /etc/coredns
|
2023-03-04 12:42:14 +00:00
|
|
|
probe:
|
|
|
|
readiness:
|
|
|
|
httpGet:
|
|
|
|
path: /ready
|
|
|
|
port: 8181
|
|
|
|
liveness:
|
|
|
|
httpGet:
|
|
|
|
path: /health
|
|
|
|
port: 8080
|
|
|
|
startup:
|
|
|
|
httpGet:
|
|
|
|
path: /ready
|
|
|
|
port: 8181
|
2022-09-22 22:05:40 +00:00
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{/*
|
|
|
|
Create the matchable regex from domain
|
|
|
|
*/}}
|
|
|
|
{{- define "k8sgateway.configmap.regex" -}}
|
2022-09-24 18:49:03 +00:00
|
|
|
{{- if .dnsChallenge.domain }}
|
|
|
|
{{- .dnsChallenge.domain | replace "." "[.]" -}}
|
2022-09-22 22:05:40 +00:00
|
|
|
{{- else -}}
|
|
|
|
{{ "unset" }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{/* Define the configmap */}}
|
|
|
|
{{- define "k8sgateway.configmap" -}}
|
|
|
|
{{- $values := .Values.k8sgateway }}
|
2023-03-04 12:42:14 +00:00
|
|
|
{{- $fqdn := ( include "tc.v1.common.lib.chart.names.fqdn" . ) }}
|
|
|
|
enabled: true
|
2022-09-22 22:05:40 +00:00
|
|
|
data:
|
|
|
|
Corefile: |-
|
|
|
|
.:{{ .Values.service.k8sgateway.ports.k8sgateway.targetPort }} {
|
|
|
|
errors
|
|
|
|
log
|
|
|
|
health {
|
|
|
|
lameduck 5s
|
|
|
|
}
|
|
|
|
ready
|
|
|
|
{{- range .Values.k8sgateway.domains }}
|
|
|
|
{{- if .dnsChallenge.enabled }}
|
2022-09-24 18:49:03 +00:00
|
|
|
template IN ANY {{ required "Delegated domain ('domain') is mandatory" .domain }} {
|
2022-09-22 22:05:40 +00:00
|
|
|
match "_acme-challenge[.](.*)[.]{{ include "k8sgateway.configmap.regex" . }}"
|
2022-09-24 18:49:03 +00:00
|
|
|
answer "{{ "{{" }} .Name {{ "}}" }} 5 IN CNAME {{ "{{" }} index .Match 1 {{ "}}" }}.{{ required "DNS01 challenge domain is mandatory" .dnsChallenge.domain }}"
|
2022-09-22 22:05:40 +00:00
|
|
|
fallthrough
|
|
|
|
}
|
|
|
|
{{- end }}
|
2023-02-22 09:13:26 +00:00
|
|
|
{{- end }}
|
|
|
|
k8s_gateway {{ range .Values.k8sgateway.domains }}"{{ required "Delegated domain ('domain') is mandatory " .domain }}"{{ end }} {
|
2022-09-22 22:05:40 +00:00
|
|
|
apex {{ $values.apex | default $fqdn }}
|
|
|
|
ttl {{ $values.ttl }}
|
|
|
|
{{- if $values.secondary }}
|
|
|
|
secondary {{ $values.secondary }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if $values.watchedResources }}
|
|
|
|
resources {{ join " " $values.watchedResources }}
|
|
|
|
{{- end }}
|
|
|
|
fallthrough
|
|
|
|
}
|
2023-02-22 09:13:26 +00:00
|
|
|
|
2022-09-22 22:05:40 +00:00
|
|
|
prometheus 0.0.0.0:9153
|
|
|
|
{{- if .Values.k8sgateway.forward.enabled }}
|
|
|
|
forward . {{ .Values.k8sgateway.forward.primary }} {{ .Values.k8sgateway.forward.secondary }} {
|
|
|
|
{{- range .Values.k8sgateway.forward.options }}
|
|
|
|
{{ .name }} {{ .value }}
|
|
|
|
{{- end }}
|
|
|
|
}
|
|
|
|
{{- else }}
|
|
|
|
forward . 1.1.1.1
|
|
|
|
{{- end }}
|
|
|
|
loop
|
|
|
|
reload
|
|
|
|
loadbalance
|
|
|
|
}
|
|
|
|
{{- end -}}
|