Skip to content

feat(helm): Add support for external authentication #2104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 17, 2025

Conversation

adutra
Copy link
Contributor

@adutra adutra commented Jul 15, 2025

No description provided.

@github-project-automation github-project-automation bot moved this to PRs In Progress in Basic Kanban Board Jul 15, 2025
@adutra adutra force-pushed the helm-auth branch 2 times, most recently from 6bbb635 to 062e54b Compare July 16, 2025 08:39
*/}}
{{- define "polaris.dictToString" -}}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The template polaris.dictToString was unused.

{{- $_ = 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)) -}}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

@adutra adutra Jul 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another option is to output the hash the realm ID. It's safer, but less readable. Lmk if that's preferable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

urlquery LGTM 👍

{{- end -}}

{{/*
Convert a dict into a string formed by a comma-separated list of key-value pairs: key1=value1,key2=value2, ...
Escapes a property key to be used in a configmap, conforming with the Java parsisng rules for
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We were missing until now a proper escape mechanism for config option keys. Before this change, any realm containing a key termination character such as a space or =, would produce invalid configuration.

@adutra adutra marked this pull request as ready for review July 16, 2025 12:00
@adutra adutra requested a review from MonkeyCanCode July 16, 2025 12:00
Copy link
Contributor

@dimas-b dimas-b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall 👍

tokenService:
type: default
# -- The type of token broker to use. Two built-in types are supported: rsa-key-pair and symmetric-key.
# -- The `TokenBroker` implementation to use. Two built-in types are supported: rsa-key-pair and symmetric-key.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: TokenBroker is not applicable to the "external" auth type, right? Should we support disabling it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tokenBroker and tokenService are indeed only relevant when using internal (or mixed) authentication.

Setting these options when using external auth doesn't hurt, but in practice, the configmap won't even contain those config options if the authentication type is external.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, thx for the explanation!.. I missed that behaviour 🤦

client:
# -- The client ID to use when authenticating with the authentication server.
id: polaris
# -- The secret to pull the client secret from.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: the OIDC secret is optional, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. If secret.name is nil, no client secret is included in the configuration. This follows a pattern that is already used for other secrets.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we could mention that in the doc comment for clarity? Current text feels like the secret might be required 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I seized the opportunity to clarify tokenBroker and tokenService as well.

dimas-b
dimas-b previously approved these changes Jul 16, 2025
Copy link
Contributor

@dimas-b dimas-b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@github-project-automation github-project-automation bot moved this from PRs In Progress to Ready to merge in Basic Kanban Board Jul 16, 2025
@@ -189,21 +189,24 @@ ct install --namespace polaris --charts ./helm/polaris
|-----|------|---------|-------------|
| advancedConfig | object | `{}` | Advanced configuration. You can pass here any valid Polaris or Quarkus configuration property. Any property that is defined here takes precedence over all the other configuration values generated by this chart. Properties can be passed "flattened" or as nested YAML objects (see examples below). Note: values should be strings; avoid using numbers, booleans, or other types. |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we copy this to site/content/in-dev/unreleased/helm.md as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MonkeyCanCode isn't this copy done automatically? Or should I make a manual copy-paste?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay I copied the file manually. We should look into automate this.

Copy link
Contributor

@MonkeyCanCode MonkeyCanCode Jul 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the automation is in the Makefile which is still under review: #2027 (make helm-doc-generate)

MonkeyCanCode
MonkeyCanCode previously approved these changes Jul 16, 2025
@@ -336,3 +427,33 @@ tests:
asserts:
- matchRegex: { path: 'data["application.properties"]', pattern: "polaris.tasks.max-concurrent-tasks=10" }
- matchRegex: { path: 'data["application.properties"]', pattern: "polaris.tasks.max-queued-tasks=20" }

- it: should configure OIDC
Copy link
Contributor

@MonkeyCanCode MonkeyCanCode Jul 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not in the scope of this PR. But we should add the doc for OIDC #1327 and have some docker compose with it (e.g. keycloak?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adutra adutra dismissed stale reviews from MonkeyCanCode and dimas-b via 0683d92 July 17, 2025 07:58
@adutra adutra requested review from MonkeyCanCode and dimas-b July 17, 2025 13:54
@adutra adutra merged commit 46a2a03 into apache:main Jul 17, 2025
12 checks passed
@github-project-automation github-project-automation bot moved this from Ready to merge to Done in Basic Kanban Board Jul 17, 2025
@adutra adutra deleted the helm-auth branch July 17, 2025 21:15
adam-christian-software pushed a commit to adam-christian-software/polaris that referenced this pull request Jul 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants