2021-09-03 08:43:21 -04:00
|
|
|
{{/* Define the args */}}
|
|
|
|
{{- define "traefik.args" -}}
|
|
|
|
args:
|
|
|
|
{{/* merge all ports */}}
|
|
|
|
{{- $ports := dict }}
|
|
|
|
{{- range $.Values.service }}
|
|
|
|
{{- range $name, $value := .ports }}
|
|
|
|
{{- $_ := set $ports $name $value }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{/* start of actual arguments */}}
|
|
|
|
{{- with .Values.globalArguments }}
|
|
|
|
{{- range . }}
|
|
|
|
- {{ . | quote }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- range $name, $config := $ports }}
|
|
|
|
{{- if $config }}
|
2023-03-04 07:42:14 -05:00
|
|
|
{{- if or ( eq $config.protocol "http" ) ( eq $config.protocol "https" ) ( eq $config.protocol "tcp" ) }}
|
|
|
|
{{- $_ := set $config "protocol" "tcp" }}
|
2021-09-03 08:43:21 -04:00
|
|
|
{{- end }}
|
|
|
|
- "--entryPoints.{{$name}}.address=:{{ $config.port }}/{{ default "tcp" $config.protocol | lower }}"
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
- "--api.dashboard=true"
|
|
|
|
- "--ping=true"
|
2023-03-25 05:27:00 -04:00
|
|
|
{{- if .Values.traefikMetrics }}
|
|
|
|
{{- if .Values.traefikMetrics.datadog }}
|
2021-09-03 08:43:21 -04:00
|
|
|
- "--metrics.datadog=true"
|
2023-03-25 05:27:00 -04:00
|
|
|
- "--metrics.datadog.address={{ .Values.traefikMetrics.datadog.address }}"
|
2021-09-03 08:43:21 -04:00
|
|
|
{{- end }}
|
2023-03-25 05:27:00 -04:00
|
|
|
{{- if .Values.traefikMetrics.influxdb }}
|
2021-09-03 08:43:21 -04:00
|
|
|
- "--metrics.influxdb=true"
|
2023-03-25 05:27:00 -04:00
|
|
|
- "--metrics.influxdb.address={{ .Values.traefikMetrics.influxdb.address }}"
|
|
|
|
- "--metrics.influxdb.protocol={{ .Values.traefikMetrics.influxdb.protocol }}"
|
2021-09-03 08:43:21 -04:00
|
|
|
{{- end }}
|
2023-03-25 05:27:00 -04:00
|
|
|
{{- if .Values.traefikMetrics.statsd }}
|
|
|
|
- "--metrics.statsd=true"
|
|
|
|
- "--metrics.statsd.address={{ .Values.traefikMetrics.statsd.address }}"
|
|
|
|
{{- if or .Values.traefikMetrics.prometheus }}
|
2021-09-03 08:43:21 -04:00
|
|
|
- "--metrics.prometheus=true"
|
2023-03-11 15:25:12 -05:00
|
|
|
- "--metrics.prometheus.entrypoint=metrics"
|
2021-09-03 08:43:21 -04:00
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
2023-03-25 05:27:00 -04:00
|
|
|
{{- if or .Values.metrics.main.enabled }}
|
|
|
|
- "--metrics.prometheus=true"
|
|
|
|
- "--metrics.prometheus.entrypoint=metrics"
|
|
|
|
{{- end }}
|
2021-09-03 08:43:21 -04:00
|
|
|
{{- if .Values.providers.kubernetesCRD.enabled }}
|
|
|
|
- "--providers.kubernetescrd"
|
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.providers.kubernetesIngress.enabled }}
|
|
|
|
- "--providers.kubernetesingress"
|
2022-01-09 08:25:08 -05:00
|
|
|
{{- if .Values.providers.kubernetesIngress.publishedService.enabled }}
|
2021-09-03 08:43:21 -04:00
|
|
|
- "--providers.kubernetesingress.ingressendpoint.publishedservice={{ template "providers.kubernetesIngress.publishedServicePath" . }}"
|
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.providers.kubernetesIngress.labelSelector }}
|
|
|
|
- "--providers.kubernetesingress.labelSelector={{ .Values.providers.kubernetesIngress.labelSelector }}"
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if and .Values.rbac.enabled .Values.rbac.namespaced }}
|
|
|
|
{{- if .Values.providers.kubernetesCRD.enabled }}
|
|
|
|
- "--providers.kubernetescrd.namespaces={{ template "providers.kubernetesCRD.namespaces" . }}"
|
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.providers.kubernetesIngress.enabled }}
|
|
|
|
- "--providers.kubernetesingress.namespaces={{ template "providers.kubernetesIngress.namespaces" . }}"
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
2023-05-24 05:36:22 -04:00
|
|
|
{{- if $.Values.ingressClass.enabled }}
|
2022-05-15 03:40:50 -04:00
|
|
|
- "--providers.kubernetesingress.ingressclass={{ .Release.Name }}"
|
2022-05-09 03:30:01 -04:00
|
|
|
{{- end }}
|
2021-09-03 08:43:21 -04:00
|
|
|
{{- range $entrypoint, $config := $ports }}
|
2022-08-27 16:58:46 -04:00
|
|
|
{{/* add args for proxyProtocol support */}}
|
|
|
|
{{- if $config.proxyProtocol }}
|
|
|
|
{{- if $config.proxyProtocol.enabled }}
|
|
|
|
{{- if $config.proxyProtocol.insecureMode }}
|
|
|
|
- "--entrypoints.{{ $entrypoint }}.proxyProtocol.insecure"
|
|
|
|
{{- end }}
|
|
|
|
{{- if not ( empty $config.proxyProtocol.trustedIPs ) }}
|
|
|
|
- "--entrypoints.{{ $entrypoint }}.proxyProtocol.trustedIPs={{ join "," $config.proxyProtocol.trustedIPs }}"
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
2022-05-04 11:53:21 -04:00
|
|
|
{{/* add args for forwardedHeaders support */}}
|
|
|
|
{{- if $config.forwardedHeaders.enabled }}
|
|
|
|
{{- if not ( empty $config.forwardedHeaders.trustedIPs ) }}
|
|
|
|
- "--entrypoints.{{ $entrypoint }}.forwardedHeaders.trustedIPs={{ join "," $config.forwardedHeaders.trustedIPs }}"
|
|
|
|
{{- end }}
|
|
|
|
{{- if $config.forwardedHeaders.insecureMode }}
|
|
|
|
- "--entrypoints.{{ $entrypoint }}.forwardedHeaders.insecure"
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{/* end forwardedHeaders configuration */}}
|
2021-09-03 08:43:21 -04:00
|
|
|
{{- if $config.redirectTo }}
|
|
|
|
{{- $toPort := index $ports $config.redirectTo }}
|
|
|
|
- "--entrypoints.{{ $entrypoint }}.http.redirections.entryPoint.to=:{{ $toPort.port }}"
|
|
|
|
- "--entrypoints.{{ $entrypoint }}.http.redirections.entryPoint.scheme=https"
|
2021-12-22 09:30:58 -05:00
|
|
|
{{- else if $config.redirectPort }}
|
|
|
|
{{ if gt $config.redirectPort 0.0 }}
|
|
|
|
- "--entrypoints.{{ $entrypoint }}.http.redirections.entryPoint.to=:{{ $config.redirectPort }}"
|
|
|
|
- "--entrypoints.{{ $entrypoint }}.http.redirections.entryPoint.scheme=https"
|
|
|
|
{{- end }}
|
2021-09-03 08:43:21 -04:00
|
|
|
{{- end }}
|
2023-03-04 07:42:14 -05:00
|
|
|
{{- if or ( $config.tls ) ( eq $config.protocol "https" ) }}
|
|
|
|
{{- if or ( $config.tls.enabled ) ( eq $config.protocol "https" ) }}
|
2021-09-03 08:43:21 -04:00
|
|
|
- "--entrypoints.{{ $entrypoint }}.http.tls=true"
|
|
|
|
{{- if $config.tls.options }}
|
|
|
|
- "--entrypoints.{{ $entrypoint }}.http.tls.options={{ $config.tls.options }}"
|
|
|
|
{{- end }}
|
|
|
|
{{- if $config.tls.certResolver }}
|
|
|
|
- "--entrypoints.{{ $entrypoint }}.http.tls.certResolver={{ $config.tls.certResolver }}"
|
|
|
|
{{- end }}
|
|
|
|
{{- if $config.tls.domains }}
|
|
|
|
{{- range $index, $domain := $config.tls.domains }}
|
|
|
|
{{- if $domain.main }}
|
|
|
|
- "--entrypoints.{{ $entrypoint }}.http.tls.domains[{{ $index }}].main={{ $domain.main }}"
|
|
|
|
{{- end }}
|
|
|
|
{{- if $domain.sans }}
|
|
|
|
- "--entrypoints.{{ $entrypoint }}.http.tls.domains[{{ $index }}].sans={{ join "," $domain.sans }}"
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- with .Values.logs }}
|
|
|
|
- "--log.format={{ .general.format }}"
|
|
|
|
{{- if ne .general.level "ERROR" }}
|
|
|
|
- "--log.level={{ .general.level | upper }}"
|
|
|
|
{{- end }}
|
|
|
|
{{- if .access.enabled }}
|
|
|
|
- "--accesslog=true"
|
|
|
|
- "--accesslog.format={{ .access.format }}"
|
|
|
|
{{- if .access.bufferingsize }}
|
|
|
|
- "--accesslog.bufferingsize={{ .access.bufferingsize }}"
|
|
|
|
{{- end }}
|
|
|
|
{{- if .access.filters }}
|
|
|
|
{{- if .access.filters.statuscodes }}
|
|
|
|
- "--accesslog.filters.statuscodes={{ .access.filters.statuscodes }}"
|
|
|
|
{{- end }}
|
|
|
|
{{- if .access.filters.retryattempts }}
|
|
|
|
- "--accesslog.filters.retryattempts"
|
|
|
|
{{- end }}
|
|
|
|
{{- if .access.filters.minduration }}
|
|
|
|
- "--accesslog.filters.minduration={{ .access.filters.minduration }}"
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
- "--accesslog.fields.defaultmode={{ .access.fields.general.defaultmode }}"
|
|
|
|
{{- range $fieldname, $fieldaction := .access.fields.general.names }}
|
|
|
|
- "--accesslog.fields.names.{{ $fieldname }}={{ $fieldaction }}"
|
|
|
|
{{- end }}
|
|
|
|
- "--accesslog.fields.headers.defaultmode={{ .access.fields.headers.defaultmode }}"
|
|
|
|
{{- range $fieldname, $fieldaction := .access.fields.headers.names }}
|
|
|
|
- "--accesslog.fields.headers.names.{{ $fieldname }}={{ $fieldaction }}"
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
2023-07-29 16:03:37 -04:00
|
|
|
{{/*
|
|
|
|
For new plugins, add them on the container also
|
|
|
|
https://github.com/truecharts/containers/blob/master/mirror/traefik/Dockerfile
|
|
|
|
moduleName must match on the container and here
|
|
|
|
*/}}
|
2022-07-22 11:31:30 -04:00
|
|
|
{{- if .Values.middlewares.themePark }}
|
2023-07-29 16:03:37 -04:00
|
|
|
{{/* theme.park */}}
|
|
|
|
- "--experimental.localPlugins.traefik-themepark.modulename=github.com/packruler/traefik-themepark"
|
2021-09-03 08:43:21 -04:00
|
|
|
{{- end }}
|
2022-07-21 09:32:49 -04:00
|
|
|
{{/* End of theme.park */}}
|
2022-11-13 06:03:07 -05:00
|
|
|
{{/* GeoBlock */}}
|
|
|
|
{{- if .Values.middlewares.geoBlock }}
|
2023-07-29 16:03:37 -04:00
|
|
|
- "--experimental.localPlugins.GeoBlock.modulename=github.com/PascalMinder/geoblock"
|
2022-11-13 06:03:07 -05:00
|
|
|
{{- end }}
|
|
|
|
{{/* End of GeoBlock */}}
|
2022-09-25 05:14:39 -04:00
|
|
|
{{/* RealIP */}}
|
|
|
|
{{- if .Values.middlewares.realIP }}
|
2023-08-24 07:48:11 -04:00
|
|
|
- "--experimental.localPlugins.traefik-real-ip.modulename=github.com/jramsgz/traefik-real-ip"
|
2022-09-25 05:14:39 -04:00
|
|
|
{{- end }}
|
|
|
|
{{/* End of RealIP */}}
|
2023-08-24 16:31:32 -04:00
|
|
|
{{/* ModSecurity */}}
|
|
|
|
{{- if .Values.middlewares.modsecurity }}
|
|
|
|
- "--experimental.localPlugins.traefik-modsecurity-plugin.modulename=github.com/acouvreur/traefik-modsecurity-plugin"
|
|
|
|
{{- end }}
|
2024-03-04 09:00:26 -05:00
|
|
|
{{/* CrowdsecBouncer */}}
|
2024-03-04 11:44:42 -05:00
|
|
|
{{- if .Values.middlewares.bouncer }}
|
|
|
|
- "--experimental.localPlugins.bouncer.modulename=github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin"
|
2024-03-04 09:00:26 -05:00
|
|
|
{{- end }}
|
2023-08-24 16:31:32 -04:00
|
|
|
{{/* End of ModSecurity */}}
|
2023-10-27 14:15:37 -04:00
|
|
|
{{/* RewriteResponseHeaders */}}
|
|
|
|
{{- if .Values.middlewares.rewriteResponseHeaders }}
|
|
|
|
- "--experimental.localPlugins.rewriteResponseHeaders.modulename=github.com/XciD/traefik-plugin-rewrite-headers"
|
|
|
|
{{- end }}
|
|
|
|
{{/* End of RewriteResponseHeaders */}}
|
2021-09-03 08:43:21 -04:00
|
|
|
{{- with .Values.additionalArguments }}
|
|
|
|
{{- range . }}
|
|
|
|
- {{ . | quote }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end -}}
|