mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 07:27:21 +00:00
Merge pull request #46151 from verb/kubectl-featuregate
Automatic merge from submit-queue Add alpha command to kubectl Also allow new commands to disable themselves by returning a nil value. This can be used to disable commands based on feature gates. **What this PR does / why we need it**: Method of enabling alpha functionality in kubectl **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: ref #45922 **Special notes for your reviewer**: Part of a discussion in #45922 with @pwittrock **Release note**: ```release-note NONE ```
This commit is contained in:
@@ -360,6 +360,13 @@ func NewKubectlCommand(f cmdutil.Factory, in io.Reader, out, err io.Writer) *cob
|
||||
"options",
|
||||
deprecated("kubectl", "delete", cmds, NewCmdStop(f, out)),
|
||||
}
|
||||
|
||||
// Hide the "alpha" subcommand if there are no alpha commands in this build.
|
||||
alpha := NewCmdAlpha(f, in, out, err)
|
||||
if !alpha.HasSubCommands() {
|
||||
filters = append(filters, alpha.Name())
|
||||
}
|
||||
|
||||
templates.ActsAsRootCommand(cmds, filters, groups...)
|
||||
|
||||
for name, completion := range bash_completion_flags {
|
||||
@@ -374,6 +381,7 @@ func NewKubectlCommand(f cmdutil.Factory, in io.Reader, out, err io.Writer) *cob
|
||||
}
|
||||
}
|
||||
|
||||
cmds.AddCommand(alpha)
|
||||
cmds.AddCommand(cmdconfig.NewCmdConfig(clientcmd.NewDefaultPathOptions(), out, err))
|
||||
cmds.AddCommand(NewCmdPlugin(f, in, out, err))
|
||||
cmds.AddCommand(NewCmdVersion(f, out))
|
||||
|
||||
Reference in New Issue
Block a user