Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions pkg/cmd/namespace.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package cmd

import (
"context"
"fmt"
"os"

"github.com/SwissDataScienceCenter/renku-dev-utils/pkg/github"
ns "github.com/SwissDataScienceCenter/renku-dev-utils/pkg/namespace"
"github.com/spf13/cobra"
)

var namespaceCmd = &cobra.Command{
Use: "namespace",
Aliases: []string{"ns"},
Short: "Print the kubernetes namespace of the current deployment",
Run: namespaceFn,
}

func namespaceFn(cmd *cobra.Command, args []string) {
ctx := context.Background()

cli, err := github.NewGitHubCLI("")
if err != nil {
fmt.Println(err)
os.Exit(1)
}
namespace, err = ns.FindCurrentNamespace(ctx, cli)
if err != nil {
fmt.Println(err)
os.Exit(1)
}

fmt.Printf("%s\n", namespace)
}
1 change: 1 addition & 0 deletions pkg/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func init() {
rootCmd.AddCommand(cleanupDeploymentCmd)
rootCmd.AddCommand(copyKeycloakAdminPasswordCmd)
rootCmd.AddCommand(makeMeAdminCmd)
rootCmd.AddCommand(namespaceCmd)
rootCmd.AddCommand(openDeploymentCmd)
rootCmd.AddCommand(versionCmd)
}
Expand Down