Grouped commands help description

This commit is contained in:
Alex Dadgar
2018-03-21 14:04:54 -07:00
parent 148a9504e7
commit 6f0dbbb72b
15 changed files with 372 additions and 30 deletions

View File

@@ -12,11 +12,17 @@ type ACLCommand struct {
func (f *ACLCommand) Help() string {
helpText := `
Usage: nomad acl <subcommand> [options]
Usage: nomad acl <subcommand> [options] [args]
Interact with ACL policies and tokens.
This command groups subcommands for interacting with ACL policies and tokens.
Users can bootstrap Nomad's ACL system, create policies that restrict access,
and generate tokens from those policies.
Run nomad acl <subcommand> with no arguments for help on that subcommand.
Bootstrap ACLs:
$ nomad acl bootstrap
Please see the individual subcommand help for detailed usage information.
`
return strings.TrimSpace(helpText)
}

View File

@@ -1,13 +1,39 @@
package command
import "github.com/mitchellh/cli"
import (
"strings"
"github.com/mitchellh/cli"
)
type ACLPolicyCommand struct {
Meta
}
func (f *ACLPolicyCommand) Help() string {
return "This command is accessed by using one of the subcommands below."
helpText := `
Usage: nomad acl policy <subcommand> [options] [args]
This command groups subcommands for interacting with ACL policies. Nomad's ACL
system can be used to control access to data and APIs. ACL policies allow a
set of capabilities or actions to be granted or whitelisted. For a full guide
see: https://www.nomadproject.io/guides/acl.html
Create an ACL policy:
$ nomad acl policy apply <name> <policy-file>
List ACL policies:
$ nomad acl policy list
Inspect an ACL policy:
$ nomad acl policy info <policy>
Please see the individual subcommand help for detailed usage information.
`
return strings.TrimSpace(helpText)
}
func (f *ACLPolicyCommand) Synopsis() string {

View File

@@ -1,13 +1,39 @@
package command
import "github.com/mitchellh/cli"
import (
"strings"
"github.com/mitchellh/cli"
)
type ACLTokenCommand struct {
Meta
}
func (f *ACLTokenCommand) Help() string {
return "This command is accessed by using one of the subcommands below."
helpText := `
Usage: nomad acl token <subcommand> [options] [args]
This command groups subcommands for interacting with ACL tokens. Nomad's ACL
system can be used to control access to data and APIs. ACL tokens are
associated with one or more ACL policies which grant specific capabilities.
For a full guide see: https://www.nomadproject.io/guides/acl.html
Create an ACL token:
$ nomad acl token create -name "my-token" -policy foo -policy bar
Lookup a token and display its associated policies:
$ nomad acl policy info <token_accessor_id>
Revoke an ACL token:
$ nomad acl policy delete <token_accessor_id>
Please see the individual subcommand help for detailed usage information.
`
return strings.TrimSpace(helpText)
}
func (f *ACLTokenCommand) Synopsis() string {

View File

@@ -1,13 +1,34 @@
package command
import "github.com/mitchellh/cli"
import (
"strings"
"github.com/mitchellh/cli"
)
type AllocCommand struct {
Meta
}
func (f *AllocCommand) Help() string {
return "This command is accessed by using one of the subcommands below."
helpText := `
Usage: nomad alloc <subcommand> [options] [args]
This command groups subcommands for interacting with allocations. Users can
inspect the status, examine the filesystem or logs of an allocation.
Examine an allocations status:
$ nomad alloc status <alloc-id>
Stream a task's logs:
$ nomad alloc logs -f <alloc-id> <task>
Please see the individual subcommand help for detailed usage information.
`
return strings.TrimSpace(helpText)
}
func (f *AllocCommand) Synopsis() string {

View File

@@ -1,13 +1,43 @@
package command
import "github.com/mitchellh/cli"
import (
"strings"
"github.com/mitchellh/cli"
)
type DeploymentCommand struct {
Meta
}
func (f *DeploymentCommand) Help() string {
return "This command is accessed by using one of the subcommands below."
helpText := `
Usage: nomad deployment <subcommand> [options] [args]
This command groups subcommands for interacting with deployments. Deployments
are used to manage a transistion between two versions of a Nomad job. Users
can inspect an ongoing deployment, promote canary allocations, force fail
deployments, and more.
Examine a deployments status:
$ nomad deployment status <deployment-id>
Promote the canaries to allow the remaining allocations to be updated in a
rolling deployment fashion:
$ nomad deployment promote <depoloyment-id>
Mark a deployment as failed. This will stop new allocations from being placed
and if the job's upgrade stanza specifies auto_revert, causes the job to
revert back to the last stable version of the job:
$ nomad deployment fail <depoloyment-id>
Please see the individual subcommand help for detailed usage information.
`
return strings.TrimSpace(helpText)
}
func (f *DeploymentCommand) Synopsis() string {

View File

@@ -1,13 +1,32 @@
package command
import "github.com/mitchellh/cli"
import (
"strings"
"github.com/mitchellh/cli"
)
type EvalCommand struct {
Meta
}
func (f *EvalCommand) Help() string {
return "This command is accessed by using one of the subcommands below."
helpText := `
Usage: nomad eval <subcommand> [options] [args]
This command groups subcommands for interacting with evaluations. Evaluations
are used to trigger a scheduling event. As such, evaluations are an internal
detail but can be useful for debugging placement failures when the cluster
does not have the resources to run a given job.
Examine an evaluations status:
$ nomad eval status <eval-id>
Please see the individual subcommand help for detailed usage information.
`
return strings.TrimSpace(helpText)
}
func (f *EvalCommand) Synopsis() string {

View File

@@ -1,13 +1,41 @@
package command
import "github.com/mitchellh/cli"
import (
"strings"
"github.com/mitchellh/cli"
)
type JobCommand struct {
Meta
}
func (f *JobCommand) Help() string {
return "This command is accessed by using one of the subcommands below."
helpText := `
Usage: nomad job <subcommand> [options] [args]
This command groups subcommands for interacting with jobs.
Run a new job or update an existing job:
$ nomad job run <path>
Plan the run of a job to determine what changes would occur:
$ nomad job plan <path>
Stop a running job:
$ nomad job stop <name>
Examine the status of a running job:
$ nomad job status <name>
Please see the individual subcommand help for detailed usage information.
`
return strings.TrimSpace(helpText)
}
func (f *JobCommand) Synopsis() string {

View File

@@ -1,6 +1,8 @@
package command
import (
"strings"
"github.com/hashicorp/nomad/api/contexts"
"github.com/mitchellh/cli"
"github.com/posener/complete"
@@ -11,7 +13,30 @@ type NamespaceCommand struct {
}
func (f *NamespaceCommand) Help() string {
return "This command is accessed by using one of the subcommands below."
helpText := `
Usage: nomad namespace <subcommand> [options] [args]
This command groups subcommands for interacting with namespaces. Namespaces
allow jobs and their associated objects to be segmented from each other and
other users of the cluster. For a full guide on namespaces see:
https://www.nomadproject.io/guides/namespaces.html
Create or update a namespace:
$ nomad namespace apply <name> -description "My new namespace"
List namespaces:
$ nomad namespace list
View the status of a namespace:
$ nomad namespace status <name>
Please see the individual subcommand help for detailed usage information.
`
return strings.TrimSpace(helpText)
}
func (f *NamespaceCommand) Synopsis() string {

View File

@@ -1,13 +1,41 @@
package command
import "github.com/mitchellh/cli"
import (
"strings"
"github.com/mitchellh/cli"
)
type NodeCommand struct {
Meta
}
func (f *NodeCommand) Help() string {
return "This command is accessed by using one of the subcommands below."
helpText := `
Usage: nomad nomad <subcommand> [options] [args]
This command groups subcommands for interacting with nodes. Nodes in Nomad are
agent's that can run submitted workloads. This command can be used to examine
nodes and operate on nodes, such as draining workloads off of them.
Examine the status of a node:
$ nomad node status <node-id>
Mark a node as ineligible for running workloads. This is useful when the node
is expected to be removed or upgraded so new allocations aren't placed on it:
$ nomad node eligibility -disabled <node-id>
Mark a node to be drained, allowing batch jobs four hours to finished before
forcing them off the node:
$ nomad node drain -enable -deadline 4h <node-id>
Please see the individual subcommand help for detailed usage information.
`
return strings.TrimSpace(helpText)
}
func (f *NodeCommand) Synopsis() string {

View File

@@ -18,7 +18,7 @@ Usage: nomad operator <subcommand> [options]
the Raft subsystem. NOTE: Use this command with extreme caution, as improper
use could lead to a Nomad outage and even loss of data.
Run nomad operator <subcommand> with no arguments for help on that subcommand.
Please see the individual subcommand help for detailed usage information.
`
return strings.TrimSpace(helpText)
}

View File

@@ -22,8 +22,49 @@ func (c *OperatorAutopilotCommand) Help() string {
helpText := `
Usage: nomad operator autopilot <subcommand> [options]
The Autopilot operator command is used to interact with Nomad's Autopilot
subsystem. The command can be used to view or modify the current configuration.
`
This command groups subcommands for interacting with Nomad's Autopilot
subsystem. Autopilot provides automatic, operator-friendly management of Nomad
servers. The command can be used to view or modify the current Autopilot
configuration.
Get the current Autopilot configuration:
$ nomad operator autopilot get-config
Set a new Autopilot configuration, enabling automatic dead server cleanup:
$ nomad operator autopilot set-config -cleanup-dead-servers=true
Please see the individual subcommand help for detailed usage information.
`
return strings.TrimSpace(helpText)
/*
helpText := `
Usage: nomad deployment <subcommand> [options] [args]
This command groups subcommands for interacting with deployments. Deployments
are used to manage a transistion between two versions of a Nomad job. Users
can inspect an ongoing deployment, promote canary allocations, force fail
deployments, and more.
Examine a deployments status:
$ nomad deployment status <deployment-id>
Promote the canaries to allow the remaining allocations to be updated in a
rolling deployment fashion:
$ nomad deployment promote <depoloyment-id>
Mark a deployment as failed. This will stop new allocations from being placed
and if the job's upgrade stanza specifies auto_revert, causes the job to
revert back to the last stable version of the job:
$ nomad deployment fail <depoloyment-id>
Please see the individual subcommand help for detailed usage information.
`
return strings.TrimSpace(helpText)
*/
}

View File

@@ -14,9 +14,19 @@ func (c *OperatorRaftCommand) Help() string {
helpText := `
Usage: nomad operator raft <subcommand> [options]
The Raft operator command is used to interact with Nomad's Raft subsystem. The
command can be used to verify Raft peers or in rare cases to recover quorum by
removing invalid peers.
This command groups subcommands for interacting with Nomad's Raft subsystem.
The command can be used to verify Raft peers or in rare cases to recover
quorum by removing invalid peers.
List Raft peers:
$ nomad operator raft list-peers
Remove a Raft peer:
$ nomad operator raft remove-peer -peer-address "IP:Port"
Please see the individual subcommand help for detailed usage information.
`
return strings.TrimSpace(helpText)
}

View File

@@ -1,6 +1,8 @@
package command
import (
"strings"
"github.com/hashicorp/nomad/api/contexts"
"github.com/mitchellh/cli"
"github.com/posener/complete"
@@ -11,7 +13,31 @@ type QuotaCommand struct {
}
func (f *QuotaCommand) Help() string {
return "This command is accessed by using one of the subcommands below."
helpText := `
Usage: nomad quota <subcommand> [options] [args]
This command groups subcommands for interacting with resource quotas. Resource
quotas allow operators to restrict the aggregate resource usage of namespaces.
Users can inspect existing quota specifications, create new quotas, delete and
list existing quotas, and more. For a full guide on resource quotas see:
https://www.nomadproject.io/guides/quotas.html
Examine a quota's status:
$ nomad quota status <name>
List existing quotas:
$ nomad quota list
Create a new quota specification:
$ nomad quota apply <path>
Please see the individual subcommand help for detailed usage information.
`
return strings.TrimSpace(helpText)
}
func (f *QuotaCommand) Synopsis() string {

View File

@@ -1,13 +1,44 @@
package command
import "github.com/mitchellh/cli"
import (
"strings"
"github.com/mitchellh/cli"
)
type SentinelCommand struct {
Meta
}
func (f *SentinelCommand) Help() string {
return "This command is accessed by using one of the subcommands below."
helpText := `
Usage: nomad sentinel <subcommand> [options] [args]
This command groups subcommands for interacting with Sentinel policies.
Sentinel policies allow operators to express fine-grained policies as code and
have their policies automatically enforced. This allows operators to define a
"sandbox" and restrict actions to only those compliant with policy. The
Sentinel integration builds on the ACL System. Users can read existing
Sentinel policies, create new policies, delete and list existing policies, and
more. For a full guide on Sentinel policies see:
https://www.nomadproject.io/guides/sentinel-policy.html
Read an existing policy:
$ nomad sentinel read <name>
List existing policies:
$ nomad sentinel list
Create a new Sentinel policy:
$ nomad sentinel apply <name> <path>
Please see the individual subcommand help for detailed usage information.
`
return strings.TrimSpace(helpText)
}
func (f *SentinelCommand) Synopsis() string {

View File

@@ -1,13 +1,38 @@
package command
import "github.com/mitchellh/cli"
import (
"strings"
"github.com/mitchellh/cli"
)
type ServerCommand struct {
Meta
}
func (f *ServerCommand) Help() string {
return "This command is accessed by using one of the subcommands below."
helpText := `
Usage: nomad server <subcommand> [options] [args]
This command groups subcommands for interacting with Nomad servers. Users can
list Servers, join a server to the cluster, and force leave a server.
List Nomad servers:
$ nomad server members
Join a new server to another:
$ nomad server join "IP:Port"
Force a server to leave:
$ nomad server force-leave <name>
Please see the individual subcommand help for detailed usage information.
`
return strings.TrimSpace(helpText)
}
func (f *ServerCommand) Synopsis() string {