feat: implement secret mgmt apis#955
Draft
andyatmiami wants to merge 1 commit intokubeflow:notebooks-v2from
Draft
feat: implement secret mgmt apis#955andyatmiami wants to merge 1 commit intokubeflow:notebooks-v2from
andyatmiami wants to merge 1 commit intokubeflow:notebooks-v2from
Conversation
feat: implement secret mgmt apis
Replace stub/mock secret repository with real Kubernetes API interactions
and add a metadata-only cache for listing secrets safely.
Business logic:
- CRUD operations using controller-runtime client against real K8s Secrets
- Label-based access control: can-update=true required for PUT/DELETE
- 3-way update semantics: set (base64 provided), preserve (empty {}),
or delete (key omitted) individual secret keys
- Cross-reference resolution: list response includes workspaces that
mount each secret via buildSecretMountMap()
- Created secrets automatically labeled with can-mount=true and
can-update=true
- Secret values are never returned in any API response
Metadata-only cache:
- Disable default controller-runtime Secret caching (memory/security)
- Add BuildSecretMetadataClient() using PartialObjectMetadata informer
so only ObjectMeta is held in memory, not secret data values
- List endpoint uses metadata cache; Get/Create/Update/Delete use
direct API calls
- Comment out Type/Immutable from SecretListItem (not available from
PartialObjectMetadata) with TODO to discuss resolution
Handler fixes:
- Reorder UpdateSecretHandler: validate body before auth check
- Add ErrSecretNotCanUpdate → 400 handling to Update and Delete
- Add apierrors.IsInvalid → 422 handling to Create and Update
- Fix Swagger annotations (@param body type, missing @failure codes)
Tests:
- Rewrite secrets_handler_test.go with 28 test cases covering CRUD,
label-based access control, cross-references, empty lists, and
K8s state verification
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Andy Stoneberg <astonebe@redhat.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
closes: #844
Replace stub/mock secret repository with real Kubernetes API interactions and add a metadata-only cache for listing secrets safely.
Business logic:
Metadata-only cache:
Handler fixes:
Tests: