Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

require command to be passed to acorn kube command (#1184) #2168

Merged
merged 1 commit into from
Sep 22, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 8 additions & 7 deletions pkg/cli/kube.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,25 @@ import (

func NewKubectl(c CommandContext) *cobra.Command {
cmd := cli.Command(&Kube{client: c.ClientFactory}, cobra.Command{
Use: "kube [flags]",
Use: "kube [flags] COMMAND",
Args: cobra.MinimumNArgs(1),
Hidden: true,
SilenceUsage: true,
Short: "Run command with KUBECONFIG env set to a generated kubeconfig of the current project",
Example: `
acorn -j acorn kube k9s
# Run 'k9s' in the Account API Server for the 'acorn' project:
acorn -j acorn kube k9s

# Access the cluster of the 'aws-us-east-2' region for the current project:
acorn -j acorn kube --region aws-us-east-2 $SHELL
`})
cmd.Flags().SetInterspersed(false)
return cmd
}

type Kube struct {
client ClientFactory
Region string `usage:"Get access to the cluster supporting that specific region"`
Region string `usage:"Get access to the cluster supporting the defined region"`
WriteFile string `usage:"Write kubeconfig to file" short:"w"`
}

Expand Down Expand Up @@ -88,10 +93,6 @@ users:
return err
}

if len(args) == 0 {
args = []string{os.Getenv("SHELL")}
}

k := exec.Command(args[0], args[1:]...)
k.Env = append(os.Environ(), fmt.Sprintf("KUBECONFIG=%s", f.Name()), fmt.Sprintf("ACORN_KUBECONFIG=%s", f.Name()))
k.Stdin = os.Stdin
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/scheduling/scheduling.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func Nodes(req router.Request, computeClass *adminv1.ProjectComputeClassInstance
return computeClass.Affinity, computeClass.Tolerations
}

// PriorityClass checks that a defined PriorityClass exists and returns the name of it
// PriorityClassName checks that a defined PriorityClass exists and returns the name of it
func PriorityClassName(req router.Request, computeClass *adminv1.ProjectComputeClassInstance) (string, error) {
if computeClass == nil || computeClass.PriorityClassName == "" {
return "", nil
Expand Down