Skip to content

Commit

Permalink
Cleanup oc adm help for clarity
Browse files Browse the repository at this point in the history
Reduce the amount of sections, focus important commands at the top,
and clarify help text of some lesser used commands like certificate
and policy.
  • Loading branch information
smarterclayton committed Feb 11, 2019
1 parent ea3f0e4 commit 608d919
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 246 deletions.
110 changes: 0 additions & 110 deletions contrib/completions/bash/oc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

110 changes: 0 additions & 110 deletions contrib/completions/zsh/oc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 23 additions & 18 deletions pkg/oc/cli/admin/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ import (
var adminLong = ktemplates.LongDesc(`
Administrative Commands
Commands for managing a cluster are exposed here. Many administrative
actions involve interaction with the command-line client as well.`)
Actions for administering an OpenShift cluster are exposed here.`)

func NewCommandAdmin(name, fullName string, f kcmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command {
// Main command
Expand All @@ -63,35 +62,33 @@ func NewCommandAdmin(name, fullName string, f kcmdutil.Factory, streams genericc
Message: "Cluster Management:",
Commands: []*cobra.Command{
upgrade.New(f, fullName, streams),
release.NewCmd(f, fullName, streams),
},
},
{
Message: "Security and Policy:",
Commands: []*cobra.Command{
project.NewCmdNewProject(project.NewProjectRecommendedName, fullName+" "+project.NewProjectRecommendedName, f, streams),
policy.NewCmdPolicy(policy.PolicyRecommendedName, fullName+" "+policy.PolicyRecommendedName, f, streams),
groups.NewCmdGroups(groups.GroupsRecommendedName, fullName+" "+groups.GroupsRecommendedName, f, streams),
cert.NewCmdCert(cert.CertRecommendedName, fullName+" "+cert.CertRecommendedName, streams),
kubecmd.NewCmdCertificate(f, streams),
top.NewCommandTop(top.TopRecommendedName, fullName+" "+top.TopRecommendedName, f, streams),
},
},
{
Message: "Node Management:",
Commands: []*cobra.Command{
cmdutil.ReplaceCommandName("kubectl", fullName, kubecmd.NewCmdDrain(f, streams)),
cmdutil.ReplaceCommandName("kubectl", fullName, ktemplates.Normalize(kubecmd.NewCmdCordon(f, streams))),
cmdutil.ReplaceCommandName("kubectl", fullName, ktemplates.Normalize(kubecmd.NewCmdUncordon(f, streams))),
cmdutil.ReplaceCommandName("kubectl", fullName, kubecmd.NewCmdDrain(f, streams)),
cmdutil.ReplaceCommandName("kubectl", fullName, ktemplates.Normalize(kubecmd.NewCmdTaint(f, streams))),
network.NewCmdPodNetwork(network.PodNetworkCommandName, fullName+" "+network.PodNetworkCommandName, f, streams),
logs.NewCmdLogs(fullName, f, streams),
},
},
{
Message: "Security and Policy:",
Commands: []*cobra.Command{
project.NewCmdNewProject(project.NewProjectRecommendedName, fullName+" "+project.NewProjectRecommendedName, f, streams),
policy.NewCmdPolicy(policy.PolicyRecommendedName, fullName+" "+policy.PolicyRecommendedName, f, streams),
groups.NewCmdGroups(groups.GroupsRecommendedName, fullName+" "+groups.GroupsRecommendedName, f, streams),
withShortDescription(kubecmd.NewCmdCertificate(f, streams), "Approve or reject certificate requests"),
network.NewCmdPodNetwork(network.PodNetworkCommandName, fullName+" "+network.PodNetworkCommandName, f, streams),
},
},
{
Message: "Maintenance:",
Commands: []*cobra.Command{
prune.NewCommandPrune(prune.PruneRecommendedName, fullName+" "+prune.PruneRecommendedName, f, streams),
buildchain.NewCmdBuildChain(name, fullName+" "+buildchain.BuildChainRecommendedCommandName, f, streams),
migrate.NewCommandMigrate(
migrate.MigrateRecommendedName, fullName+" "+migrate.MigrateRecommendedName, f, streams,
// Migration commands
Expand All @@ -101,13 +98,12 @@ func NewCommandAdmin(name, fullName string, f kcmdutil.Factory, streams genericc
migratehpa.NewCmdMigrateLegacyHPA("legacy-hpa", fullName+" "+migrate.MigrateRecommendedName+" legacy-hpa", f, streams),
migratetemplateinstances.NewCmdMigrateTemplateInstances("template-instances", fullName+" "+migrate.MigrateRecommendedName+" template-instances", f, streams),
),
top.NewCommandTop(top.TopRecommendedName, fullName+" "+top.TopRecommendedName, f, streams),
verifyimagesignature.NewCmdVerifyImageSignature(name, fullName+" "+verifyimagesignature.VerifyRecommendedName, f, streams),
},
},
{
Message: "Configuration:",
Commands: []*cobra.Command{
cert.NewCmdCert(cert.CertRecommendedName, fullName+" "+cert.CertRecommendedName, streams),
admin.NewCommandCreateKubeConfig(admin.CreateKubeConfigCommandName, fullName+" "+admin.CreateKubeConfigCommandName, streams),
admin.NewCommandCreateClient(admin.CreateClientCommandName, fullName+" "+admin.CreateClientCommandName, streams),

Expand Down Expand Up @@ -152,6 +148,10 @@ func NewCommandAdmin(name, fullName string, f kcmdutil.Factory, streams genericc
}

cmds.AddCommand(
release.NewCmd(f, fullName, streams),
buildchain.NewCmdBuildChain(name, fullName+" "+buildchain.BuildChainRecommendedCommandName, f, streams),
verifyimagesignature.NewCmdVerifyImageSignature(name, fullName+" "+verifyimagesignature.VerifyRecommendedName, f, streams),

// part of every root command
kubectlwrappers.NewCmdConfig(fullName, "config", f, streams),
kubectlwrappers.NewCmdCompletion(fullName, streams),
Expand All @@ -166,3 +166,8 @@ func NewCommandAdmin(name, fullName string, f kcmdutil.Factory, streams genericc

return cmds
}

func withShortDescription(cmd *cobra.Command, desc string) *cobra.Command {
cmd.Short = desc
return cmd
}
2 changes: 1 addition & 1 deletion pkg/oc/cli/admin/cert/cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func NewCmdCert(name, fullName string, streams genericclioptions.IOStreams) *cob
// Parent command to which all subcommands are added.
cmds := &cobra.Command{
Use: name,
Short: "Manage certificates and keys",
Short: "Create CA certificates",
Long: `Manage certificates and keys`,
Run: cmdutil.DefaultSubCommandRun(streams.ErrOut),
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/oc/cli/admin/policy/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func NewCmdPolicy(name, fullName string, f cmdutil.Factory, streams genericcliop
// Parent command to which all subcommands are added.
cmds := &cobra.Command{
Use: name,
Short: "Manage policy",
Short: "Manage cluster authorization and security policy",
Long: policyLong,
Run: cmdutil.DefaultSubCommandRun(streams.ErrOut),
}
Expand Down
Loading

0 comments on commit 608d919

Please sign in to comment.