Skip to content

Commit

Permalink
fix: added no-login option for OnPrem to bypass login ask (#5484)
Browse files Browse the repository at this point in the history
  • Loading branch information
exu authored May 24, 2024
1 parent b903d35 commit 6821d40
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/kubectl-testkube/commands/context/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func NewSetContextCmd() *cobra.Command {
switch cfg.ContextType {
case config.ContextTypeCloud:
if opts.Master.OrgId == "" && opts.Master.EnvId == "" && apiKey == "" && opts.Master.RootDomain == "" {
ui.Errf("Please provide at least one of the following flags: --org, --env, --api-key, --root-domain")
ui.Errf("Please provide at least one of the following flags: --org-id, --env-id, --api-key, --root-domain")
}

cfg = common.PopulateCloudConfig(cfg, apiKey, &opts)
Expand Down
10 changes: 10 additions & 0 deletions cmd/kubectl-testkube/commands/pro/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (

func NewInitCmd() *cobra.Command {
var export bool
var noLogin bool // ignore ask for login
options := common.HelmOptions{
NoMinio: true,
NoMongo: true,
Expand Down Expand Up @@ -71,6 +72,14 @@ func NewInitCmd() *cobra.Command {

ui.NL()

if noLogin {
ui.Alert("Saving Testkube CLI Pro context, you need to authorize CLI through `testkube set context` later")
common.PopulateCloudConfig(cfg, "", &options)
ui.Info(" Happy Testing! 🚀")
ui.NL()
return
}

ui.H2("Saving Testkube CLI Pro context")
var token, refreshToken string
if !common.IsUserLoggedIn(cfg, options) {
Expand All @@ -91,6 +100,7 @@ func NewInitCmd() *cobra.Command {
common.PopulateHelmFlags(cmd, &options)
common.PopulateMasterFlags(cmd, &options)

cmd.Flags().BoolVarP(&noLogin, "no-login", "", false, "Ignore login prompt, set existing token later by `testkube set context`")
cmd.Flags().BoolVarP(&export, "export", "", false, "Export the values.yaml")
cmd.Flags().BoolVar(&options.MultiNamespace, "multi-namespace", false, "multi namespace mode")
cmd.Flags().BoolVar(&options.NoOperator, "no-operator", false, "should operator be installed (for more instances in multi namespace mode it should be set to true)")
Expand Down

0 comments on commit 6821d40

Please sign in to comment.