Skip to content

Commit

Permalink
Review
Browse files Browse the repository at this point in the history
  • Loading branch information
feloy committed Jul 6, 2023
1 parent 27e6f50 commit fb86bdf
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pkg/odo/cli/apiserver/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,17 @@ const (
)

type ApiServerOptions struct {
clientset *clientset.Clientset
apiServerPortFlag int
clientset *clientset.Clientset
portFlag int
}

func NewApiServerOptions() *ApiServerOptions {
return &ApiServerOptions{}
}

var _ genericclioptions.Runnable = (*ApiServerOptions)(nil)
var _ genericclioptions.SignalHandler = (*ApiServerOptions)(nil)
var _ genericclioptions.Cleanuper = (*ApiServerOptions)(nil)

func (o *ApiServerOptions) SetClientset(clientset *clientset.Clientset) {
o.clientset = clientset
Expand All @@ -50,7 +52,7 @@ func (o *ApiServerOptions) Run(ctx context.Context) (err error) {
_ = apiserver_impl.StartServer(
ctx,
cancel,
o.apiServerPortFlag,
o.portFlag,
nil,
nil,
o.clientset.StateClient,
Expand All @@ -72,7 +74,7 @@ func (o *ApiServerOptions) HandleSignal(ctx context.Context, cancelFunc context.
return nil
}

// NewCmdDev implements the odo dev command
// NewCmdApiServer implements the odo api-server command
func NewCmdApiServer(ctx context.Context, name, fullName string, testClientset clientset.Clientset) *cobra.Command {
o := NewApiServerOptions()
apiserverCmd := &cobra.Command{
Expand All @@ -87,6 +89,6 @@ func NewCmdApiServer(ctx context.Context, name, fullName string, testClientset c
clientset.Add(apiserverCmd,
clientset.STATE,
)
apiserverCmd.Flags().IntVar(&o.apiServerPortFlag, "api-server-port", 0, "Define custom port for API Server.")
apiserverCmd.Flags().IntVar(&o.portFlag, "port", 0, "Define custom port for API Server.")
return apiserverCmd
}

0 comments on commit fb86bdf

Please sign in to comment.