feat(cozyctl): add CLI tool for managing Cozystack applications#2088
feat(cozyctl): add CLI tool for managing Cozystack applications#2088
Conversation
Introduce the cozyctl CLI tool for managing Cozystack applications from the terminal. This initial commit includes: - main.go entry point - Cobra root command with --kubeconfig, --context, -n flags - K8s client factory (typed + dynamic) with namespace resolution Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
Discover ApplicationDefinitions from the cluster and build a lookup registry by plural/singular/kind names for dynamic resource resolution. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
Output formatting for applications, namespaces, modules, PVCs, secrets, services, ingresses, and workload monitors. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
Dispatch logic for all resource types: - Built-in: ns, modules, pvc - Sub-resources: secrets, services, ingresses, workloads with -t flag - Application types via dynamic ApplicationDefinition discovery Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
VM interaction commands that resolve application type to VM name via ApplicationDefinition discovery and exec virtctl for the actual work. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
Add cozyctl build target and cross-platform asset packaging targets following the same pattern as cozypkg. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the 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 |
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 introduces 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. Changelog
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.
Code Review
This pull request introduces cozyctl, a new CLI tool designed for managing Cozystack applications. The changes include updates to the Makefile for building and packaging the cozyctl binary across different platforms, and a comprehensive set of new Go files implementing the CLI's functionality. The CLI leverages Cobra for command-line parsing and interacts with the Kubernetes API to manage various resource types, including dynamically discovered application definitions. It also provides specialized commands for Virtual Machine interactions by integrating with virtctl. The code is well-structured, follows standard Go and Cobra CLI practices, and includes appropriate error handling and input validation. Overall, the implementation is robust and well-designed.
Summary
Introduce
cozyctl— a CLI tool for managing Cozystack applications from the terminal.cozyctl getcommand with dynamic resource type resolution from ApplicationDefinitions-t type/namefiltering via label selectorsconsole,vnc,migrate,port-forward(delegate tovirtctl)Commands
cozyctl get <type> [name]cozyctl get secrets -t postgres/mydbcozyctl console <type> <name>cozyctl vnc <type> <name>cozyctl migrate <type> <name>cozyctl port-forward <type/name> [ports]Test plan
go build ./cmd/cozyctl/...compiles successfullygo vet ./cmd/cozyctl/...passescozyctl --helpshows all commandscozyctl get --helpshows resource types and flagscozyctl get nsagainst a running clustercozyctl get <app-type> -n <ns>against a running clustercozyctl get secrets -t <type>/<name>against a running cluster