Skip to content

Commit

Permalink
use config to create client
Browse files Browse the repository at this point in the history
Signed-off-by: Somtochi Onyekwere <[email protected]>
  • Loading branch information
somtochiama committed Dec 6, 2023
1 parent b47a545 commit bd5702b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cmd/flux/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,17 @@ func runCheckCmd(cmd *cobra.Command, args []string) error {

ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout)
defer cancel()
kubeClient, err := utils.KubeClient(kubeconfigArgs, kubeclientOptions)
if err != nil {
return err
}

cfg, err := utils.KubeConfig(kubeconfigArgs, kubeclientOptions)
if err != nil {
return fmt.Errorf("Kubernetes client initialization failed: %s", err.Error())
}

kubeClient, err := client.New(cfg, client.Options{Scheme: utils.NewScheme()})
if err != nil {
return err
}

if !kubernetesCheck(cfg, kubernetesConstraints) {
checkFailed = true
}
Expand Down

0 comments on commit bd5702b

Please sign in to comment.