Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

add 'configPath not exist' log #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
5 changes: 3 additions & 2 deletions internal/commands/root/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func runRootCommand(ctx context.Context, s *provider.Store, c *opts.Opts) error
return errors.Errorf("provider %q not found", c.Provider)
}

client, err := newClient(c.KubeConfigPath, c.KubeAPIQPS, c.KubeAPIBurst)
client, err := newClient(ctx, c.KubeConfigPath, c.KubeAPIQPS, c.KubeAPIBurst)
if err != nil {
return err
}
Expand Down Expand Up @@ -279,7 +279,7 @@ func waitFor(ctx context.Context, time time.Duration, ready <-chan struct{}) err
}
}

func newClient(configPath string, qps, burst int32) (*kubernetes.Clientset, error) {
func newClient(ctx context.Context, configPath string, qps, burst int32) (*kubernetes.Clientset, error) {
var config *rest.Config

// Check if the kubeConfig file exists.
Expand All @@ -291,6 +291,7 @@ func newClient(configPath string, qps, burst int32) (*kubernetes.Clientset, erro
}
} else {
// Set to in-cluster config.
log.G(ctx).Infof("configPath: %q is not exist, it will run as in-cluster.", configPath)
william-lbn marked this conversation as resolved.
Show resolved Hide resolved
config, err = rest.InClusterConfig()
if err != nil {
return nil, errors.Wrap(err, "error building in cluster config")
Expand Down