Skip to content

Commit

Permalink
feat: mulighet for å prefix navn på tenant
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyrremann committed Jun 20, 2023
1 parent 270b575 commit 08c9414
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion cmd/commands/clusterCmd/cmds.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/nais/narcos/pkg/naisdevice"
"github.com/urfave/cli/v2"
"golang.org/x/exp/slices"
"strings"
)

func Command() *cli.Command {
Expand All @@ -32,6 +33,9 @@ func subCommands() []*cli.Command {
Aliases: []string{"o"},
Value: true,
},
&cli.BoolFlag{
Name: "prefixTenant",
},
&cli.StringFlag{
Name: "tenant",
Aliases: []string{"t"},
Expand All @@ -50,6 +54,7 @@ func subCommands() []*cli.Command {
Action: func(context *cli.Context) error {
includeManagement := context.Bool("includeManagement")
includeOnprem := context.Bool("includeOnprem")
prefixTenant := context.Bool("prefixTenant")
tenant := context.String("tenant")

clusters, err := gcp.GetClusters(context.Context, includeManagement, includeOnprem, tenant)
Expand All @@ -58,7 +63,11 @@ func subCommands() []*cli.Command {
}

for _, cluster := range clusters {
fmt.Println(cluster.Name)
name := cluster.Name
if prefixTenant {
name = cluster.Tenant + "-" + strings.TrimPrefix(name, "nais-")
}
fmt.Println(name)
}

return nil
Expand Down

0 comments on commit 08c9414

Please sign in to comment.