Skip to content

fix(operator): rename BackendAuthType enum value to camelCase#4563

Open
tmchow wants to merge 5 commits intostacklok:mainfrom
tmchow:fix/rename-backend-auth-type-camelcase
Open

fix(operator): rename BackendAuthType enum value to camelCase#4563
tmchow wants to merge 5 commits intostacklok:mainfrom
tmchow:fix/rename-backend-auth-type-camelcase

Conversation

@tmchow
Copy link
Copy Markdown
Contributor

@tmchow tmchow commented Apr 4, 2026

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:

  • Renamed the constant string value in `virtualmcpserver_types.go`
  • Updated kubebuilder validation Enum markers and CEL validation rules
  • Updated all test fixtures across 5 test files
  • Regenerated CRD manifests and API docs

Build, lint (0 issues), and compilation all pass.

Fixes #4542

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
@jerm-dro jerm-dro self-requested a review April 6, 2026 14:51

// BackendAuthTypeExternalAuthConfigRef references an MCPExternalAuthConfig resource
BackendAuthTypeExternalAuthConfigRef = "external_auth_config_ref"
BackendAuthTypeExternalAuthConfigRef = "externalAuthConfigRef"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this something you were ok to release as a breaking change now, or something you wanted a gradual rollout of? @jerm-dro

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the cost of the deprecation approach low? If so, I'd prefer to deprecate instead of break.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added DeprecatedBackendAuthTypeExternalAuthConfigRef constant, updated kubebuilder enum to accept both values, updated validation switch. lmk if i misunderstood

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@github-actions github-actions bot added the size/XS Extra small PR: < 100 lines changed label Apr 6, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 6, 2026

Codecov Report

❌ Patch coverage is 18.18182% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.91%. Comparing base (ffef243) to head (f831f0b).
⚠️ Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
cmd/thv-operator/pkg/vmcpconfig/converter.go 22.22% 6 Missing and 1 partial ⚠️
...hv-operator/api/v1alpha1/virtualmcpserver_types.go 0.00% 1 Missing and 1 partial ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions bot added size/XS Extra small PR: < 100 lines changed and removed size/XS Extra small PR: < 100 lines changed labels Apr 6, 2026
@github-actions github-actions bot added size/XS Extra small PR: < 100 lines changed and removed size/XS Extra small PR: < 100 lines changed labels Apr 6, 2026
@github-actions github-actions bot added size/XS Extra small PR: < 100 lines changed and removed size/XS Extra small PR: < 100 lines changed labels Apr 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XS Extra small PR: < 100 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rename BackendAuthType external_auth_config_ref to camelCase

3 participants