Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed flag kubeconfigPath from verify command #253

Merged
Merged
Changes from 2 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
11 changes: 6 additions & 5 deletions cmd/verify/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"os"
"os/exec"

"github.com/argoproj/pkg/kube/cli"
Expand Down Expand Up @@ -33,33 +34,33 @@ var (

func NewCommand() *cobra.Command {
var clientConfig clientcmd.ClientConfig
var kubeconfigPath string
cmd := &cobra.Command{
Use: "verify",
Short: "Verify if arlon cli can run",
Long: "Verify if required kubectl,argocd,git access is present before profiles and bundles are created",
DisableAutoGenTag: true,
Example: "arlonctl verify --kubeconfigPath",
Example: "arlonctl verify",
RunE: func(c *cobra.Command, args []string) error {
err := verify(clientConfig, kubeconfigPath)
err := verify(clientConfig)
if err != nil {
return err
}
return nil
},
}
clientConfig = cli.AddKubectlFlagsToCmd(cmd)
cmd.Flags().StringVar(&kubeconfigPath, "kubeconfigPath", "", "kubeconfig file location")
return cmd
}

func verify(clientConfig clientcmd.ClientConfig, kubeconfigPath string) error {
func verify(clientConfig clientcmd.ClientConfig) error {
var err error
config, err := clientConfig.ClientConfig()
if err != nil {
return fmt.Errorf("failed to get k8s client config")
}

kubeconfigPath := os.Getenv("KUBECONFIG")

// Verify kubectl status
kubectlStatus, err := verifyKubectl(kubeconfigPath)
if err != nil {
Expand Down