refactor: centralize kubeconfig authentication handling#322
Conversation
|
Warning Review limit reached
Next review available in: 47 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughAdds ChangesKubeConfig auth field centralization
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #322 +/- ##
==========================================
+ Coverage 0.00% 23.77% +23.77%
==========================================
Files 4 101 +97
Lines 26 4214 +4188
Branches 0 774 +774
==========================================
+ Hits 0 1002 +1002
- Misses 26 3081 +3055
- Partials 0 131 +131 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/main/kotlin/com/redhat/devtools/gateway/kubeconfig/KubeConfigUpdate.kt`:
- Around line 117-133: The auth switch helpers in KubeConfigUpdate should also
clear the file-path certificate fields, not just the data fields. Update
setTokenAuthentication and setClientCertificateAuthentication to remove
client-certificate and client-key alongside
token/client-certificate-data/client-key-data, using the existing
Utils.removeValue calls so an existing kubeconfig is fully converted to the new
auth mode. Keep the fix localized to these helper methods so
KubeConfigUser.fromMap() entries are normalized regardless of whether they were
created from file paths or inline PEM data.
- Around line 126-133: The client certificate auth path in
setClientCertificateAuthentication is writing raw PEM into the same
user.client-certificate-data and user.client-key-data fields that
CreateContextWithClientCert produces via KubeConfigUser.toMap(), so the
persisted kubeconfig shape is inconsistent. Update this helper to encode the
certificate and key content the same way the create path does before calling
Utils.setValue, and keep removing user.token afterward so both create and update
flows store matching base64 inline data.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Enterprise
Run ID: a0c6e9ba-6c9b-4c5d-9e6a-ea3942a88351
📒 Files selected for processing (2)
src/main/kotlin/com/redhat/devtools/gateway/kubeconfig/KubeConfigEntries.ktsrc/main/kotlin/com/redhat/devtools/gateway/kubeconfig/KubeConfigUpdate.kt
4fd8b92 to
f53e3eb
Compare
adietish
left a comment
There was a problem hiding this comment.
great work. LGTM. I added a commit on top where I extracted constants and added tests.
53aaee0 to
42ffcaf
Compare
Signed-off-by: msivasubramaniaan <msivasub@redhat.com>
Signed-off-by: Andre Dietisheim <adietish@redhat.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
42ffcaf to
19921cc
Compare
Fix: https://redhat.atlassian.net/browse/CRW-11310