Skip to content

Commit bb142ed

Browse files
Adding --join-method flag to teleport configure command (#52937)
* Update teleport.go * added all newly supported join methods * Added Tim's suggestions * Update tool/teleport/common/teleport.go Co-authored-by: rosstimothy <[email protected]> * Update tool/teleport/common/teleport.go Co-authored-by: rosstimothy <[email protected]> --------- Co-authored-by: rosstimothy <[email protected]>
1 parent 31fe604 commit bb142ed

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tool/teleport/common/teleport.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,11 @@ func Run(options Options) (app *kingpin.Application, executedCommand string, con
395395
scpc.Flag("local-addr", "local address which accepted the request").StringVar(&scpFlags.LocalAddr)
396396
scpc.Arg("target", "").StringsVar(&scpFlags.Target)
397397

398+
// Iterate over types.JoinMethods and append new methods to joinMethods
399+
joinMethods := make([]string, 0, len(types.JoinMethods))
400+
for _, m := range types.JoinMethods {
401+
joinMethods = append(joinMethods, string(m))
402+
}
398403
// dump flags
399404
dump.Flag("cluster-name",
400405
"Unique cluster name, e.g. example.com.").StringVar(&dumpFlags.ClusterName)
@@ -412,6 +417,7 @@ func Run(options Options) (app *kingpin.Application, executedCommand string, con
412417
dump.Flag("key-file", "Path to a TLS key file for the proxy.").ExistingFileVar(&dumpFlags.KeyFile)
413418
dump.Flag("data-dir", "Path to a directory where Teleport keep its data.").Default(defaults.DataDir).StringVar(&dumpFlags.DataDir)
414419
dump.Flag("token", "Invitation token or path to file with token value to register with an auth server.").StringVar(&dumpFlags.AuthToken)
420+
dump.Flag("join-method", fmt.Sprintf("Method to use to join the cluster (%s)", strings.Join(joinMethods, ", "))).Default("token").EnumVar(&dumpFlags.JoinMethod, joinMethods...)
415421
dump.Flag("roles", "Comma-separated list of roles to create config with.").StringVar(&dumpFlags.Roles)
416422
dump.Flag("auth-server", "Address of the auth server.").StringVar(&dumpFlags.AuthServer)
417423
dump.Flag("proxy", "Address of the proxy.").StringVar(&dumpFlags.ProxyAddress)
@@ -437,7 +443,7 @@ func Run(options Options) (app *kingpin.Application, executedCommand string, con
437443
dumpNodeConfigure.Flag("proxy", "Address of the proxy server.").StringVar(&dumpFlags.ProxyAddress)
438444
dumpNodeConfigure.Flag("labels", "Comma-separated list of labels to add to newly created nodes ex) env=staging,cloud=aws.").StringVar(&dumpFlags.NodeLabels)
439445
dumpNodeConfigure.Flag("ca-pin", "Comma-separated list of SKPI hashes for the CA used to verify the auth server.").StringVar(&dumpFlags.CAPin)
440-
dumpNodeConfigure.Flag("join-method", "Method to use to join the cluster (token, iam, ec2, kubernetes, azure, gcp)").Default("token").EnumVar(&dumpFlags.JoinMethod, "token", "iam", "ec2", "kubernetes", "azure", "gcp")
446+
dumpNodeConfigure.Flag("join-method", fmt.Sprintf("Method to use to join the cluster (%s)", strings.Join(joinMethods, ", "))).Default("token").EnumVar(&dumpFlags.JoinMethod, joinMethods...)
441447
dumpNodeConfigure.Flag("node-name", "Name for the Teleport node.").StringVar(&dumpFlags.NodeName)
442448
dumpNodeConfigure.Flag("silent", "Suppress user hint message.").BoolVar(&dumpFlags.Silent)
443449
dumpNodeConfigure.Flag("azure-client-id", "Sets the client ID of the managed identity to join with. Only applies to the 'azure' join method.").StringVar(&dumpFlags.AzureClientID)

0 commit comments

Comments
 (0)