diff --git a/cmd/kubectl-testkube/commands/common/helper.go b/cmd/kubectl-testkube/commands/common/helper.go index 3ce2daa823..1b2260322b 100644 --- a/cmd/kubectl-testkube/commands/common/helper.go +++ b/cmd/kubectl-testkube/commands/common/helper.go @@ -845,8 +845,6 @@ func prepareTestkubeUpgradeDockerArgs(options HelmOptions, dockerContainerName, "--set", "mongodb.enabled=false", "--set", - "testkube-dashboard.enabled=false", - "--set", "testkube-api.cloud.key=" + options.Master.AgentToken, "--set", "testkube-api.cloud.url=" + options.Master.URIs.Agent, diff --git a/cmd/kubectl-testkube/commands/docker.go b/cmd/kubectl-testkube/commands/docker.go new file mode 100644 index 0000000000..fab1d9b8cd --- /dev/null +++ b/cmd/kubectl-testkube/commands/docker.go @@ -0,0 +1,24 @@ +package commands + +import ( + "github.com/spf13/cobra" + + "github.com/kubeshop/testkube/cmd/kubectl-testkube/commands/docker" + "github.com/kubeshop/testkube/pkg/ui" +) + +func NewDockerCmd() *cobra.Command { + + cmd := &cobra.Command{ + Use: "docker", + Short: "Testkube Docker commands", + Run: func(cmd *cobra.Command, args []string) { + err := cmd.Help() + ui.PrintOnError("Displaying help", err) + }, + } + + cmd.AddCommand(docker.NewInitCmd()) + + return cmd +} diff --git a/cmd/kubectl-testkube/commands/pro/docker.go b/cmd/kubectl-testkube/commands/docker/init.go similarity index 79% rename from cmd/kubectl-testkube/commands/pro/docker.go rename to cmd/kubectl-testkube/commands/docker/init.go index 49f8e1b8b5..892927f0d5 100644 --- a/cmd/kubectl-testkube/commands/pro/docker.go +++ b/cmd/kubectl-testkube/commands/docker/init.go @@ -1,7 +1,8 @@ -package pro +package docker import ( "errors" + "fmt" "os" "github.com/pterm/pterm" @@ -9,10 +10,11 @@ import ( "github.com/kubeshop/testkube/cmd/kubectl-testkube/commands/common" "github.com/kubeshop/testkube/cmd/kubectl-testkube/config" + "github.com/kubeshop/testkube/pkg/telemetry" "github.com/kubeshop/testkube/pkg/ui" ) -func NewDockerCmd() *cobra.Command { +func NewInitCmd() *cobra.Command { var noLogin bool // ignore ask for login var dockerContainerName, dockerImage string var options common.HelmOptions @@ -25,9 +27,9 @@ func NewDockerCmd() *cobra.Command { } cmd := &cobra.Command{ - Use: "docker", + Use: "init", Short: "Run Testkube Docker Agent and connect to Testkube Pro environment", - Aliases: []string{"da", "docker-agent"}, + Aliases: []string{"install", "agent"}, Run: func(cmd *cobra.Command, args []string) { ui.Info("WELCOME TO") ui.Logo() @@ -137,3 +139,28 @@ func NewDockerCmd() *cobra.Command { return cmd } + +func sendErrTelemetry(cmd *cobra.Command, clientCfg config.Data, errType string, errorLogs error) { + var errorStackTrace string + errorStackTrace = fmt.Sprintf("%+v", errorLogs) + if clientCfg.TelemetryEnabled { + ui.Debug("collecting anonymous telemetry data, you can disable it by calling `kubectl testkube disable telemetry`") + out, err := telemetry.SendCmdErrorEvent(cmd, common.Version, errType, errorStackTrace) + if ui.Verbose && err != nil { + ui.Err(err) + } + + ui.Debug("telemetry send event response", out) + } +} + +func sendAttemptTelemetry(cmd *cobra.Command, clientCfg config.Data) { + if clientCfg.TelemetryEnabled { + ui.Debug("collecting anonymous telemetry data, you can disable it by calling `kubectl testkube disable telemetry`") + out, err := telemetry.SendCmdAttemptEvent(cmd, common.Version) + if ui.Verbose && err != nil { + ui.Err(err) + } + ui.Debug("telemetry send event response", out) + } +} diff --git a/cmd/kubectl-testkube/commands/pro.go b/cmd/kubectl-testkube/commands/pro.go index 4fae70e3bc..09986b4c75 100644 --- a/cmd/kubectl-testkube/commands/pro.go +++ b/cmd/kubectl-testkube/commands/pro.go @@ -19,7 +19,6 @@ func NewProCmd() *cobra.Command { cmd.AddCommand(pro.NewDisconnectCmd()) cmd.AddCommand(pro.NewInitCmd()) cmd.AddCommand(pro.NewLoginCmd()) - cmd.AddCommand(pro.NewDockerCmd()) return cmd } diff --git a/cmd/kubectl-testkube/commands/root.go b/cmd/kubectl-testkube/commands/root.go index 464f6657f6..9e3bc87718 100644 --- a/cmd/kubectl-testkube/commands/root.go +++ b/cmd/kubectl-testkube/commands/root.go @@ -62,6 +62,7 @@ func init() { RootCmd.AddCommand(NewAgentCmd()) RootCmd.AddCommand(NewCloudCmd()) RootCmd.AddCommand(NewProCmd()) + RootCmd.AddCommand(NewDockerCmd()) RootCmd.AddCommand(pro.NewLoginCmd()) RootCmd.SetHelpCommand(NewHelpCmd())