feat(ctl): add YAML output support to kmeshctl dump#1746
Conversation
Add support for -o yaml to kmeshctl dump by converting the daemon's JSON configuration dump to YAML using sigs.k8s.io/yaml. This provides a structured output format commonly used across the Kubernetes ecosystem alongside the existing table and JSON outputs. Signed-off-by: Psykii22 <189542486+Psykii22@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Welcome @Psykii22! It looks like this is your first PR to kmesh-net/kmesh 🎉 |
Summary of ChangesHello, 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 kmeshctl dump command by introducing YAML output support. By allowing users to view daemon configurations in YAML, the tool becomes more consistent with standard Kubernetes CLI patterns and improves readability for complex configuration data. Highlights
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 the 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 counterproductive. 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. Data in tables, JSON too, / Now YAML joins the view. / A readable sight, / To make things right, / For all the work we do. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds support for a "yaml" output format to the kmeshctl dump command by converting the JSON response body using sigs.k8s.io/yaml. Feedback on the changes suggests improving error handling during the YAML conversion: instead of exiting with os.Exit(1) when conversion fails, the code should log the error and fall back to printing the raw response body, which ensures that non-JSON error messages from the daemon are still visible to the user.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
This commit resolves the make gen-check CI failure by regenerating the kmeshctl dump markdown file to include the newly added yaml output format. Also fixes trailing whitespace in the source file. Signed-off-by: Psykii22 <189542486+Psykii22@users.noreply.github.com>
Signed-off-by: Psykii22 <189542486+Psykii22@users.noreply.github.com>
e4aa459 to
5fd95ab
Compare
Signed-off-by: Psykii22 <189542486+Psykii22@users.noreply.github.com>
05f1c6d to
6086be1
Compare
What type of PR is this?
/kind feature
What this PR does / why we need it
Currently,
kmeshctl dumpsupports output in table format or raw JSON only. While JSON is useful for machine processing, it can be difficult to read when inspecting large configurations.This PR adds support for
-o yaml, allowing users to view the daemon's configuration in a more human-readable format. The implementation converts the existing JSON output into YAML usingsigs.k8s.io/yaml, providing an experience consistent with common Kubernetes tooling such askubectl.Special notes for your reviewer
The implementation has been tested locally against a Kind cluster, and the output is rendered correctly in YAML format.
Please let me know if any additional changes or tests are needed.
Does this PR introduce a user-facing change?