Skip to content

Add TTL support for temporary BMC users#798

Draft
stefanhipfel wants to merge 1 commit intomainfrom
feature/bmcuser-ttl
Draft

Add TTL support for temporary BMC users#798
stefanhipfel wants to merge 1 commit intomainfrom
feature/bmcuser-ttl

Conversation

@stefanhipfel
Copy link
Copy Markdown
Contributor

This commit adds automatic expiration functionality for BMCUser resources, enabling temporary users for debugging, maintenance windows, and temporary access scenarios.

Features:

  • Dual expiration approach: TTL (relative) and ExpiresAt (absolute)
  • Immutable expiration time (calculated once at creation)
  • Automatic cleanup of both K8s objects and BMC accounts
  • Warning period with condition changes (Active -> ExpiringSoon -> Expired)

This commit adds automatic expiration functionality for BMCUser resources,
enabling temporary users for debugging, maintenance windows, and temporary
access scenarios.

Features:
- Dual expiration approach: TTL (relative) and ExpiresAt (absolute)
- Immutable expiration time (calculated once at creation)
- Automatic cleanup of both K8s objects and BMC accounts
- Warning period with condition changes (Active -> ExpiringSoon -> Expired)
- Smart requeue coordination with password rotation
- Webhook validation for mutual exclusivity and valid values
- Fully backward compatible with existing permanent users

API Changes:
- Added TTL and ExpiresAt fields to BMCUserSpec (mutually exclusive)
- Added ExpiresAt and Conditions to BMCUserStatus
- Added condition constants and types
- Added ExpiresAt printer column for kubectl output

Controller Changes:
- Implemented expiration calculation (once at creation)
- Implemented expiration checking and automatic deletion
- Implemented condition management with warning periods
- Coordinated requeue timing between rotation and expiration
- Added Conditions accessor to BMCUserReconciler

Webhook Changes:
- Created BMCUser validation webhook
- Validates mutual exclusivity of TTL/ExpiresAt
- Validates future dates and reasonable values
- Warns on changes to immutable fields

Testing:
- Added 4 comprehensive unit tests for TTL functionality
- All 105/105 tests passing
- Test coverage maintained

Documentation:
- Added comprehensive usage guide (docs/usage/bmcuser-ttl.md)
- Added examples for debugging, maintenance, and vendor access
- Updated README.md with Features section
- Linked documentation in VitePress navigation
- Added sample YAMLs for temporary users

Files modified:
- api/v1alpha1/bmcuser_types.go
- internal/controller/bmcuser_controller.go
- internal/controller/bmcuser_controller_test.go
- internal/controller/suite_test.go
- cmd/main.go
- config/crd/bases/metal.ironcore.dev_bmcusers.yaml
- config/webhook/manifests.yaml
- dist/chart/templates/* (Helm chart updates)
- README.md
- docs/.vitepress/config.mts

Files added:
- internal/webhook/v1alpha1/bmcuser_webhook.go
- config/samples/metal_v1alpha1_bmcuser_temporary.yaml
- docs/usage/bmcuser-ttl.md
@github-actions github-actions bot added size/XXL api-change documentation Improvements or additions to documentation enhancement New feature or request labels Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-change area/metal-automation documentation Improvements or additions to documentation enhancement New feature or request size/XXL

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants