Remove backwards-compatible authentication config#537
Remove backwards-compatible authentication config#537ambient-code[bot] wants to merge 4 commits intomainfrom
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
✅ Deploy Preview for jumpstarter-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
CI Status UpdateThe pytest failure in This PR only modifies:
The failing test is a macOS-specific Python test that validates bash substring syntax in hook execution. This is not touched by any of the authentication config removal changes. The test expects the output Is this a known flaky test on macOS, or should we investigate further? |
….7.0) Remove the legacy `authentication` configmap key and `authenticationConfig` Helm value that were kept for backwards compatibility with a TODO to remove in 0.7.0. The project is now past v0.8.1, so this cleanup is overdue. Also removes the now-unused `oidc.LoadAuthenticationConfiguration` function and updates documentation to reference the current config approach. Closes #530 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The extractOIDCConfigs() function in controller/cmd/main.go still had a fallback block reading configmap.Data["authentication"], which was missed during the initial cleanup. This removes that legacy path so the function only reads from the "config" key, consistent with the rest of this PR. Also improves error handling by logging parse errors instead of silently swallowing them. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
7adea6f to
d26f745
Compare
raballew
left a comment
There was a problem hiding this comment.
Thanks for addressing the legacy fallback removal. The code changes look correct and complete: the authentication key fallback is fully removed from both extractOIDCConfigs() and LoadConfiguration(), the unused oidc/config.go is cleanly deleted, and the Helm chart and docs are updated consistently.
One previous concern remains open: there are still no tests for extractOIDCConfigs(). See inline comment for details.
Table-driven tests verify that extractOIDCConfigs() only reads from the "config" key in the ConfigMap, and that the legacy "authentication" key is no longer used. Covers valid parsing, localhost skipping, missing keys, invalid YAML, and missing ConfigMap scenarios. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update: Added tests for
|
| { | ||
| name: "legacy authentication key only should NOT produce OIDC configs", | ||
| configmap: &corev1.ConfigMap{ | ||
| ObjectMeta: metav1.ObjectMeta{ | ||
| Name: "jumpstarter-controller", | ||
| Namespace: "default", | ||
| }, | ||
| Data: map[string]string{ | ||
| "authentication": ` | ||
| jwt: | ||
| - issuer: | ||
| url: "https://dex.example.com" | ||
| audiences: | ||
| - "jumpstarter" | ||
| claimMappings: | ||
| username: | ||
| claim: "email" | ||
| prefix: "" | ||
| `, | ||
| }, | ||
| }, | ||
| wantNil: true, | ||
| }, |
There was a problem hiding this comment.
[LOW] The table-driven case "legacy authentication key only should NOT produce OIDC configs" (lines 103-125) tests the exact same scenario as the dedicated TestExtractOIDCConfigsIgnoresLegacyKey function (lines 246-283): both create a ConfigMap with only the legacy authentication key, call extractOIDCConfigs, and assert nil. This adds maintenance cost without extra coverage.
Consider removing one of the two. If you want the regression test to stand out, keep the dedicated function and drop the table-driven case (or vice versa).
AI-generated, human reviewed
There was a problem hiding this comment.
Good catch -- the table-driven case and the dedicated TestExtractOIDCConfigsIgnoresLegacyKey function are indeed testing the same scenario. I will remove the table-driven case and keep the dedicated function since its name and doc comment make the regression intent clearer.
| } | ||
|
|
||
| return nil | ||
| return jwtAuthenticatorsToOIDCConfigs(cfg.Authentication.JWT) |
There was a problem hiding this comment.
[MEDIUM] Now that oidc.LoadAuthenticationConfiguration has been removed, the AuthenticationConfiguration API type in controller/api/v1alpha1/authenticationconfiguration_types.go appears to be unreferenced by any Go code. It is still registered in the scheme via init() and has generated deep copy functions in zz_generated.deepcopy.go, making it dead code.
AI-generated, human reviewed
There was a problem hiding this comment.
Correct observation -- with controller/internal/oidc/config.go deleted in this PR, the AuthenticationConfiguration type in controller/api/v1alpha1/authenticationconfiguration_types.go is no longer referenced by any Go code. However, removing it also requires regenerating zz_generated.deepcopy.go (via controller-gen) and updating the scheme registration, which expands the scope of this cleanup PR. I think this is better handled as a follow-up to keep the review surface contained. I will note it in the PR description and open a tracking issue.
Fix planAddressing @raballew's latest review:
CI: The e2e-tests failures ( |
The table-driven case "legacy authentication key only should NOT produce OIDC configs" duplicated the dedicated TestExtractOIDCConfigsIgnoresLegacyKey function. Keep the dedicated function for clearer regression intent. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
authenticationconfigmap key andauthenticationConfigHelm value that were kept for backwards compatibility, with TODO comments saying "remove in 0.7.0"oidc.LoadAuthenticationConfigurationfunction and its helpernewJWTAuthenticator(theconfigpackage has its own equivalent implementations that remain in use)authenticationfallback fromextractOIDCConfigs()incontroller/cmd/main.goso it only reads from theconfigkeyspec.authentication.jwton the Jumpstarter resource instead of the removedjumpstarter-controller.authenticationConfigurationHelm valueextractOIDCConfigs()covering valid parsing, legacy key regression, and error casesTestExtractOIDCConfigsIgnoresLegacyKey)Known follow-up
AuthenticationConfigurationtype incontroller/api/v1alpha1/authenticationconfiguration_types.gois now unreferenced after the removal ofoidc.LoadAuthenticationConfiguration. Removing it requires regeneratingzz_generated.deepcopy.goand updating scheme registration, so it will be handled in a separate PR to keep this one focused.Test plan
go build ./...passes in the controller module with no errorsgo test ./cmd/ -run TestExtractOIDCpasses with all test casesauthenticationConfigvalueconfigkey continue to workCloses #530
Generated with Claude Code