Skip to content

Add support for hashed usernames in configuration and resource naming#153

Open
jawadqur wants to merge 2 commits into
masterfrom
feat/hashed-usernames
Open

Add support for hashed usernames in configuration and resource naming#153
jawadqur wants to merge 2 commits into
masterfrom
feat/hashed-usernames

Conversation

@jawadqur
Copy link
Copy Markdown
Contributor

@jawadqur jawadqur commented May 15, 2026

Link to JIRA ticket if there is one: https://ctds-planx.atlassian.net/browse/PD-147

Addresses: #144

New Features

This PR adds support for generating Kubernetes-safe resource names from hashed usernames when Config.Config.HashedUsername is enabled.

When enabled, Hatchery hashes the incoming username and uses the hashed value when generating Kubernetes resources such as pods, services, mappings, and PVCs. This avoids failures caused by long or Kubernetes-incompatible usernames, for example OIDC sub values that exceed Kubernetes label or resource-name length limits after escaping.

The original username is still used for user identity and request/auth semantics where appropriate, but Kubernetes resource names are generated from the safe hashed username.

Breaking Changes

⚠️ Migration warning: enabling or disabling this setting changes the derived Kubernetes resource names for users. As a result, Hatchery will create new PVCs for users instead of reusing PVCs created under the previous naming scheme. Existing persistent workspace drives will not be automatically attached to the newly named resources and may appear to be lost unless migrated manually.

Bug Fixes

Improvements

Dependency updates

Deployment changes

@github-actions
Copy link
Copy Markdown

Integration Tests

Test summary after running integration tests

filepath passed failed SUBTOTAL
tests/test_discoverypage.py 1 0 1
tests/test_workspace.py 0 1 1
TOTAL 1 1 2

Test summary after rerunning failed integration tests

filepath passed SUBTOTAL
tests/test_workspace.py 1 1
TOTAL 1 1

Please find the detailed integration test report here

Please find the detailed integration test report after rerunning failed tests here

Please find the Github Action logs here

Copy link
Copy Markdown
Contributor

@paulineribeyre paulineribeyre left a comment

Choose a reason for hiding this comment

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

🎉

Comment thread hatchery/config.go
type HatcheryConfig struct {
UserNamespace string `json:"user-namespace"`
DefaultPayModel PayModel `json:"default-pay-model"`
HashedUsernames bool `json:"hashed-usernames"`
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.

could you update the config docs and the PR description, making sure to mention that users' previous persistent drives are lost when this setting is changed

Added documentation for 'hashed-usernames' configuration option in Hatchery settings, including its implications on Kubernetes resource naming and PVC management.
@github-actions
Copy link
Copy Markdown

Integration Tests

filepath passed SUBTOTAL
tests/test_discoverypage.py 1 1
tests/test_workspace.py 1 1
TOTAL 2 2

Please find the detailed integration test report here

Please find the Github Action logs here

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.

2 participants