Skip to content

feat: implement importKeycloakUsers endpoint for migrating Keycloak users to Dex - #1141

Merged
CasLubbers merged 2 commits into
mainfrom
APL-2301
Dec 1, 2026
Merged

CasLubbers merged 2 commits into
mainfrom
APL-2301

Conversation

@CasLubbers

@CasLubbers CasLubbers commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Created 4 teams, 3 users. Assigned to multiple teams. While still being on keycloak. Then migrated to Dex. Logged in with the platform-admin. On the maintenance page the import keycloak users button is visable. Once you press it, it will import the users and return the ones imported.
Together with:
linode/apl-console#888

…sers to Dex

Signed-off-by: Cas Lubbers <clubbers@akamai.com>
Copilot AI balanced review requested due to automatic review settings November 26, 2026 11:02
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Coverage report

St.❔
Category Percentage Covered / Total
🟡 Statements
61.05% (+0.24% 🔼)
3077/5040
🔴 Branches
47.64% (+0.2% 🔼)
907/1904
🔴 Functions
55.05% (+0.43% 🔼)
452/821
🟡 Lines
60.35% (+0.25% 🔼)
2811/4658
Show new covered files 🐣
St.❔
File Statements Branches Functions Lines
🟢
... / maintenance.ts
100% 100% 100% 100%
Show files with reduced coverage 🔻
St.❔
File Statements Branches Functions Lines
🔴 k8s-operations.ts
38.7% (+0.07% 🔼)
35.29% (-0.26% 🔻)
47.62% (-1.16% 🔻)
38.16% (+0.08% 🔼)

Test suite run success

921 tests passing in 32 suites.

Report generated by 🧪jest coverage report action from 5832ea2

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Direct tests are missing for the secret reader’s error propagation, the listing helper’s empty-array fallback, and successful secret decoding and filtering, leaving cluster failures at risk of appearing as successful empty imports.

1 open issue
What changed in this PR

Adds a platform-admin-only maintenance endpoint to migrate users from Keycloak-backed Kubernetes secrets into Dex, supporting the authentication-provider transition.

Changes:

  • Imports users with new passwords and existing team memberships, returning per-user outcomes.
  • Separates strict secret reading from the existing error-tolerant listing helper.
  • Adds response schemas, model types, and migration and authorization tests.
File Description
src/​otomi-stack.ts Implements migration guards, user provisioning, and per-user results.
src/​otomi-stack.test.ts Tests migration outcomes, repeat runs, and provider guards.
src/​otomi-models.ts Exports migration response types.
src/​openapi/​keycloakUserImport.yaml Defines results and platform-admin access.
src/​openapi/​api.yaml Registers the maintenance endpoint and response schema.
src/​k8s-operations.ts Extracts a secret reader that propagates failures.
src/​api/​v1/​maintenance.ts Adds the migration request handler.
src/​api.authz.test.ts Tests platform-admin access and team-role denial.
eslint.config.mjs Excludes .claude from linting.

Review effort: Balanced

Comment thread src/k8s-operations.ts Resolved
@CasLubbers
CasLubbers added this pull request to stack #1143 November 27, 2026 11:49
@CasLubbers
CasLubbers merged commit a905519 into main Dec 1, 2026
8 checks passed
@CasLubbers
CasLubbers deleted the APL-2301 branch December 1, 2026 17:44
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.

4 participants