fix(traefik): ensure ingressclass state is fetched from global scope

This commit is contained in:
Kjeld Schouten-Lebbing 2023-05-24 11:36:22 +02:00
parent eb5e234437
commit 023e095d78
20 changed files with 36 additions and 36 deletions

View File

@ -23,7 +23,7 @@ sources:
- https://github.com/traefik/traefik-helm-chart
- https://traefik.io/
type: application
version: 18.0.0
version: 18.0.1
annotations:
truecharts.org/catagories: |
- network

View File

@ -67,7 +67,7 @@ args:
- "--providers.kubernetesingress.namespaces={{ template "providers.kubernetesIngress.namespaces" . }}"
{{- end }}
{{- end }}
{{- if .Values.ingressClass.enabled }}
{{- if $.Values.ingressClass.enabled }}
- "--providers.kubernetesingress.ingressclass={{ .Release.Name }}"
{{- end }}
{{- range $entrypoint, $config := $ports }}

View File

@ -1,7 +1,7 @@
{{/* Define the ingressClass */}}
{{- define "traefik.ingressClass" -}}
---
{{ if .Values.ingressClass.enabled }}
{{ if $.Values.ingressClass.enabled }}
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1/IngressClass" }}
apiVersion: networking.k8s.io/v1
{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1/IngressClass" }}

View File

@ -6,7 +6,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: portalhook{{ if .Values.ingressClass.enabled }}-{{ .Release.Name }}{{ end }}
name: portalhook{{ if $.Values.ingressClass.enabled }}-{{ .Release.Name }}{{ end }}
namespace: tc-system
data:
{{- $ports := dict }}

View File

@ -6,7 +6,7 @@
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: {{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ $middlewareData.name }}
name: {{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ $middlewareData.name }}
namespace: tc-system
spec:
addPrefix:

View File

@ -4,7 +4,7 @@
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: {{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}compress
name: {{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}compress
namespace: tc-system
spec:
compress: {}
@ -14,7 +14,7 @@ spec:
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: {{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}basic-ratelimit
name: {{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}basic-ratelimit
namespace: tc-system
spec:
rateLimit:
@ -24,7 +24,7 @@ spec:
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: {{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}basic-secure-headers
name: {{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}basic-secure-headers
namespace: tc-system
spec:
headers:
@ -49,11 +49,11 @@ spec:
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: {{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}chain-basic
name: {{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}chain-basic
namespace: tc-system
spec:
chain:
middlewares:
- name: {{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}basic-ratelimit
- name: {{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}basic-secure-headers
- name: {{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}compress
- name: {{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}basic-ratelimit
- name: {{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}basic-secure-headers
- name: {{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}compress

View File

@ -23,7 +23,7 @@ stringData:
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: {{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ $middlewareData.name }}
name: {{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ $middlewareData.name }}
namespace: tc-system
spec:
basicAuth:

View File

@ -1,6 +1,6 @@
{{- $values := .Values }}
{{- $namespace := "tc-system" }}
{{- if .Values.ingressClass.enabled }}
{{- if $.Values.ingressClass.enabled }}
{{- $namespace := ( printf "tc-system-%s" .Release.Name ) }}
{{- end }}
{{ range $index, $middlewareData := .Values.middlewares.chain }}
@ -10,7 +10,7 @@
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: {{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ $middlewareData.name }}
name: {{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ $middlewareData.name }}
namespace: tc-system
spec:
chain:

View File

@ -5,7 +5,7 @@
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: {{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ $middlewareData.name }}
name: {{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ $middlewareData.name }}
namespace: tc-system
spec:
forwardAuth:

View File

@ -6,7 +6,7 @@
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: {{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ $middlewareData.name }}
name: {{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ $middlewareData.name }}
namespace: tc-system
spec:
plugin:

View File

@ -7,7 +7,7 @@
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: {{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ $middlewareData.name }}
name: {{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ $middlewareData.name }}
namespace: tc-system
spec:
ipWhiteList:

View File

@ -7,7 +7,7 @@
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: {{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ $middlewareData.name }}
name: {{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ $middlewareData.name }}
namespace: tc-system
spec:
rateLimit:

View File

@ -6,7 +6,7 @@
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: {{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ $middlewareData.name }}
name: {{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ $middlewareData.name }}
namespace: tc-system
spec:
plugin:

View File

@ -7,7 +7,7 @@
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: {{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ $middlewareData.name }}
name: {{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ $middlewareData.name }}
namespace: tc-system
spec:
redirectScheme:

View File

@ -7,7 +7,7 @@
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: {{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ $middlewareData.name }}
name: {{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ $middlewareData.name }}
namespace: tc-system
spec:
redirectRegex:

View File

@ -6,7 +6,7 @@
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: {{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ $middlewareData.name }}
name: {{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ $middlewareData.name }}
namespace: tc-system
spec:
stripPrefixRegex:

View File

@ -4,14 +4,14 @@
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: {{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}tc-opencors-chain
name: {{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}tc-opencors-chain
namespace: tc-system
spec:
chain:
middlewares:
- name: {{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}basic-ratelimit
- name: {{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}tc-opencors-headers
- name: {{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}compress
- name: {{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}basic-ratelimit
- name: {{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}tc-opencors-headers
- name: {{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}compress
---
apiVersion: traefik.io/v1alpha1
kind: Middleware
@ -21,6 +21,6 @@ metadata:
spec:
chain:
middlewares:
- name: {{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}basic-ratelimit
- name: {{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}tc-closedcors-headers
- name: {{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}compress
- name: {{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}basic-ratelimit
- name: {{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}tc-closedcors-headers
- name: {{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}compress

View File

@ -4,7 +4,7 @@
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: {{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}tc-opencors-headers
name: {{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}tc-opencors-headers
namespace: tc-system
spec:
headers:
@ -34,7 +34,7 @@ spec:
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: {{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}tc-closedcors-headers
name: {{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}tc-closedcors-headers
namespace: tc-system
spec:
headers:

View File

@ -4,7 +4,7 @@
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: {{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}tc-nextcloud-redirectregex-dav
name: {{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}tc-nextcloud-redirectregex-dav
namespace: tc-system
spec:
redirectRegex:
@ -14,9 +14,9 @@ spec:
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: {{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}tc-nextcloud-chain
name: {{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}tc-nextcloud-chain
namespace: tc-system
spec:
chain:
middlewares:
- name: {{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}tc-nextcloud-redirectregex-dav
- name: {{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}tc-nextcloud-redirectregex-dav

View File

@ -6,7 +6,7 @@
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: {{ if .Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ $middlewareData.name }}
name: {{ if $.Values.ingressClass.enabled }}{{ .Release.Name }}-{{ end }}{{ $middlewareData.name }}
namespace: tc-system
spec:
plugin: