-
Notifications
You must be signed in to change notification settings - Fork 21
feat(commands): add rotate-ca command for CA rotation #101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Caution Review failedFailed to post review comments Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. 📝 WalkthroughWalkthroughIntroduces a global Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant CLI as rgba(64,128,255,0.5)
participant GlobalArgs as rgba(32,192,128,0.5)
participant CmdWrappers as rgba(255,160,64,0.5)
participant TalosClient as rgba(200,64,128,0.5)
participant K8sAPI as rgba(128,64,200,0.5)
participant FS as rgba(64,200,160,0.5)
CLI->>GlobalArgs: parse flags (--skip-verify)
CLI->>CmdWrappers: invoke rotate-ca / apply / template
GlobalArgs->>CmdWrappers: provide SkipVerify
alt SkipVerify == true
CmdWrappers->>TalosClient: WithClientSkipVerify(ctx)
else
CmdWrappers->>TalosClient: WithClientAuto(ctx)
end
TalosClient->>K8sAPI: list nodes / fetch CA / kubeconfig
K8sAPI-->>TalosClient: node list, certs, kubeconfig
TalosClient->>FS: write/update `secrets.yaml`, `talosconfig`
FS->>FS: call age encryption helpers (if encrypted files present)
FS-->>CLI: report results
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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 |
Summary of ChangesHello @kvaps, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a --skip-verify flag to disable TLS certificate verification, which is useful in certain networking scenarios. The implementation correctly adds the flag and integrates it into the apply and template commands. It also correctly warns users when the flag is used with unsupported wrapped talosctl commands.
My main feedback is about the implementation of WithClientSkipVerify in pkg/commands/root.go. This function contains a large amount of code that duplicates client setup logic from the talos library. This poses a significant maintainability risk. I've left a detailed comment with a suggestion to refactor this to improve maintainability by reusing more of the existing talos code.
2e3d05a to
d3cbd79
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
pkg/commands/template.go (1)
194-200: Missing--skip-verifyhandling intemplateWithFiles.The
templateWithFilesfunction (used when--fileis specified) doesn't checkGlobalArgs.SkipVerify. This means--skip-verifywon't work when runningtalm template --skip-verify -f node.yaml, which is inconsistent with the top-levelRunEand contradicts the test plan in the PR objectives.🔧 Proposed fix
if templateCmdFlags.offline { err = template(args)(context.Background(), nil) } else if templateCmdFlags.insecure { err = WithClientMaintenance(nil, template(args)) + } else if GlobalArgs.SkipVerify { + err = WithClientSkipVerify(template(args)) } else { err = WithClient(template(args)) }
c1dc4e2 to
e456203
Compare
Add new rotate-ca command that: - Discovers all cluster nodes via Kubernetes API - Verifies connectivity to all nodes via Talos API - Rotates Talos and/or Kubernetes CAs - Updates talosconfig, secrets.yaml, and kubeconfig - Automatically updates encrypted versions of config files Also refactor encryption logic into encryption_helpers.go: - SaveTalosconfigWithEncryption() - SaveSecretsBundleWithEncryption() - UpdateKubeconfigEncryption() Co-Authored-By: Claude <[email protected]> Signed-off-by: Andrei Kvapil <[email protected]>
e456203 to
a690118
Compare
Summary
rotate-cacommand for Talos and Kubernetes CA rotationRefactoring
encryption_helpers.go:SaveTalosconfigWithEncryption()SaveSecretsBundleWithEncryption()UpdateKubeconfigEncryption()Test plan
talm rotate-ca --talosfor Talos CA rotationtalm rotate-ca --kubernetesfor Kubernetes CA rotationSummary by CodeRabbit
New Features
Bug Fixes / Improvements
Chores
✏️ Tip: You can customize this high-level summary in your review settings.