-
Notifications
You must be signed in to change notification settings - Fork 832
/
dashboard.go
41 lines (35 loc) · 1.04 KB
/
dashboard.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package dashboard
import (
"context"
"github.com/argoproj/argo-rollouts/pkg/kubectl-argo-rollouts/options"
"github.com/argoproj/argo-rollouts/server"
"github.com/spf13/cobra"
)
func NewCmdDashboard(o *options.ArgoRolloutsOptions) *cobra.Command {
var rootPath string
var cmd = &cobra.Command{
Use: "dashboard",
Short: "Start UI dashboard",
RunE: func(c *cobra.Command, args []string) error {
namespace := o.Namespace()
kubeclientset := o.KubeClientset()
rolloutclientset := o.RolloutsClientset()
opts := server.ServerOptions{
Namespace: namespace,
KubeClientset: kubeclientset,
RolloutsClientset: rolloutclientset,
DynamicClientset: o.DynamicClientset(),
RootPath: rootPath,
}
for {
ctx := context.Background()
ctx, cancel := context.WithCancel(ctx)
argorollouts := server.NewServer(opts)
argorollouts.Run(ctx, 3100, true)
cancel()
}
},
}
cmd.Flags().StringVar(&rootPath, "rootPath", "rollouts", "renders the ui url with rootPath prefixed")
return cmd
}