Skip to content

Commit

Permalink
feat: added runner init command
Browse files Browse the repository at this point in the history
  • Loading branch information
exu committed Aug 8, 2024
1 parent b1111dd commit b77d161
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/kubectl-testkube/commands/common/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ func PopulateMasterFlags(cmd *cobra.Command, opts *HelmOptions) {
cmd.Flags().StringVar(&opts.Master.AgentToken, "agent-token", "", "Testkube Pro agent key [required for centralized mode]")
cmd.Flags().StringVar(&opts.Master.OrgId, "org-id", "", "Testkube Pro organization id [required for centralized mode]")
cmd.Flags().StringVar(&opts.Master.EnvId, "env-id", "", "Testkube Pro environment id [required for centralized mode]")
cmd.Flags().StringVar(&opts.Master.RunnerId, "runner-id", "", "Testkube Pro Multi Runner id [required for centralized mode]")

cmd.Flags().BoolVar(&opts.Master.Features.LogsV2, "feature-logs-v2", false, "Logs v2 feature flag")
}
Expand Down
4 changes: 4 additions & 0 deletions cmd/kubectl-testkube/commands/common/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,10 @@ func prepareTestkubeProHelmArgs(options HelmOptions, isMigration bool) []string
args = append(args, "--set", fmt.Sprintf("testkube-logs.pro.envId=%s", options.Master.EnvId))
}

if options.Master.RunnerId != "" {
args = append(args, "--set", fmt.Sprintf("testkube-api.cloud.runnerId=%s", options.Master.RunnerId))
}

if options.Master.OrgId != "" {
args = append(args, "--set", fmt.Sprintf("testkube-api.cloud.orgId=%s", options.Master.OrgId))
args = append(args, "--set", fmt.Sprintf("testkube-logs.pro.orgId=%s", options.Master.OrgId))
Expand Down
1 change: 1 addition & 0 deletions cmd/kubectl-testkube/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func init() {
RootCmd.AddCommand(NewGenerateCmd())

RootCmd.AddCommand(NewInitCmd())
RootCmd.AddCommand(NewRunnerCmd())
RootCmd.AddCommand(NewUpgradeCmd())
RootCmd.AddCommand(NewPurgeCmd())
RootCmd.AddCommand(NewWatchCmd())
Expand Down
22 changes: 22 additions & 0 deletions cmd/kubectl-testkube/commands/runner.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package commands

import (
"github.com/spf13/cobra"

"github.com/kubeshop/testkube/cmd/kubectl-testkube/commands/pro"
)

func NewRunnerCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "runner <command>",
Aliases: []string{""},
Short: "Testkube Runner related commands",
Run: func(cmd *cobra.Command, args []string) {
cmd.Help()
},
}

cmd.AddCommand(pro.NewInitCmd())

return cmd
}
1 change: 1 addition & 0 deletions cmd/kubectl-testkube/config/master.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ type Master struct {
IdToken string `json:"idToken,omitempty"`
OrgId string `json:"orgId,omitempty"`
EnvId string `json:"envId,omitempty"`
RunnerId string `json:"runnerId,omitempty"`
Insecure bool `json:"insecure,omitempty"`
UiUrlPrefix string `json:"uiUrlPrefix,omitempty"`
AgentUrlPrefix string `json:"agentUrlPrefix,omitempty"`
Expand Down

0 comments on commit b77d161

Please sign in to comment.