Skip to content

feat(ctl): add YAML output support to kmeshctl dump#1746

Open
Psykii22 wants to merge 4 commits into
kmesh-net:mainfrom
Psykii22:feature/kmeshctl-yaml-dump
Open

feat(ctl): add YAML output support to kmeshctl dump#1746
Psykii22 wants to merge 4 commits into
kmesh-net:mainfrom
Psykii22:feature/kmeshctl-yaml-dump

Conversation

@Psykii22

Copy link
Copy Markdown

What type of PR is this?

/kind feature

What this PR does / why we need it

Currently, kmeshctl dump supports 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 using sigs.k8s.io/yaml, providing an experience consistent with common Kubernetes tooling such as kubectl.

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?

Added support for the `-o yaml` flag in `kmeshctl dump`, enabling daemon configuration output in YAML format.

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>
Copilot AI review requested due to automatic review settings June 11, 2026 20:26
@kmesh-bot kmesh-bot requested review from hzxuzhonghu and nlgwcy June 11, 2026 20:26
@kmesh-bot

Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign bitcoffeeiux for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@kmesh-bot

Copy link
Copy Markdown
Collaborator

Welcome @Psykii22! It looks like this is your first PR to kmesh-net/kmesh 🎉

@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello, 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

  • YAML Output Support: Added support for the -o yaml flag in the kmeshctl dump command to provide a more human-readable configuration format.
  • CLI Flag Update: Updated the help description for the output flag to include yaml as a valid option.
  • JSON to YAML Conversion: Integrated sigs.k8s.io/yaml to handle the conversion of existing JSON output into YAML format.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

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 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.

Comment thread ctl/dump/dump.go
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>
Copilot AI review requested due to automatic review settings June 11, 2026 21:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Signed-off-by: Psykii22 <189542486+Psykii22@users.noreply.github.com>
Signed-off-by: Psykii22 <189542486+Psykii22@users.noreply.github.com>
@Psykii22 Psykii22 force-pushed the feature/kmeshctl-yaml-dump branch from 05f1c6d to 6086be1 Compare June 14, 2026 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants