Skip to content

Commit

Permalink
chore(ux): improve help messages and some logs
Browse files Browse the repository at this point in the history
- Improve help messages adding missing subcommands in the main summary
and details where missing.
- Fix some outdate information in help messages.
- Improve the redaction of some of the help messages.
- Improve some log messages that were giving information that the user
does not care about.
  • Loading branch information
ralgozino committed Dec 5, 2024
1 parent e8fb961 commit 5f0260e
Show file tree
Hide file tree
Showing 16 changed files with 31 additions and 30 deletions.
18 changes: 9 additions & 9 deletions cmd/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func NewApplyCmd() *cobra.Command {

applyCmd := &cobra.Command{
Use: "apply",
Short: "Apply the configuration to create or upgrade a battle-tested Kubernetes Fury cluster",
Short: "Apply the configuration to create, update, or upgrade a battle-tested Kubernetes Fury cluster",
PreRun: func(cmd *cobra.Command, _ []string) {
cmdEvent = analytics.NewCommandEvent(cobrax.GetFullname(cmd))

Expand Down Expand Up @@ -299,7 +299,7 @@ func NewApplyCmd() *cobra.Command {
return fmt.Errorf("error while creating cluster: %w", err)
}

cmdEvent.AddSuccessMessage("cluster creation succeeded")
cmdEvent.AddSuccessMessage("apply configuration succeeded")
tracker.Track(cmdEvent)

return nil
Expand Down Expand Up @@ -432,15 +432,15 @@ func setupCreateClusterCmdFlags(cmd *cobra.Command) {
cmd.Flags().String(
"start-from",
"",
"Start the execution from a specific phase. Options are: pre-infrastructure, infrastructure, post-infrastructure, pre-kubernetes, "+
"Start the execution from a specific phase and continue with the following phases. Options are: pre-infrastructure, infrastructure, post-infrastructure, pre-kubernetes, "+
"kubernetes, post-kubernetes, pre-distribution, distribution, post-distribution, plugins",
)

cmd.Flags().StringP(
"distro-location",
"",
"",
"Location where to download schemas, defaults and the distribution manifests from. "+
"Location where to download schemas, defaults, and the distribution manifests from. "+
"It can either be a local path (eg: /path/to/fury/distribution) or "+
"a remote URL (eg: git::[email protected]:sighupio/fury-distribution?depth=1&ref=BRANCH_NAME). "+
"Any format supported by hashicorp/go-getter can be used.",
Expand All @@ -467,7 +467,7 @@ func setupCreateClusterCmdFlags(cmd *cobra.Command) {
cmd.Flags().Bool(
"skip-nodes-upgrade",
false,
"On kind OnPremises this will skip the upgrade of the nodes",
"On kind OnPremises, this will skip the upgrade of the nodes upgrading only the control-plane",
)

cmd.Flags().Bool(
Expand Down Expand Up @@ -504,7 +504,7 @@ func setupCreateClusterCmdFlags(cmd *cobra.Command) {
cmd.Flags().StringSlice(
"force",
[]string{},
"WARNING: furyctl won't ask for confirmation and will proceed applying upgrades and reducers. Options are: all, upgrades, migrations, pods-running-check",
"WARNING: furyctl won't ask for confirmation and will proceed applying upgrades and migrations. Options are: all, upgrades, migrations, pods-running-check",
)

cmd.Flags().StringSlice(
Expand All @@ -528,19 +528,19 @@ func setupCreateClusterCmdFlags(cmd *cobra.Command) {
cmd.Flags().Bool(
"upgrade",
false,
"When set will run the upgrade scripts",
"When set will run the upgrade scripts, allowing to upgrade from one version to another one in the supported upgrade paths. See available target versions with 'get upgrade-paths'",
)

cmd.Flags().StringP(
"upgrade-path-location",
"",
"",
"Location where the upgrade scripts are located, if not set the embedded ones will be used",
"Set to use a custom location for the upgrade scripts instead of the embedded ones",
)

cmd.Flags().String(
"upgrade-node",
"",
"On kind OnPremises this will upgrade a specific node",
"On kind OnPremises, this will upgrade one specific node passed as parameter",
)
}
2 changes: 1 addition & 1 deletion cmd/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func NewCompletionCmd() *cobra.Command {

completionCmd := &cobra.Command{
Use: "completion [bash|zsh|fish|powershell]",
Short: "Generate completion script",
Short: "Generate completion script for your shell",
Long: `To load furyctl completions:
Bash:
Expand Down
4 changes: 2 additions & 2 deletions cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func NewClusterCmd() *cobra.Command {

clusterCmd := &cobra.Command{
Use: "cluster",
Short: "Apply the configuration to create or upgrade a battle-tested Kubernetes Fury cluster",
Short: "Apply the configuration to create, update, or upgrade a battle-tested Kubernetes Fury cluster. Note: 'create cluster' is an alias of 'apply'.",
PreRun: applyCmd.PreRun,
RunE: applyCmd.RunE,
}
Expand All @@ -28,7 +28,7 @@ func NewClusterCmd() *cobra.Command {
func NewCreateCmd() *cobra.Command {
createCmd := &cobra.Command{
Use: "create",
Short: "Create a cluster or a sample configuration file",
Short: "Create a cluster, a sample configuration file, or the PKI needed for an on-premises cluster",
}

createCmd.AddCommand(NewClusterCmd())
Expand Down
5 changes: 3 additions & 2 deletions cmd/create/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ func NewConfigCmd() *cobra.Command {
var cmdEvent analytics.Event

configCmd := &cobra.Command{
Use: "config",
Short: "Scaffolds a new furyctl configuration file",
Use: "config",
Short: "Scaffolds a new furyctl configuration file for a specific version and kind",
Example: "furyctl create config --kind OnPremises --version 1.30.0 --name test-cluster",
PreRun: func(cmd *cobra.Command, _ []string) {
cmdEvent = analytics.NewCommandEvent(cobrax.GetFullname(cmd))

Expand Down
2 changes: 1 addition & 1 deletion cmd/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
func NewDumpCmd() *cobra.Command {
dumpCmd := &cobra.Command{
Use: "dump",
Short: "Dump manifests templates and other useful KFD objects",
Short: "Dump rendered templates and other useful KFD objects to the filesystem",
}

dumpCmd.AddCommand(dump.NewTemplateCmd())
Expand Down
2 changes: 1 addition & 1 deletion cmd/dump/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func NewTemplateCmd() *cobra.Command {

templateCmd := &cobra.Command{
Use: "template",
Short: "Renders the distribution's infrastructure code from template files and a configuration file",
Short: "Renders the distribution's code from template files parametrized with the configuration file",
Long: `Generates a folder with the Terraform and Kustomization code for deploying the Kubernetes Fury Distribution into a cluster.
The generated folder will be created starting from a provided templates folder and the parameters set in a configuration file that is merged with default values.`,
SilenceUsage: true,
Expand Down
2 changes: 1 addition & 1 deletion cmd/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
func NewGetCmd() *cobra.Command {
getCmd := &cobra.Command{
Use: "get",
Short: "Get a resource (e.g. kubeconfig) from a cluster",
Short: "Get the kubeconfig, available upgrade paths for a cluster",
}

getCmd.AddCommand(get.NewKubeconfigCmd())
Expand Down
10 changes: 5 additions & 5 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func NewRootCmd() *RootCommand {

https := viper.GetBool("https")
if !https {
logrus.Warn("The --https flag is deprecated, if you want to use ssh protocol to download repositories use --git-protocol ssh")
logrus.Warn("The --https flag is deprecated, if you want to use SSH protocol to download repositories use --git-protocol ssh")
}
},
},
Expand All @@ -158,7 +158,7 @@ func NewRootCmd() *RootCommand {
"debug",
"D",
false,
"Enables furyctl debug output",
"Enables furyctl debug output. This will greatly increase the verbosity. Notice that you can always access the debug output in the log file.",
)

rootCmd.PersistentFlags().BoolVarP(
Expand Down Expand Up @@ -190,22 +190,22 @@ func NewRootCmd() *RootCommand {
"outdir",
"o",
"",
"Change the directory where to create the data directory (.furyctl)",
"Path where to create the data directory (.furyctl). Default is the user's home.",
)

rootCmd.PersistentFlags().StringVarP(
&rootCmd.config.Log,
"log",
"l",
"",
"Path to the log file or set to 'stdout' to log to standard output (default: ~/.furyctl/furyctl.log)",
"Path to the log file or set to 'stdout' to log to standard output. Default is '<outdir>/.furyctl/furyctl<timestamp>-<random number>.log'",
)

rootCmd.PersistentFlags().StringP(
"git-protocol",
"g",
"https",
"download repositories using the given protocol (options: https, ssh). Use when SSH traffic is being blocked or when SSH "+
"Download repositories using the given protocol (options: https, ssh). Use when SSH traffic is being blocked or when SSH "+
"client has not been configured\nset the GITHUB_TOKEN environment variable with your token to use "+
"authentication while downloading, for example for private repositories",
)
Expand Down
2 changes: 1 addition & 1 deletion internal/apis/kfd/v1alpha2/ekscluster/create/preflight.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func (p *PreFlight) Exec(renderedConfig map[string]any) (*Status, error) {
return status, fmt.Errorf("error ensuring terraform state aws s3 bucket: %w", err)
}

logrus.Info("Running preflight checks")
logrus.Info("Running preflight checks...")

if err := p.Prepare(); err != nil {
return status, fmt.Errorf("error preparing preflight phase: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion internal/apis/kfd/v1alpha2/ekscluster/delete/preflight.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func (p *PreFlight) Exec() error {
return fmt.Errorf("error ensuring terraform state aws s3 bucket: %w", err)
}

logrus.Info("Running preflight checks")
logrus.Info("Running preflight checks...")

if err := p.Prepare(); err != nil {
return fmt.Errorf("error preparing preflight phase: %w", err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (p *PreFlight) Exec(renderedConfig map[string]any) (*Status, error) {

cfgParser := parser.NewConfigParser(p.furyctlConfPath)

logrus.Info("Running preflight checks")
logrus.Info("Running preflight checks...")

if err := p.CreateRootFolder(); err != nil {
return status, fmt.Errorf("error creating preflight phase folder: %w", err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (p *PreFlight) Exec() error {

cfgParser := parser.NewConfigParser(p.furyctlConfPath)

logrus.Info("Running preflight checks")
logrus.Info("Running preflight checks...")

if err := p.CreateRootFolder(); err != nil {
return fmt.Errorf("error creating preflight phase folder: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion internal/apis/kfd/v1alpha2/onpremises/create/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func (k *Kubernetes) coreKubernetes(
upgradeState *upgrade.State,
) error {
if startFrom != cluster.OperationSubPhasePostKubernetes {
logrus.Info("Running ansible playbook...")
logrus.Info("Applying cluster configuration...")

// Apply create playbook.
if !k.upgrade.Enabled {
Expand Down
2 changes: 1 addition & 1 deletion internal/apis/kfd/v1alpha2/onpremises/create/preflight.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (p *PreFlight) Exec(renderedConfig map[string]any) (*Status, error) {
Success: false,
}

logrus.Info("Running preflight checks")
logrus.Info("Running preflight checks...")

if err := p.CreateRootFolder(); err != nil {
return status, fmt.Errorf("error creating kubernetes phase folder: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion internal/apis/kfd/v1alpha2/onpremises/delete/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (k *Kubernetes) Exec() error {
return fmt.Errorf("error checking hosts: %w", err)
}

logrus.Info("Running ansible playbook...")
logrus.Info("Deleting cluster...")

// Apply delete playbook.
if _, err := k.ansibleRunner.Playbook("delete-playbook.yaml"); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/apis/kfd/v1alpha2/onpremises/delete/preflight.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func NewPreFlight(
}

func (p *PreFlight) Exec() error {
logrus.Info("Running preflight checks")
logrus.Info("Running preflight checks...")

if err := p.CreateRootFolder(); err != nil {
return fmt.Errorf("error creating kubernetes phase folder: %w", err)
Expand Down

0 comments on commit 5f0260e

Please sign in to comment.