-
Notifications
You must be signed in to change notification settings - Fork 6
feat(developer-portal-fe): render config.yaml from a pass-through values block #345
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
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
11a599d
feat(developer-portal-fe): render config.yaml from a pass-through val…
jarvis9443 ff309cd
chore(developer-portal-fe): upgrade the application to 0.14.0
jarvis9443 4c16feb
docs(developer-portal-fe): say the chart-owned settings are merged ov…
jarvis9443 862398f
docs(agents): record the helm-docs version trap and the portal chart'…
jarvis9443 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,3 +21,5 @@ | |
| .idea/ | ||
| *.tmproj | ||
| .vscode/ | ||
| README.md.gotmpl | ||
| ci/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,125 @@ | ||
| {{ template "chart.header" . }} | ||
|
|
||
| {{ template "chart.badgesSection" . }} | ||
|
|
||
| {{ template "chart.description" . }} | ||
|
|
||
| {{ template "chart.maintainersSection" . }} | ||
|
|
||
| {{ template "chart.requirementsSection" . }} | ||
|
|
||
| ## Install | ||
|
|
||
| ```sh | ||
| helm repo add api7 https://charts.api7.ai | ||
| helm repo update | ||
|
|
||
| helm install developer-portal-fe api7/developer-portal-fe --namespace api7 --create-namespace | ||
| ``` | ||
|
|
||
| ## Configuring the portal application | ||
|
|
||
| The chart renders the application's `config.yaml` from `developerPortal.config`: | ||
| the block is copied into the file as it is written, and the connection settings | ||
| below are then merged over it. Any field the application's config schema accepts | ||
| can be set there — `app.name`, `app.desc`, `auth.emailAndPassword`, | ||
| `auth.genericOAuthProviders`, `db.ssl`, and so on — without waiting for a chart | ||
| release. Which fields exist depends on the deployed application version | ||
| (`developerPortal.image.tag`). | ||
|
|
||
| These are the paths the chart owns. They are merged in last, so they always win | ||
| over `developerPortal.config` and setting them there has no effect: | ||
|
|
||
| | Config path | Comes from | | ||
| | :--- | :--- | | ||
| | `portal.url` | `portal.url` | | ||
| | `portal.token` | `${PORTAL_TOKEN}` — Secret (`portal.existingSecret`) | | ||
| | `db.url` | `${DB_URL}` — Secret (`db.existingSecret`) | | ||
| | `auth.secret` | `${AUTH_SECRET}` — Secret (`auth.existingSecret`) | | ||
| | `app.baseURL`, `app.trustedOrigins` | `app.baseURL`, `app.trustedOrigins` | | ||
|
|
||
| Changing `developerPortal.config` rolls the Pods automatically — the Deployment | ||
| carries a checksum of the rendered ConfigMap. | ||
|
|
||
| ### Keep credentials out of the ConfigMap | ||
|
|
||
| `developerPortal.config` is rendered into a ConfigMap, so it is the wrong place | ||
| for a client secret or a database password. The application substitutes | ||
| `${VAR}` and `${VAR:default}` in every string value of `config.yaml` at startup, | ||
| so put a placeholder in the config and inject the real value as an environment | ||
| variable with `developerPortal.extraEnvVars`: | ||
|
|
||
| ```yaml | ||
| developerPortal: | ||
| config: | ||
| auth: | ||
| genericOAuthProviders: | ||
| - providerId: keycloak | ||
| discoveryUrl: https://sso.example.com/realms/main/.well-known/openid-configuration | ||
| clientId: devportal | ||
| clientSecret: ${OIDC_CLIENT_SECRET} | ||
| extraEnvVars: | ||
| - name: OIDC_CLIENT_SECRET | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: devportal-oidc | ||
| key: client-secret | ||
| ``` | ||
|
|
||
| A missing variable is a startup error, not an empty string — the Pod fails | ||
| fast instead of running with a blank secret. | ||
|
|
||
| ### Examples | ||
|
|
||
| Name and describe the portal: | ||
|
|
||
| ```yaml | ||
| developerPortal: | ||
| config: | ||
| app: | ||
| name: "Example APIs" | ||
| desc: "Everything you need to build on Example." | ||
| ``` | ||
|
|
||
| Turn off password sign-in and require two-factor authentication: | ||
|
|
||
| ```yaml | ||
| developerPortal: | ||
| config: | ||
| auth: | ||
| emailAndPassword: | ||
| enabled: false | ||
| twoFactor: | ||
| enabled: true | ||
| required: true | ||
| ``` | ||
|
|
||
| Connect to a managed PostgreSQL that requires TLS, in its own schema: | ||
|
|
||
| ```yaml | ||
| developerPortal: | ||
| config: | ||
| db: | ||
| schema: portal | ||
| ssl: | ||
| rejectUnauthorized: true | ||
| ca: ${DB_CA_PEM} | ||
| pool: | ||
| max: 30 | ||
| min: 2 | ||
| ``` | ||
|
|
||
| {{ template "chart.valuesSection" . }} | ||
|
|
||
| ## Upgrading | ||
|
|
||
| ### To 0.2.0 | ||
|
|
||
| The bundled application moves from 0.5.7 to 0.14.0, which requires `auth.secret` | ||
| to be at least 32 characters — a shorter secret fails validation at startup. | ||
| Rotate it before upgrading (`openssl rand -base64 32`); rotating signs existing | ||
| users out, so they will have to sign in again. | ||
|
|
||
| `auth.socialProviders` is the one config field to avoid on this application | ||
| version: its schema is mis-declared upstream and the Pod fails to start when the | ||
| field is set. Use `auth.genericOAuthProviders` instead. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| # Renders every part of the Developer Portal config surface through | ||
| # developerPortal.config, so a template change that breaks the pass-through is | ||
| # caught by `ct lint`. Credentials are ${ENV} placeholders on purpose — that is | ||
| # the documented way to keep them out of the ConfigMap. | ||
| portal: | ||
| url: "https://api7-developer-portal:4321" | ||
|
|
||
| app: | ||
| baseURL: "https://portal.example.com" | ||
| trustedOrigins: | ||
| - "https://portal.example.com" | ||
|
|
||
| developerPortal: | ||
| config: | ||
| db: | ||
| schema: portal | ||
| pool: | ||
| max: 30 | ||
| min: 2 | ||
| idleTimeout: 60000 | ||
| connectionTimeout: 5000 | ||
| allowExitOnIdle: false | ||
| ssl: | ||
| rejectUnauthorized: true | ||
| ca: ${DB_CA_PEM} | ||
| auth: | ||
| adminUserIds: | ||
| - usr_admin | ||
| session: | ||
| expiresIn: 604800 | ||
| updateAge: 86400 | ||
| emailAndPassword: | ||
| enabled: false | ||
| requireEmailVerification: true | ||
| revokeSessionsOnPasswordReset: true | ||
| twoFactor: | ||
| enabled: true | ||
| required: true | ||
| # auth.socialProviders is deliberately absent: the application's own | ||
| # schema mis-declares it and fails to parse a config that sets it | ||
| # (fixed after 0.14.0). genericOAuthProviders covers the same ground. | ||
| genericOAuthProviders: | ||
| - providerId: keycloak | ||
| discoveryUrl: https://sso.example.com/realms/main/.well-known/openid-configuration | ||
| clientId: devportal | ||
| clientSecret: ${OIDC_CLIENT_SECRET} | ||
| scopes: ["openid", "profile", "email"] | ||
| sso: | ||
| providers: | ||
| - providerId: keycloak | ||
| domains: | ||
| - '@example\.com$' | ||
| app: | ||
| name: "Example APIs" | ||
| desc: "Everything you need to build on Example." | ||
| signUpConsentLabel: 'I agree to the <a href="https://example.com/tos">Terms</a>.' | ||
| applicationDetail: | ||
| subscriptions: true | ||
| usage: false | ||
| credentialsTabs: | ||
| keyAuth: true | ||
| basicAuth: false | ||
| oauth: false | ||
| apiHub: | ||
| enabled: true | ||
| extraEnvVars: | ||
| - name: DB_CA_PEM | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: devportal-db-ca | ||
| key: ca.crt | ||
| - name: OIDC_CLIENT_SECRET | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: devportal-oidc | ||
| key: client-secret |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.