Files
plcnk-helm-charts/charts/cloudflare-tunnel/templates/common.yaml
Romain Pluciennik 316c9da542 feat(cloudflare): Initial release (#17)
* feat(cloudflare): Initial release

* feat(cloudflare): Update README.md
2024-08-21 00:32:49 +02:00

60 lines
1.7 KiB
YAML

{{/* Append the hardcoded settings */}}
{{- define "cloudflare-tunnel.harcodedValues" -}}
{{- if .Values.metrics.enabled }}
service:
main:
controller: main
ports:
metrics:
port: {{ .Values.metrics.port }}
protocol: TCP
serviceMonitor:
main:
enabled: true
serviceName: {{ include "bjw-s.common.lib.chart.names.fullname" $ }}
endpoints:
- port: metrics
path: /metrics
{{- end }}
controllers:
main:
containers:
app:
{{- if .Values.metrics.enabled }}
ports:
- name: metrics
containerPort: {{ .Values.metrics.port }}
{{- end }}
env:
TUNNEL_TOKEN: {{ if not .Values.tunnel.existingSecret.enabled }}{{ .Values.tunnel.token }}{{ end }}
{{- if .Values.tunnel.existingSecret.enabled }}
secretKeyRef:
name: {{ .Values.tunnel.existingSecret.name }}
key: {{ .Values.tunnel.existingSecret.key }}
{{- end }}
args:
- tunnel
- --no-autoupdate
{{- if .Values.logLevel }}
- --loglevel
- {{ .Values.logLevel }}
{{- end }}
{{- if .Values.metrics.enabled }}
- --metrics
- "0.0.0.0:{{ .Values.metrics.port }}"
{{- end }}
- run
- --token
- $(TUNNEL_TOKEN)
{{- end -}}
{{- $tmplVars := deepCopy . -}}
{{ include "bjw-s.common.loader.init" $tmplVars }}
{{- $defaultValues := include "cloudflare-tunnel.harcodedValues" $tmplVars | fromYaml -}}
{{- $_ := mustMerge .Values $defaultValues -}}
{{/* Render the templates */}}
{{ include "bjw-s.common.loader.init" . }}
{{ include "bjw-s.common.loader.generate" . }}