github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/command/operator_gossip_keyring.go (about)

     1  package command
     2  
     3  import (
     4  	"strings"
     5  
     6  	"github.com/mitchellh/cli"
     7  	"github.com/posener/complete"
     8  )
     9  
    10  // OperatorGossipKeyringCommand is a Command implementation that
    11  // handles querying, installing, and removing gossip encryption keys
    12  // from a keyring.
    13  type OperatorGossipKeyringCommand struct {
    14  	Meta
    15  }
    16  
    17  func (c *OperatorGossipKeyringCommand) Help() string {
    18  	helpText := `
    19  Usage: nomad operator gossip keyring [options]
    20  
    21    Manages encryption keys used for gossip messages between Nomad servers. Gossip
    22    encryption is optional. When enabled, this command may be used to examine
    23    active encryption keys in the cluster, add new keys, and remove old ones. When
    24    combined, this functionality provides the ability to perform key rotation
    25    cluster-wide, without disrupting the cluster.
    26  
    27    Generate an encryption key:
    28  
    29        $ nomad operator gossip keyring generate
    30  
    31    List all gossip encryption keys:
    32  
    33        $ nomad operator gossip keyring list
    34  
    35    Remove an encryption key from the keyring:
    36  
    37        $ nomad operator gossip keyring remove <key>
    38  
    39    Install an encryption key from backup:
    40  
    41        $ nomad operator gossip keyring install <key>
    42  
    43    Use an already-installed encryption key:
    44  
    45        $ nomad operator gossip keyring use <key>
    46  
    47    Please see individual subcommand help for detailed usage information.
    48  
    49  General Options:
    50  
    51    ` + generalOptionsUsage(usageOptsDefault|usageOptsNoNamespace)
    52  
    53  	return strings.TrimSpace(helpText)
    54  }
    55  
    56  func (c *OperatorGossipKeyringCommand) Synopsis() string {
    57  	return "Manages gossip layer encryption keys"
    58  }
    59  
    60  func (c *OperatorGossipKeyringCommand) AutocompleteFlags() complete.Flags {
    61  	return c.Meta.AutocompleteFlags(FlagSetClient)
    62  }
    63  
    64  func (c *OperatorGossipKeyringCommand) AutocompleteArgs() complete.Predictor {
    65  	return complete.PredictNothing
    66  }
    67  
    68  func (c *OperatorGossipKeyringCommand) Name() string { return "operator gossip keyring" }
    69  
    70  func (c *OperatorGossipKeyringCommand) Run(args []string) int {
    71  	return cli.RunResultHelp
    72  }