fix(operator): standardize secret references to custom SecretKeyRef#4580
fix(operator): standardize secret references to custom SecretKeyRef#4580mvanhorn wants to merge 1 commit into
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:
|
|
hello @mvanhorn ! Thanks for submitting the PR to standardize the Secret references. With the recent migration to beta, most of these fields were converted to Out of those, only |
|
Thanks for the update @reyortiz3 - confirmed on Happy to rescope this PR to just that one field once @ChrisJBurns weighs in on whether it should be converted. If the answer is "leave it as |
|
hey @mvanhorn yeah I think we may want to close this PR. I raised it initially and I think sticking to the selector is probably a good shout because its standardising using the corev1 etc. sorry for the hassle on this! |
|
Makes sense @ChrisJBurns - with most fields already converted to |
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).