From 7c54fa7f44f5c4653fcae959e23232f8a1925ec0 Mon Sep 17 00:00:00 2001 From: mloiseleur <97035654+mloiseleur@users.noreply.github.com> Date: Wed, 30 Nov 2022 15:49:33 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=8D=EF=B8=8F=20Add=20filePath=20suppor?= =?UTF-8?q?t=20on=20access=20logs=20(#747)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- traefik/Changelog.md | 96 ++++++++++++++++++++++++++ traefik/Chart.yaml | 6 +- traefik/templates/_podtemplate.tpl | 3 + traefik/tests/traefik-config_test.yaml | 17 +++++ traefik/values.yaml | 29 ++++---- 5 files changed, 135 insertions(+), 16 deletions(-) diff --git a/traefik/Changelog.md b/traefik/Changelog.md index b94dfdb09..aa5978942 100644 --- a/traefik/Changelog.md +++ b/traefik/Changelog.md @@ -1,5 +1,101 @@ # Change Log +## 20.6.0 ![AppVersion: v2.9.5](https://img.shields.io/static/v1?label=AppVersion&message=v2.9.5&color=success&logo=) ![Helm: v3](https://img.shields.io/static/v1?label=Helm&message=v3&color=informational&logo=helm) + +**Release date:** 2022-11-30 + +* 🔍️ Add filePath support on access logs +* :bug: Add missing scheme in help on Traefik Hub integration (#746) +* :memo: Improve documentation on using PVC with TLS certificates + +### Default value changes + +```diff +diff --git a/traefik/values.yaml b/traefik/values.yaml +index 15f1682..4f2fb2a 100644 +--- a/traefik/values.yaml ++++ b/traefik/values.yaml +@@ -211,10 +211,10 @@ additionalVolumeMounts: [] + # - name: traefik-logs + # mountPath: /var/log/traefik + +-# Logs +-# https://docs.traefik.io/observability/logs/ ++## Logs ++## https://docs.traefik.io/observability/logs/ + logs: +- # Traefik logs concern everything that happens to Traefik itself (startup, configuration, events, shutdown, and so on). ++ ## Traefik logs concern everything that happens to Traefik itself (startup, configuration, events, shutdown, and so on). + general: + # By default, the logs use a text format (common), but you can + # also ask for the json format in the format option +@@ -224,31 +224,32 @@ logs: + access: + # To enable access logs + enabled: false +- # By default, logs are written using the Common Log Format (CLF). +- # To write logs in JSON, use json in the format option. +- # If the given format is unsupported, the default (CLF) is used instead. ++ ## By default, logs are written using the Common Log Format (CLF) on stdout. ++ ## To write logs in JSON, use json in the format option. ++ ## If the given format is unsupported, the default (CLF) is used instead. + # format: json +- # To write the logs in an asynchronous fashion, specify a bufferingSize option. +- # This option represents the number of log lines Traefik will keep in memory before writing +- # them to the selected output. In some cases, this option can greatly help performances. ++ # filePath: "/var/log/traefik/access.log ++ ## To write the logs in an asynchronous fashion, specify a bufferingSize option. ++ ## This option represents the number of log lines Traefik will keep in memory before writing ++ ## them to the selected output. In some cases, this option can greatly help performances. + # bufferingSize: 100 +- # Filtering https://docs.traefik.io/observability/access-logs/#filtering ++ ## Filtering https://docs.traefik.io/observability/access-logs/#filtering + filters: {} + # statuscodes: "200,300-302" + # retryattempts: true + # minduration: 10ms +- # Fields +- # https://docs.traefik.io/observability/access-logs/#limiting-the-fieldsincluding-headers ++ ## Fields ++ ## https://docs.traefik.io/observability/access-logs/#limiting-the-fieldsincluding-headers + fields: + general: + defaultmode: keep + names: {} +- # Examples: ++ ## Examples: + # ClientUsername: drop + headers: + defaultmode: drop + names: {} +- # Examples: ++ ## Examples: + # User-Agent: redact + # Authorization: drop + # Content-Type: keep +@@ -693,10 +694,7 @@ autoscaling: + + # Enable persistence using Persistent Volume Claims + # ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ +-# After the pvc has been mounted, add the configs into traefik by using the `additionalArguments` list below, eg: +-# additionalArguments: +-# - "--certificatesresolvers.le.acme.storage=/data/acme.json" +-# It will persist TLS certificates. ++# It can be used to store TLS certificates, see `storage` in certResolvers + persistence: + enabled: false + name: data +@@ -726,7 +724,7 @@ certResolvers: {} + # tlsChallenge: true + # httpChallenge: + # entryPoint: "web" +-# # match the path to persistence ++# # It has to match the path with a persistent volume + # storage: /data/acme.json + + # If hostNetwork is true, runs traefik in the host network namespace +``` + ## 20.5.3 ![AppVersion: v2.9.5](https://img.shields.io/static/v1?label=AppVersion&message=v2.9.5&color=success&logo=) ![Helm: v3](https://img.shields.io/static/v1?label=Helm&message=v3&color=informational&logo=helm) **Release date:** 2022-11-25 diff --git a/traefik/Chart.yaml b/traefik/Chart.yaml index 3a823f791..bc453b445 100644 --- a/traefik/Chart.yaml +++ b/traefik/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: traefik description: A Traefik based Kubernetes ingress controller type: application -version: 20.5.3 +version: 20.6.0 appVersion: v2.9.5 keywords: - traefik @@ -25,4 +25,6 @@ maintainers: icon: https://raw.githubusercontent.com/traefik/traefik/v2.3/docs/content/assets/img/traefik.logo.png annotations: artifacthub.io/changes: | - - 🐛 Fix template issue with obsolete helm version + add helm version requirement + - 🔍️ Add filePath support on access logs + - :bug: Add missing scheme in help on Traefik Hub integration (#746) + - :memo: Improve documentation on using PVC with TLS certificates diff --git a/traefik/templates/_podtemplate.tpl b/traefik/templates/_podtemplate.tpl index ce1697593..ca343ee5f 100644 --- a/traefik/templates/_podtemplate.tpl +++ b/traefik/templates/_podtemplate.tpl @@ -482,6 +482,9 @@ {{- if .access.format }} - "--accesslog.format={{ .access.format }}" {{- end }} + {{- if .access.filePath }} + - "--accesslog.filepath={{ .access.filePath }}" + {{- end }} {{- if .access.bufferingsize }} - "--accesslog.bufferingsize={{ .access.bufferingsize }}" {{- end }} diff --git a/traefik/tests/traefik-config_test.yaml b/traefik/tests/traefik-config_test.yaml index 75c81c391..852c0aa19 100644 --- a/traefik/tests/traefik-config_test.yaml +++ b/traefik/tests/traefik-config_test.yaml @@ -385,3 +385,20 @@ tests: - contains: path: spec.template.spec.containers[0].args content: "--entrypoints.websecure.proxyProtocol.insecure" + - it: should be possible to configure access logs + set: + logs: + access: + enabled: true + format: json + filePath: "/data/log" + asserts: + - contains: + path: spec.template.spec.containers[0].args + content: "--accesslog=true" + - contains: + path: spec.template.spec.containers[0].args + content: "--accesslog.format=json" + - contains: + path: spec.template.spec.containers[0].args + content: "--accesslog.filepath=/data/log" diff --git a/traefik/values.yaml b/traefik/values.yaml index b2b08ef06..4f2fb2ab2 100644 --- a/traefik/values.yaml +++ b/traefik/values.yaml @@ -211,10 +211,10 @@ additionalVolumeMounts: [] # - name: traefik-logs # mountPath: /var/log/traefik -# Logs -# https://docs.traefik.io/observability/logs/ +## Logs +## https://docs.traefik.io/observability/logs/ logs: - # Traefik logs concern everything that happens to Traefik itself (startup, configuration, events, shutdown, and so on). + ## Traefik logs concern everything that happens to Traefik itself (startup, configuration, events, shutdown, and so on). general: # By default, the logs use a text format (common), but you can # also ask for the json format in the format option @@ -224,31 +224,32 @@ logs: access: # To enable access logs enabled: false - # By default, logs are written using the Common Log Format (CLF). - # To write logs in JSON, use json in the format option. - # If the given format is unsupported, the default (CLF) is used instead. + ## By default, logs are written using the Common Log Format (CLF) on stdout. + ## To write logs in JSON, use json in the format option. + ## If the given format is unsupported, the default (CLF) is used instead. # format: json - # To write the logs in an asynchronous fashion, specify a bufferingSize option. - # This option represents the number of log lines Traefik will keep in memory before writing - # them to the selected output. In some cases, this option can greatly help performances. + # filePath: "/var/log/traefik/access.log + ## To write the logs in an asynchronous fashion, specify a bufferingSize option. + ## This option represents the number of log lines Traefik will keep in memory before writing + ## them to the selected output. In some cases, this option can greatly help performances. # bufferingSize: 100 - # Filtering https://docs.traefik.io/observability/access-logs/#filtering + ## Filtering https://docs.traefik.io/observability/access-logs/#filtering filters: {} # statuscodes: "200,300-302" # retryattempts: true # minduration: 10ms - # Fields - # https://docs.traefik.io/observability/access-logs/#limiting-the-fieldsincluding-headers + ## Fields + ## https://docs.traefik.io/observability/access-logs/#limiting-the-fieldsincluding-headers fields: general: defaultmode: keep names: {} - # Examples: + ## Examples: # ClientUsername: drop headers: defaultmode: drop names: {} - # Examples: + ## Examples: # User-Agent: redact # Authorization: drop # Content-Type: keep