Skip to content

Commit

Permalink
Add option to configure forward-auth automatically (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
travisgroth authored Jan 9, 2020
1 parent 47fd130 commit c7206d2
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 58 deletions.
2 changes: 1 addition & 1 deletion Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
name: pomerium
version: 4.1.3
version: 4.1.4
appVersion: 0.5.2
home: http://www.pomerium.io/
icon: https://www.pomerium.io/logo.svg
Expand Down
114 changes: 58 additions & 56 deletions README.md

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -215,3 +215,7 @@ Adapted from : https://github.com/helm/charts/blob/master/stable/drone/templates
{{- end -}}


{{/*Expand the FQDN of the forward-auth endpoint.*/}}
{{- define "pomerium.forwardAuth.name" -}}
{{- default (printf "forwardauth.%s" .Values.config.rootDomain ) .Values.forwardAuth.nameOverride -}}
{{- end -}}
3 changes: 3 additions & 0 deletions templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ data:
tracing_jaeger_agent_endpoint: {{ required "agent_endpoint is required for jaeger tracing" .Values.tracing.jaeger.agent_endpoint }}
{{- end -}}

{{- end -}}
{{- if .Values.forwardAuth.enabled }}
forward_auth_url: https://{{ template "pomerium.forwardAuth.name" . }}
{{- end -}}
{{- if .Values.config.policy }}
policy:
Expand Down
12 changes: 11 additions & 1 deletion templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ spec:
hosts:
- {{ printf "authorize.%s" .Values.config.rootDomain | quote }}
- {{ printf "authenticate.%s" .Values.config.rootDomain | quote }}
- {{ template "pomerium.forwardAuth.name" . }}
{{- if not .Values.ingress.hosts }}
{{- range .Values.config.policy }}
- {{ .from | trimPrefix "https://" | trimPrefix "http://" | quote }}
Expand All @@ -36,7 +37,7 @@ spec:
serviceName: {{ template "pomerium.proxy.fullname" $ }}
servicePort: https
{{- end }}
{{- if not .Values.ingress.hosts }}
{{- if not (or .Values.ingress.hosts .Values.forwardAuth.enabled) }}
{{- range .Values.config.policy }}
- host: {{ .from | trimPrefix "https://" | trimPrefix "http://" | quote }}
http:
Expand All @@ -47,6 +48,15 @@ spec:
servicePort: https
{{- end }}
{{- end }}
{{- if .Values.forwardAuth.enabled }}
- host: {{ template "pomerium.forwardAuth.name" . }}
http:
paths:
- paths:
backend:
serviceName: {{ template "pomerium.proxy.fullname" . }}
servicePort: https
{{- end }}
{{- if not .Values.service.authorize.headless }}
- host: {{ printf "authorize.%s" .Values.config.rootDomain }}
http:
Expand Down
4 changes: 4 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ proxy:
authorizeServiceUrl: ""
authorizeInternalUrl: ""

forwardAuth:
nameOverride: ""
enabled: false

service:
# Service type can be set to ClusterIP, NodePort or LoadBalancer.
authorize:
Expand Down

0 comments on commit c7206d2

Please sign in to comment.