Skip to content

fix: command in karmadactl create should be karmadactl instead of kubectl#7545

Open
FAUST-BENCHOU wants to merge 1 commit into
karmada-io:masterfrom
FAUST-BENCHOU:fix/kubectl-example
Open

fix: command in karmadactl create should be karmadactl instead of kubectl#7545
FAUST-BENCHOU wants to merge 1 commit into
karmada-io:masterfrom
FAUST-BENCHOU:fix/kubectl-example

Conversation

@FAUST-BENCHOU
Copy link
Copy Markdown
Contributor

What type of PR is this?

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #7542

Special notes for your reviewer:

Does this PR introduce a user-facing change?:


Copilot AI review requested due to automatic review settings May 23, 2026 09:47
@karmada-bot karmada-bot requested a review from chaosi-zju May 23, 2026 09:47
@karmada-bot
Copy link
Copy Markdown
Contributor

[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 zhzhuang-zju for approval. For more information see the 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

@karmada-bot karmada-bot requested a review from yanfeng1992 May 23, 2026 09:47
@karmada-bot karmada-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label May 23, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR adds richer create subcommand help output by introducing per-subcommand Example strings and wiring a recursive helper to apply them across the cobra command tree.

Changes:

  • Added example text blocks for many create subcommands (namespace, quota, configmap, RBAC, ingress, secrets, services, etc.).
  • Introduced a createSubcommandExamples lookup map keyed by subcommand name.
  • Added setCreateSubcommandExamples to recursively set subCmd.Example during NewCmdCreate.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/karmadactl/create/create.go
Comment on lines +48 to +50
namespaceExample = templates.Examples(`
# Create a new namespace named my-namespace
%[1]s create namespace my-namespace`)
Comment on lines +59 to +61
configMapExample = templates.Examples(`
# Create a new config map named my-config based on folder bar
%[1]s create configmap my-config --from-file=path/to/bar
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

no need we have solved it with a no-tty

Comment thread pkg/karmadactl/create/create.go
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a 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 comprehensive set of example strings for various karmadactl create subcommands and implements a recursive function, setCreateSubcommandExamples, to apply these examples to the command hierarchy. Feedback was provided regarding a formatting bug in the podDisruptionBudgetExample where a percentage sign needs to be escaped to prevent fmt.Sprintf errors. Additionally, it was recommended to add a documentation comment to the new setCreateSubcommandExamples function to align with maintainability best practices.

Comment thread pkg/karmadactl/create/create.go Outdated
Comment thread pkg/karmadactl/create/create.go
…ectl

Signed-off-by: zhoujinyu <2319109590@qq.com>
@FAUST-BENCHOU FAUST-BENCHOU force-pushed the fix/kubectl-example branch from 53acb8d to 57604bd Compare May 23, 2026 09:55
@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 42.05%. Comparing base (4be77ca) to head (57604bd).

Files with missing lines Patch % Lines
pkg/karmadactl/create/create.go 0.00% 6 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7545      +/-   ##
==========================================
- Coverage   42.08%   42.05%   -0.04%     
==========================================
  Files         879      879              
  Lines       54619    54625       +6     
==========================================
- Hits        22986    22971      -15     
- Misses      29911    29927      +16     
- Partials     1722     1727       +5     
Flag Coverage Δ
unittests 42.05% <0.00%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@XiShanYongYe-Chang
Copy link
Copy Markdown
Member

cc @zhzhuang-zju

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Example command in website of karmadactl create is kubectl instead of karmadactl

5 participants