Skip to content

Commit

Permalink
feat: don't use nonchars in variable name (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakeyheath authored Sep 17, 2024
1 parent cd2c559 commit ac47ece
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
6 changes: 1 addition & 5 deletions stack/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,10 @@ app.kubernetes.io/instance: {{ .Release.Name }}
{{ join "." (list (include "oidcProxy.name" .) (include "clusterBaseDomain" .)) }}
{{- end -}}

{{- define "oidcProxy.skipAuth" -}}
{{- $id := printf "%s_%s" (.method |lower) (.path | replace "/" "") }}
{{ $id }}
{{- end -}}

{{- define "oidcProxy.skipAuthConfig" -}}
{{- range $k, $v := .Values.global.oidcProxy.skipAuth -}}
{{- $id := printf "%s_%s" ($v.method |lower) ($v.path | replace "/" "")}}
{{- $id := regexReplaceAll "\\W+" $id "_" -}}
{{- $var_name := printf "%s_%s" "skip_auth" $id }}
set {{ $var_name }} 1;

Expand Down
15 changes: 15 additions & 0 deletions stack/tests/ingress_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ tests:
skipAuth:
- path: /healthz
method: GET
- path: /api/*
method: "*"
services:
service1:
ingress:
Expand All @@ -84,3 +86,16 @@ tests:
if ( skip_auth_get_healthz ) {
return 200;
}
set skip_auth___api_ 1;
if ( $request_uri !~ "/api/*" ) {
set skip_auth___api_ 0;
}
if ( $request_method !~ "*" ) {
set skip_auth___api_ 0;
}
if ( skip_auth___api_ ) {
return 200;
}

0 comments on commit ac47ece

Please sign in to comment.