fix(operator): standardize secret references to custom SecretKeyRef#4580
Open
mvanhorn wants to merge 1 commit intostacklok:mainfrom
Open
fix(operator): standardize secret references to custom SecretKeyRef#4580mvanhorn wants to merge 1 commit intostacklok:mainfrom
mvanhorn wants to merge 1 commit intostacklok:mainfrom
Conversation
Replace corev1.SecretKeySelector with the custom SecretKeyRef type across all MCPRegistry CRD fields. This aligns MCPRegistry with the 5 other CRDs that already use SecretKeyRef, removing the inconsistent corev1.SecretKeySelector usage before the API stabilizes. Changes: - Convert 5 fields in mcpregistry_types.go to SecretKeyRef - Decouple secrets.GetValue from corev1 by accepting name/key strings - Update all callers and test fixtures The JSON wire format is identical for both types, so existing manifests continue to work without changes. Fixes stacklok#4540
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4580 +/- ##
==========================================
+ Coverage 68.87% 68.92% +0.05%
==========================================
Files 505 505
Lines 52380 52389 +9
==========================================
+ Hits 36076 36111 +35
+ Misses 13516 13490 -26
Partials 2788 2788 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Summary
MCPRegistry was the only CRD using
corev1.SecretKeySelectorfor secret references. The other 5 CRDs all use the customSecretKeyReftype. This PR standardizes MCPRegistry to match, converting 5 fields before the API stabilizes.Why this matters
The
corev1.SecretKeySelectortype carries an unusedOptional *boolfield that no controller code checks. The customSecretKeyRefis simpler (justName+Key, both required) and already used by 13+ fields across other CRDs. Standardizing now avoids a breaking change later.Changes
mcpregistry_types.go: Convert 5 fields fromcorev1.SecretKeySelectortoSecretKeyRef(preserving pointer semantics for optional fields)secrets.go: DecoupleGetValuefromcorev1by acceptingnameandkeyas separate string parameterspgpass.go,config.go,podtemplatespec.go: Update callers for the new signaturescorev1.SecretKeySelector{LocalObjectReference: ...}constructors with simplerSecretKeyRef{Name: ..., Key: ...}The JSON wire format is identical (
{"name": "...", "key": "..."}) so existing manifests work without changes.Testing
task genafter merge (deepcopy and OpenAPI schema updates)Fixes #4540
This contribution was developed with AI assistance (Codex).