adutra commented on code in PR #2104: URL: https://github.com/apache/polaris/pull/2104#discussion_r2209821926
########## helm/polaris/templates/_helpers.tpl: ########## @@ -317,3 +300,74 @@ ports: protocol: {{ get $protocols $portName }} {{- end }} {{- end -}} + +{{/* +Sets the configmap authentication options for a given realm. +*/}} +{{- define "polaris.authenticationOptions" -}} +{{- $realm := index . 0 -}} +{{- $map := index . 1 -}} +{{- $auth := index . 2 -}} +{{- $global := index . 3 -}} +{{- $prefix := empty $realm | ternary "polaris.authentication" (printf "polaris.authentication.\"%s\"" $realm) -}} +{{- $authType := coalesce $auth.type "internal" -}} +{{- if and (ne $authType "internal") (ne $authType "mixed") (ne $authType "external") -}} +{{- fail (empty $realm | ternary "authentication.type: invalid authentication type" (printf "authentication.realmOverrides.\"%s\".type: invalid authentication type" $realm)) -}} +{{- end -}} +{{- $_ := set $map (printf "%s.type" $prefix) $authType -}} +{{- $_ = set $map (printf "%s.authenticator.type" $prefix) (dig "authenticator" "type" "default" $auth) -}} +{{- $_ = set $map (printf "%s.active-roles-provider.type" $prefix) (dig "activeRolesProvider" "type" "default" $auth) -}} +{{- $_ = set $map (printf "%s.active-roles-provider.type" $prefix) (dig "activeRolesProvider" "type" "default" $auth) -}} +{{- if (or (eq $authType "mixed") (eq $authType "internal")) -}} +{{- $tokenBrokerType := dig "tokenBroker" "type" "rsa-key-pair" $auth -}} +{{- $_ = set $map (printf "%s.token-service.type" $prefix) (dig "tokenService" "type" "default" $auth) -}} +{{- $_ = set $map (printf "%s.token-broker.type" $prefix) $tokenBrokerType -}} +{{- $_ = set $map (printf "%s.token-broker.max-token-generation" $prefix) (dig "tokenBroker" "maxTokenGeneration" "PT1H" $auth) -}} +{{- $secretName := dig "tokenBroker" "secret" "name" "" $auth -}} +{{- if $secretName -}} +{{- $subpath := empty $realm | ternary "" (printf "%s/" (urlquery $realm)) -}} Review Comment: This is a best-effort to produce valid filesystem paths if the realm ID contains weird characters. The only function available in Helm that vaguely serves this purpose is `urlquery`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@polaris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org