From 16dd9afd87f34e264a76cd727e29e3630be7ee85 Mon Sep 17 00:00:00 2001 From: Alexis Sellier Date: Tue, 13 Sep 2022 17:17:26 +0200 Subject: [PATCH] Specify a kubeClient when loading the devspace configuration --- cmd/cleanup/images.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmd/cleanup/images.go b/cmd/cleanup/images.go index c1e8d37137..3725461694 100644 --- a/cmd/cleanup/images.go +++ b/cmd/cleanup/images.go @@ -43,6 +43,7 @@ func (cmd *imagesCmd) RunCleanupImages(f factory.Factory, cobraCmd *cobra.Comman // Set config root ctx := context.Background() log := f.GetLog() + configLoader, err := f.NewConfigLoader(cmd.ConfigPath) if err != nil { return err @@ -65,6 +66,11 @@ func (cmd *imagesCmd) RunCleanupImages(f factory.Factory, cobraCmd *cobra.Comman kubeContext = cmd.KubeContext } + kubeClient, err := f.NewKubeDefaultClient() + if err != nil { + return errors.Wrap(err, "new kube client") + } + // Create docker client client, err := docker.NewClientWithMinikube(ctx, kubeContext, true, log) if err != nil { @@ -72,7 +78,7 @@ func (cmd *imagesCmd) RunCleanupImages(f factory.Factory, cobraCmd *cobra.Comman } // Load config - configInterface, err := configLoader.Load(ctx, nil, cmd.ToConfigOptions(), log) + configInterface, err := configLoader.Load(ctx, kubeClient, cmd.ToConfigOptions(), log) if err != nil { return err }