fix(operator): rename BackendAuthType enum value to camelCase#4563
fix(operator): rename BackendAuthType enum value to camelCase#4563tmchow wants to merge 5 commits intostacklok:mainfrom
Conversation
The enum value "external_auth_config_ref" was the only snake_case discriminator in the CRD codebase. All other values use camelCase (tokenExchange, headerInjection, bearerToken, etc.). This renames it to "externalAuthConfigRef" for consistency before the API stabilizes. Updated the constant, kubebuilder validation markers, CEL rules, converter logic, and all test fixtures. CRD manifests and API docs regenerated. Fixes stacklok#4542
|
|
||
| // BackendAuthTypeExternalAuthConfigRef references an MCPExternalAuthConfig resource | ||
| BackendAuthTypeExternalAuthConfigRef = "external_auth_config_ref" | ||
| BackendAuthTypeExternalAuthConfigRef = "externalAuthConfigRef" |
There was a problem hiding this comment.
Blocker: it looks like this is used as an enum value. Changing the value will cause existing CRDs to break. Please introduce a DeprecatedBackendAuthTypeExternalAuthConfigRef = external_auth_config_ref so that we can still handle the old CRDs correctly. We should log.Warn that this old value is deprecated whenever it's used.
There was a problem hiding this comment.
Was this something you were ok to release as a breaking change now, or something you wanted a gradual rollout of? @jerm-dro
There was a problem hiding this comment.
Is the cost of the deprecation approach low? If so, I'd prefer to deprecate instead of break.
There was a problem hiding this comment.
Added DeprecatedBackendAuthTypeExternalAuthConfigRef constant, updated kubebuilder enum to accept both values, updated validation switch. lmk if i misunderstood
There was a problem hiding this comment.
This looks like what I was imagining. I think you'll need to regenerate some stuff. We'll also want to log a warning about the deprecation when the deprecated value is used.
Keep the old "external_auth_config_ref" value as DeprecatedBackendAuthTypeExternalAuthConfigRef so existing CRDs continue to validate. The kubebuilder enum and validation switch now accept both the new camelCase and deprecated snake_case values.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #4563 +/- ##
==========================================
+ Coverage 68.86% 68.91% +0.05%
==========================================
Files 505 505
Lines 52320 52387 +67
==========================================
+ Hits 36028 36105 +77
+ Misses 13504 13492 -12
- Partials 2788 2790 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
The enum value `external_auth_config_ref` was the only snake_case type discriminator in the CRD codebase. Every other value uses camelCase (`tokenExchange`, `headerInjection`, `bearerToken`, `embeddedAuthServer`, `awsSts`, etc.). Renamed to `externalAuthConfigRef` for consistency before the API moves past v1alpha1.
Changes:
Build, lint (0 issues), and compilation all pass.
Fixes #4542