temporary fix to cleanup auth forward (#422)
* temporary fix to cleanup auth forward * actually: its crd based to begin with! * update tests * actually fix tests
This commit is contained in:
@@ -983,7 +983,8 @@ class Test < ChartTest
|
|||||||
|
|
||||||
it 'HTTP-ingressRoute+selfsigned+forwardAuth is evaluated is evaluated ' do
|
it 'HTTP-ingressRoute+selfsigned+forwardAuth is evaluated is evaluated ' do
|
||||||
expectedHostString = 'Host(`hostname`) && PathPrefix(`/`)'
|
expectedHostString = 'Host(`hostname`) && PathPrefix(`/`)'
|
||||||
expectedName = 'common-test-test1-auth-forward'
|
expectedName1 = 'common-test-test1-auth-forward'
|
||||||
|
expectedName2 = 'common-test-test1-auth-forward@kubernetescrd'
|
||||||
values = {
|
values = {
|
||||||
ingress: {
|
ingress: {
|
||||||
test1: {
|
test1: {
|
||||||
@@ -1008,8 +1009,8 @@ class Test < ChartTest
|
|||||||
refute_nil(resource('IngressRoute'))
|
refute_nil(resource('IngressRoute'))
|
||||||
jq('.spec.tls.domains[0].main', resource('IngressRoute')).must_equal values[:ingress][:test1][:hosts][0][:host]
|
jq('.spec.tls.domains[0].main', resource('IngressRoute')).must_equal values[:ingress][:test1][:hosts][0][:host]
|
||||||
jq('.spec.tls.secretName', resource('IngressRoute')).must_equal nil
|
jq('.spec.tls.secretName', resource('IngressRoute')).must_equal nil
|
||||||
jq('.metadata.name', resource('Middleware')).must_equal expectedName
|
jq('.metadata.name', resource('Middleware')).must_equal expectedName1
|
||||||
jq('.spec.routes[0].middlewares[1].name', resource('IngressRoute')).must_equal expectedName
|
jq('.spec.routes[0].middlewares[1].name', resource('IngressRoute')).must_equal expectedName2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
apiVersion: v2
|
apiVersion: v2
|
||||||
kubeVersion: ">=1.16.0-0"
|
kubeVersion: ">=1.16.0-0"
|
||||||
name: common
|
name: common
|
||||||
version: 3.5.2
|
version: 3.5.3
|
||||||
# upstream_version:
|
# upstream_version:
|
||||||
appVersion: none
|
appVersion: none
|
||||||
description: Function library for TrueCharts
|
description: Function library for TrueCharts
|
||||||
|
|||||||
@@ -30,11 +30,6 @@ of the main Ingress and any additionalIngresses.
|
|||||||
{{- include "common.classes.ingress" $ -}}
|
{{- include "common.classes.ingress" $ -}}
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
|
|
||||||
{{- if $ingressValues.authForwardURL -}}
|
|
||||||
{{- print ("---") | nindent 0 -}}
|
|
||||||
{{- include "common.classes.ingress.authForward" $ }}
|
|
||||||
{{ end -}}
|
|
||||||
|
|
||||||
{{- if eq $ingressValues.certType "ixcert" -}}
|
{{- if eq $ingressValues.certType "ixcert" -}}
|
||||||
{{- $_ := set $ "ObjectValues" (dict "certHolder" $ingressValues) -}}
|
{{- $_ := set $ "ObjectValues" (dict "certHolder" $ingressValues) -}}
|
||||||
{{- print ("---") | nindent 0 -}}
|
{{- print ("---") | nindent 0 -}}
|
||||||
@@ -74,11 +69,6 @@ of the main Ingress and any additionalIngresses.
|
|||||||
{{- include "common.classes.ingress" $ -}}
|
{{- include "common.classes.ingress" $ -}}
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
|
|
||||||
{{- if $ingressValues.authForwardURL -}}
|
|
||||||
{{- print ("---") | nindent 0 -}}
|
|
||||||
{{- include "common.classes.ingress.authForward" $ }}
|
|
||||||
{{ end -}}
|
|
||||||
|
|
||||||
{{- if eq $ingressValues.certType "ixcert" -}}
|
{{- if eq $ingressValues.certType "ixcert" -}}
|
||||||
{{- $_ := set $ "ObjectValues" (dict "certHolder" $ingressValues) -}}
|
{{- $_ := set $ "ObjectValues" (dict "certHolder" $ingressValues) -}}
|
||||||
{{- print ("---") | nindent 0 -}}
|
{{- print ("---") | nindent 0 -}}
|
||||||
@@ -121,11 +111,6 @@ of the main Ingress and any additionalIngresses.
|
|||||||
{{- print ("---") | nindent 0 -}}
|
{{- print ("---") | nindent 0 -}}
|
||||||
{{- include "common.classes.externalService" $ }}
|
{{- include "common.classes.externalService" $ }}
|
||||||
|
|
||||||
{{- if $ingressValues.authForwardURL -}}
|
|
||||||
{{- print ("---") | nindent 0 -}}
|
|
||||||
{{- include "common.classes.ingress.authForward" $ }}
|
|
||||||
{{ end -}}
|
|
||||||
|
|
||||||
{{- if eq $ingressValues.certType "ixcert" -}}
|
{{- if eq $ingressValues.certType "ixcert" -}}
|
||||||
{{- $_ := set $ "ObjectValues" (dict "certHolder" $ingressValues) -}}
|
{{- $_ := set $ "ObjectValues" (dict "certHolder" $ingressValues) -}}
|
||||||
{{- print ("---") | nindent 0 -}}
|
{{- print ("---") | nindent 0 -}}
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
{{/*
|
|
||||||
Renders the additional authForward objects from ingress
|
|
||||||
*/}}
|
|
||||||
{{- define "common.classes.ingress.authForward" -}}
|
|
||||||
{{- $authForwardName := include "common.names.fullname" . -}}
|
|
||||||
{{- $values := .Values -}}
|
|
||||||
{{- if hasKey . "ObjectValues" -}}
|
|
||||||
{{- with .ObjectValues.ingress -}}
|
|
||||||
{{- $values = . -}}
|
|
||||||
{{- end -}}
|
|
||||||
{{ end -}}
|
|
||||||
{{- if hasKey $values "nameSuffix" -}}
|
|
||||||
{{- $authForwardName = printf "%v-%v" $authForwardName $values.nameSuffix -}}
|
|
||||||
{{ end -}}
|
|
||||||
apiVersion: traefik.containo.us/v1alpha1
|
|
||||||
kind: Middleware
|
|
||||||
metadata:
|
|
||||||
name: {{ $authForwardName }}-auth-forward
|
|
||||||
spec:
|
|
||||||
forwardAuth:
|
|
||||||
address: {{ $values.authForwardURL | quote }}
|
|
||||||
tls:
|
|
||||||
insecureSkipVerify: true
|
|
||||||
trustForwardHeader: true
|
|
||||||
authResponseHeaders:
|
|
||||||
- Remote-User
|
|
||||||
- Remote-Groups
|
|
||||||
- Remote-Name
|
|
||||||
- Remote-Email
|
|
||||||
{{- end }}
|
|
||||||
@@ -14,6 +14,7 @@ within the common library.
|
|||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
|
|
||||||
|
|
||||||
{{- if hasKey $values "nameSuffix" -}}
|
{{- if hasKey $values "nameSuffix" -}}
|
||||||
{{- $ingressName = printf "%v-%v" $ingressName $values.nameSuffix -}}
|
{{- $ingressName = printf "%v-%v" $ingressName $values.nameSuffix -}}
|
||||||
{{- if and ( $.Values.services ) ( not $values.servicePort ) }}
|
{{- if and ( $.Values.services ) ( not $values.servicePort ) }}
|
||||||
@@ -52,7 +53,7 @@ metadata:
|
|||||||
traefik.ingress.kubernetes.io/service.serversscheme: https
|
traefik.ingress.kubernetes.io/service.serversscheme: https
|
||||||
{{- end }}
|
{{- end }}
|
||||||
traefik.ingress.kubernetes.io/router.entrypoints: {{ $values.entrypoint | default "websecure" }}
|
traefik.ingress.kubernetes.io/router.entrypoints: {{ $values.entrypoint | default "websecure" }}
|
||||||
traefik.ingress.kubernetes.io/router.middlewares: traefik-middlewares-chain-public@kubernetescrd{{ if $values.authForwardURL }},{{ $ingressName }}-auth-forward{{ end }}
|
traefik.ingress.kubernetes.io/router.middlewares: traefik-middlewares-chain-public@kubernetescrd{{ if $values.authForwardURL }},{{ $ingressName }}-auth-forward@kubernetescrd{{ end }}
|
||||||
{{- with $values.annotations }}
|
{{- with $values.annotations }}
|
||||||
{{- toYaml . | nindent 4 }}
|
{{- toYaml . | nindent 4 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
@@ -115,4 +116,26 @@ spec:
|
|||||||
servicePort: {{ $svcPort }}
|
servicePort: {{ $svcPort }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
|
{{- if $values.authForwardURL }}
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
apiVersion: traefik.containo.us/v1alpha1
|
||||||
|
kind: Middleware
|
||||||
|
metadata:
|
||||||
|
name: {{ $ingressName }}-auth-forward
|
||||||
|
spec:
|
||||||
|
forwardAuth:
|
||||||
|
address: {{ $values.authForwardURL | quote }}
|
||||||
|
tls:
|
||||||
|
insecureSkipVerify: true
|
||||||
|
trustForwardHeader: true
|
||||||
|
authResponseHeaders:
|
||||||
|
- Remote-User
|
||||||
|
- Remote-Groups
|
||||||
|
- Remote-Name
|
||||||
|
- Remote-Email
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ spec:
|
|||||||
middlewares:
|
middlewares:
|
||||||
- name: traefik-middlewares-chain-public@kubernetescrd
|
- name: traefik-middlewares-chain-public@kubernetescrd
|
||||||
{{- if $values.authForwardURL }}
|
{{- if $values.authForwardURL }}
|
||||||
- name: "{{ $ingressName }}-auth-forward"
|
- name: "{{ $ingressName }}-auth-forward@kubernetescrd"
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
@@ -102,4 +102,24 @@ spec:
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
|
{{- if $values.authForwardURL }}
|
||||||
|
---
|
||||||
|
|
||||||
|
apiVersion: traefik.containo.us/v1alpha1
|
||||||
|
kind: Middleware
|
||||||
|
metadata:
|
||||||
|
name: {{ $ingressName }}-auth-forward
|
||||||
|
spec:
|
||||||
|
forwardAuth:
|
||||||
|
address: {{ $values.authForwardURL | quote }}
|
||||||
|
tls:
|
||||||
|
insecureSkipVerify: true
|
||||||
|
trustForwardHeader: true
|
||||||
|
authResponseHeaders:
|
||||||
|
- Remote-User
|
||||||
|
- Remote-Groups
|
||||||
|
- Remote-Name
|
||||||
|
- Remote-Email
|
||||||
|
|
||||||
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|||||||
Reference in New Issue
Block a user