OSAC-1594: Auto-resolve KUBECONFIG for enclave CLI commands#512
Conversation
|
Warning Review limit reached
More reviews will be available in 23 minutes and 19 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?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 credits. 🚦 How do rate 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 see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (4)
WalkthroughAdds kubeconfig resolution during Click startup, wires the custom group into both CLI entrypoints, creates an enclave kubeconfig symlink through Ansible deployment and migration tasks, and updates tests for fallback and missing-kubeconfig cases. ChangesKubeconfig Bootstrap
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 10 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (10 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
34d1013 to
a12bb3e
Compare
When KUBECONFIG is not set, enclave reconcile and enclave tools now try ~/.config/enclave/kubeconfig (a symlink created by the deploy playbook) before failing with a clear error message. The check is implemented via KubeconfigGroup(click.Group), overriding parse_args() so --help and shell-completion are not affected. The deploy playbook creates the symlink at install time: ~/.config/enclave/kubeconfig -> <workingDir>/ocp-cluster/auth/kubeconfig Added a migration so that 0.1.0 will also have the symlink Signed-off-by: Rafa Porres Molina <rporresm@redhat.com> Assisted-by: Claude Code <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/enclave/utils.py`:
- Around line 60-68: The parse_args method in the enclave command group is
forcing setup_kubeconfig() even when the user invoked the group with no
subcommand, which breaks Click’s implicit help behavior. Update parse_args in
src/enclave/utils.py so the kubeconfig setup and KubeconfigNotFoundError
handling only run when args is non-empty and no help flag is present, preserving
the default help path for bare enclave commands.
🪄 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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 38cdfcca-15f2-458c-ad3c-86933e8eae8c
📒 Files selected for processing (10)
playbooks/03-deploy.yamlplaybooks/tasks/migrations.yamlplaybooks/tasks/migrations/setup_enclave_kubeconfig_symlink.yamlplaybooks/tasks/setup_enclave_kubeconfig_symlink.yamlsrc/enclave/reconcile/cli.pysrc/enclave/tools/cli.pysrc/enclave/utils.pysrc/tests/test_cli.pysrc/tests/test_tools_cli.pysrc/tests/test_utils.py
When `enclave reconcile` or `enclave reconcile <subcommand>` was called with no arguments, the kubeconfig validation in KubeconfigGroup fired before Click had a chance to display the help page, producing a confusing KUBECONFIG error instead. Fix by inverting the order in KubeconfigGroup.parse_args: call super().parse_args() first so Click populates ctx.args with the subcommand's own arguments, then only validate kubeconfig when ctx.args is non-empty (meaning a subcommand will actually run). An empty ctx.args means Click is about to show help, so the check is skipped. Also add no_args_is_help=True to all subcommands in reconcile and tools CLIs so a bare subcommand invocation prints its help page rather than a usage error about missing required options. Signed-off-by: Rafa Porres Molina <rporresm@redhat.com> Assisted-by: Claude Code <noreply@anthropic.com>
When KUBECONFIG is not set, enclave reconcile and enclave tools now try ~/.config/enclave/kubeconfig (a symlink created by the deploy playbook) before failing with a clear error message.
The check is implemented via KubeconfigGroup(click.Group), overriding parse_args() so --help and shell-completion are not affected.
The deploy playbook creates the symlink at install time:
~/.config/enclave/kubeconfig -> /ocp-cluster/auth/kubeconfig
Added a migration so that 0.1.0 will also have the symlink
Summary by CodeRabbit
New Features
Bug Fixes