From cf2e36dc2d1a6aa6e203b497ab8259191ceac2cc Mon Sep 17 00:00:00 2001 From: William Loy Date: Mon, 10 Mar 2025 16:31:44 -0500 Subject: [PATCH 1/5] Update teleport.go --- tool/teleport/common/teleport.go | 1 + 1 file changed, 1 insertion(+) diff --git a/tool/teleport/common/teleport.go b/tool/teleport/common/teleport.go index e580d298c0c3c..64dcecabb1726 100644 --- a/tool/teleport/common/teleport.go +++ b/tool/teleport/common/teleport.go @@ -402,6 +402,7 @@ func Run(options Options) (app *kingpin.Application, executedCommand string, con dump.Flag("key-file", "Path to a TLS key file for the proxy.").ExistingFileVar(&dumpFlags.KeyFile) dump.Flag("data-dir", "Path to a directory where Teleport keep its data.").Default(defaults.DataDir).StringVar(&dumpFlags.DataDir) dump.Flag("token", "Invitation token or path to file with token value to register with an auth server.").StringVar(&dumpFlags.AuthToken) + dump.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") dump.Flag("roles", "Comma-separated list of roles to create config with.").StringVar(&dumpFlags.Roles) dump.Flag("auth-server", "Address of the auth server.").StringVar(&dumpFlags.AuthServer) dump.Flag("proxy", "Address of the proxy.").StringVar(&dumpFlags.ProxyAddress) From ec0c484d421447d31bf1f500efff191717f13105 Mon Sep 17 00:00:00 2001 From: William Loy Date: Mon, 10 Mar 2025 16:48:39 -0500 Subject: [PATCH 2/5] added all newly supported join methods --- tool/teleport/common/teleport.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tool/teleport/common/teleport.go b/tool/teleport/common/teleport.go index 64dcecabb1726..332336d1b1b45 100644 --- a/tool/teleport/common/teleport.go +++ b/tool/teleport/common/teleport.go @@ -402,7 +402,7 @@ func Run(options Options) (app *kingpin.Application, executedCommand string, con dump.Flag("key-file", "Path to a TLS key file for the proxy.").ExistingFileVar(&dumpFlags.KeyFile) dump.Flag("data-dir", "Path to a directory where Teleport keep its data.").Default(defaults.DataDir).StringVar(&dumpFlags.DataDir) dump.Flag("token", "Invitation token or path to file with token value to register with an auth server.").StringVar(&dumpFlags.AuthToken) - dump.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") + dump.Flag("join-method", "Method to use to join the cluster (token, iam, ec2, kubernetes, azure, gcp, oracle, github, circleci, gitlab, tpm)").Default("token").EnumVar(&dumpFlags.JoinMethod, "token", "iam", "ec2", "kubernetes", "azure", "gcp", "oracle", "github", "circleci", "tpm") dump.Flag("roles", "Comma-separated list of roles to create config with.").StringVar(&dumpFlags.Roles) dump.Flag("auth-server", "Address of the auth server.").StringVar(&dumpFlags.AuthServer) dump.Flag("proxy", "Address of the proxy.").StringVar(&dumpFlags.ProxyAddress) @@ -428,7 +428,7 @@ func Run(options Options) (app *kingpin.Application, executedCommand string, con dumpNodeConfigure.Flag("proxy", "Address of the proxy server.").StringVar(&dumpFlags.ProxyAddress) dumpNodeConfigure.Flag("labels", "Comma-separated list of labels to add to newly created nodes ex) env=staging,cloud=aws.").StringVar(&dumpFlags.NodeLabels) dumpNodeConfigure.Flag("ca-pin", "Comma-separated list of SKPI hashes for the CA used to verify the auth server.").StringVar(&dumpFlags.CAPin) - 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") + dumpNodeConfigure.Flag("join-method", "Method to use to join the cluster (token, iam, ec2, kubernetes, azure, gcp, oracle, github, circleci, gitlab, tpm)").Default("token").EnumVar(&dumpFlags.JoinMethod, "token", "iam", "ec2", "kubernetes", "azure", "gcp", "oracle", "github", "circleci", "tpm") dumpNodeConfigure.Flag("node-name", "Name for the Teleport node.").StringVar(&dumpFlags.NodeName) dumpNodeConfigure.Flag("silent", "Suppress user hint message.").BoolVar(&dumpFlags.Silent) 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) From 22e6fa3677960d515e6e58e66eeb2db8c1164f8b Mon Sep 17 00:00:00 2001 From: William Loy Date: Tue, 11 Mar 2025 14:19:21 -0500 Subject: [PATCH 3/5] Added Tim's suggestions --- tool/teleport/common/teleport.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tool/teleport/common/teleport.go b/tool/teleport/common/teleport.go index 332336d1b1b45..da1d402156a20 100644 --- a/tool/teleport/common/teleport.go +++ b/tool/teleport/common/teleport.go @@ -385,6 +385,11 @@ func Run(options Options) (app *kingpin.Application, executedCommand string, con scpc.Flag("local-addr", "local address which accepted the request").StringVar(&scpFlags.LocalAddr) scpc.Arg("target", "").StringsVar(&scpFlags.Target) + // Iterate over types.JoinMethods and append new methods to joinMethods + joinMethods := make([]string, 0, len(types.JoinMethods)) + for _, m := range types.JoinMethods { + joinMethods = append(joinMethods, string(m)) + } // dump flags dump.Flag("cluster-name", "Unique cluster name, e.g. example.com.").StringVar(&dumpFlags.ClusterName) @@ -402,7 +407,8 @@ func Run(options Options) (app *kingpin.Application, executedCommand string, con dump.Flag("key-file", "Path to a TLS key file for the proxy.").ExistingFileVar(&dumpFlags.KeyFile) dump.Flag("data-dir", "Path to a directory where Teleport keep its data.").Default(defaults.DataDir).StringVar(&dumpFlags.DataDir) dump.Flag("token", "Invitation token or path to file with token value to register with an auth server.").StringVar(&dumpFlags.AuthToken) - dump.Flag("join-method", "Method to use to join the cluster (token, iam, ec2, kubernetes, azure, gcp, oracle, github, circleci, gitlab, tpm)").Default("token").EnumVar(&dumpFlags.JoinMethod, "token", "iam", "ec2", "kubernetes", "azure", "gcp", "oracle", "github", "circleci", "tpm") + dump.Flag("join-method", fmt.Sprintf("Method to use to join the cluster (%s)", strings.Join(joinMethods, ", "))).Default("token").EnumVar(&dumpFlags.JoinMethod, joinMethods...) + dump.Flag("roles", "Comma-separated list of roles to create config with.").StringVar(&dumpFlags.Roles) dump.Flag("roles", "Comma-separated list of roles to create config with.").StringVar(&dumpFlags.Roles) dump.Flag("auth-server", "Address of the auth server.").StringVar(&dumpFlags.AuthServer) dump.Flag("proxy", "Address of the proxy.").StringVar(&dumpFlags.ProxyAddress) @@ -428,7 +434,7 @@ func Run(options Options) (app *kingpin.Application, executedCommand string, con dumpNodeConfigure.Flag("proxy", "Address of the proxy server.").StringVar(&dumpFlags.ProxyAddress) dumpNodeConfigure.Flag("labels", "Comma-separated list of labels to add to newly created nodes ex) env=staging,cloud=aws.").StringVar(&dumpFlags.NodeLabels) dumpNodeConfigure.Flag("ca-pin", "Comma-separated list of SKPI hashes for the CA used to verify the auth server.").StringVar(&dumpFlags.CAPin) - dumpNodeConfigure.Flag("join-method", "Method to use to join the cluster (token, iam, ec2, kubernetes, azure, gcp, oracle, github, circleci, gitlab, tpm)").Default("token").EnumVar(&dumpFlags.JoinMethod, "token", "iam", "ec2", "kubernetes", "azure", "gcp", "oracle", "github", "circleci", "tpm") + dumpNodeConfigure.Flag("join-method", fmt.Sprintf("Method to use to join the cluster (%s)", strings.Join(joinMethods, ", "))).Default("token").EnumVar(&dumpFlags.JoinMethod, joinMethods...) dumpNodeConfigure.Flag("node-name", "Name for the Teleport node.").StringVar(&dumpFlags.NodeName) dumpNodeConfigure.Flag("silent", "Suppress user hint message.").BoolVar(&dumpFlags.Silent) 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) From 8f5d2c6adfe301dc42c8c29f19893c7fcb46c115 Mon Sep 17 00:00:00 2001 From: William Loy Date: Tue, 11 Mar 2025 16:54:00 -0500 Subject: [PATCH 4/5] Update tool/teleport/common/teleport.go Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com> --- tool/teleport/common/teleport.go | 1 - 1 file changed, 1 deletion(-) diff --git a/tool/teleport/common/teleport.go b/tool/teleport/common/teleport.go index da1d402156a20..87e371f5a99aa 100644 --- a/tool/teleport/common/teleport.go +++ b/tool/teleport/common/teleport.go @@ -408,7 +408,6 @@ func Run(options Options) (app *kingpin.Application, executedCommand string, con dump.Flag("data-dir", "Path to a directory where Teleport keep its data.").Default(defaults.DataDir).StringVar(&dumpFlags.DataDir) dump.Flag("token", "Invitation token or path to file with token value to register with an auth server.").StringVar(&dumpFlags.AuthToken) dump.Flag("join-method", fmt.Sprintf("Method to use to join the cluster (%s)", strings.Join(joinMethods, ", "))).Default("token").EnumVar(&dumpFlags.JoinMethod, joinMethods...) - dump.Flag("roles", "Comma-separated list of roles to create config with.").StringVar(&dumpFlags.Roles) dump.Flag("roles", "Comma-separated list of roles to create config with.").StringVar(&dumpFlags.Roles) dump.Flag("auth-server", "Address of the auth server.").StringVar(&dumpFlags.AuthServer) dump.Flag("proxy", "Address of the proxy.").StringVar(&dumpFlags.ProxyAddress) From f212a83ae5e651aae02957df1155d3ce615719f3 Mon Sep 17 00:00:00 2001 From: William Loy Date: Tue, 11 Mar 2025 16:54:11 -0500 Subject: [PATCH 5/5] Update tool/teleport/common/teleport.go Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com> --- tool/teleport/common/teleport.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tool/teleport/common/teleport.go b/tool/teleport/common/teleport.go index 87e371f5a99aa..7f6600fff3bf7 100644 --- a/tool/teleport/common/teleport.go +++ b/tool/teleport/common/teleport.go @@ -387,7 +387,7 @@ func Run(options Options) (app *kingpin.Application, executedCommand string, con // Iterate over types.JoinMethods and append new methods to joinMethods joinMethods := make([]string, 0, len(types.JoinMethods)) - for _, m := range types.JoinMethods { + for _, m := range types.JoinMethods { joinMethods = append(joinMethods, string(m)) } // dump flags