From 721ec70d30c90c70d2a02ba8274599b0905cc33a Mon Sep 17 00:00:00 2001 From: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Date: Thu, 21 Jul 2022 16:32:49 +0300 Subject: [PATCH] feat(treafik): Adds theme.park middleware and remove Traefik pilot (#3245) * chore(traefik): add deprecation pilot notice * feat(treafik): Adds theme.park middleware and deprecation notice on pilot * Update charts/stable/traefik/templates/middlewares/theme-park.yaml * just remove pilot * Apply suggestions from code review Co-authored-by: Kjeld Schouten-Lebbing --- charts/stable/traefik/Chart.yaml | 2 +- charts/stable/traefik/questions.yaml | 64 +++++++++++-------- charts/stable/traefik/templates/_args.tpl | 10 +-- .../templates/middlewares/theme-park.yaml | 20 ++++++ charts/stable/traefik/values.yaml | 15 +++++ 5 files changed, 80 insertions(+), 31 deletions(-) create mode 100644 charts/stable/traefik/templates/middlewares/theme-park.yaml diff --git a/charts/stable/traefik/Chart.yaml b/charts/stable/traefik/Chart.yaml index d63cb29b52b..4fbbaa9525f 100644 --- a/charts/stable/traefik/Chart.yaml +++ b/charts/stable/traefik/Chart.yaml @@ -22,7 +22,7 @@ sources: - https://github.com/traefik/traefik-helm-chart - https://traefik.io/ type: application -version: 12.0.24 +version: 13.0.0 annotations: truecharts.org/catagories: | - network diff --git a/charts/stable/traefik/questions.yaml b/charts/stable/traefik/questions.yaml index cfb4eca8719..10f17043fe5 100644 --- a/charts/stable/traefik/questions.yaml +++ b/charts/stable/traefik/questions.yaml @@ -78,31 +78,6 @@ questions: # Include{containerConfig} - - variable: pilot - label: "Traefik Pilot" - group: "App Configuration" - schema: - additional_attrs: true - type: dict - attrs: - - variable: enabled - label: "Enable" - schema: - type: boolean - default: false - show_subquestions_if: true - subquestions: - - variable: token - label: "token" - schema: - type: string - default: "" - - variable: dashboard - label: "Pilot Dashboard" - schema: - type: boolean - default: false - - variable: ingressClass label: "ingressClass" group: "App Configuration" @@ -453,6 +428,7 @@ questions: type: int required: true default: 200 + - variable: redirectRegex label: "redirectRegex" schema: @@ -487,6 +463,7 @@ questions: schema: type: boolean default: false + - variable: stripPrefixRegex label: "stripPrefixRegex" schema: @@ -570,6 +547,43 @@ questions: type: string required: true default: "" + - variable: themePark + label: "theme.park" + description: "Currently requires to enable Traefik Pilot. Until it's deprecated." + schema: + type: list + default: [] + items: + - variable: themeParkEntry + label: "" + schema: + additional_attrs: true + type: dict + attrs: + - variable: name + label: "Name" + schema: + type: string + required: true + - variable: app + label: "Application Name" + description: "Lower case, supported list https://docs.theme-park.dev/themes." + schema: + type: string + required: true + default: "" + - variable: theme + label: "Theme Name" + description: "Lower case, supported lists https://docs.theme-park.dev/theme-options and https://docs.theme-park.dev/community-themes" + schema: + type: string + default: "" + - variable: baseUrl + label: "Base URL for theme" + description: "https://theme-park.dev or a self hosted url" + schema: + type: string + default: "https://theme-park.dev" - variable: service group: "Networking and Services" diff --git a/charts/stable/traefik/templates/_args.tpl b/charts/stable/traefik/templates/_args.tpl index a395c6505bb..b86a7d78b3d 100644 --- a/charts/stable/traefik/templates/_args.tpl +++ b/charts/stable/traefik/templates/_args.tpl @@ -141,12 +141,12 @@ args: {{- end }} {{- end }} {{- end }} - {{- if .Values.pilot.enabled }} - - "--pilot.token={{ .Values.pilot.token }}" - {{- end }} - {{- if hasKey .Values.pilot "dashboard" }} - - "--pilot.dashboard={{ .Values.pilot.dashboard }}" + {{/* theme.park */}} + {{- if .Values.themePark}} + - "--experimental.plugins.traefik-themepark.modulename=github.com/packruler/traefik-themepark" + - "--experimental.plugins.traefik-themepark.version={{ .Values.themeParkVersion }}" {{- end }} + {{/* End of theme.park */}} {{- with .Values.additionalArguments }} {{- range . }} - {{ . | quote }} diff --git a/charts/stable/traefik/templates/middlewares/theme-park.yaml b/charts/stable/traefik/templates/middlewares/theme-park.yaml new file mode 100644 index 00000000000..4a4761dc493 --- /dev/null +++ b/charts/stable/traefik/templates/middlewares/theme-park.yaml @@ -0,0 +1,20 @@ +{{- $values := .Values }} +{{- $namespace := ( printf "ix-%s" .Release.Name ) }} +{{- if or ( not .Values.ingressClass.enabled ) ( and ( .Values.ingressClass.enabled ) ( .Values.ingressClass.isDefaultClass ) ) }} +{{- $namespace = "default" }} +{{- end }} +{{- range $index, $middlewareData := .Values.middlewares.redirectScheme }} + +--- +# Declaring the user list +apiVersion: traefik.containo.us/v1alpha1 +kind: Middleware +metadata: + name: {{ $middlewareData.name }} + namespace: {{ $namespace }} +spec: + plugin: + traefik-themepark: + app: {{ $middlewareData.app }} + theme: {{ $middlewareData.theme }} +{{- end }} diff --git a/charts/stable/traefik/values.yaml b/charts/stable/traefik/values.yaml index 7e71c004238..81d84d8cdbf 100644 --- a/charts/stable/traefik/values.yaml +++ b/charts/stable/traefik/values.yaml @@ -12,6 +12,7 @@ ingressClass: # Use to force a networking.k8s.io API Version for certain CI/CD applications. E.g. "v1beta1" fallbackApiVersion: "" +# -- Deprecated (will be removed later) # -- Activate Pilot integration pilot: enabled: false @@ -333,6 +334,20 @@ middlewares: # ipStrategy: # depth: 2 # excludedIPs: [] + # -- Currently requires to enable Traefik Pilot. + # -- Until it's deprecated. + themePark: [] + # - name: themeParkName + # -- Supported apps, lower case name + # -- https://docs.theme-park.dev/themes + # app: appnamehere + # -- Supported themes, lower case name + # -- https://docs.theme-park.dev/themes/APPNAMEHERE + # -- https://docs.theme-park.dev/community-themes + # theme: themenamehere + # -- https://theme-park.dev or a self hosted url + # baseUrl: https://theme-park.dev + themeParkVersion: v1.1.0 portalhook: enabled: true