From b56cf093d9e8f32b3e6b80ee31f3fb966f591481 Mon Sep 17 00:00:00 2001 From: Ivan Milchev Date: Wed, 4 Oct 2023 16:21:15 +0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20re-use=20provider=20instance=20for?= =?UTF-8?q?=20all=20assets=20when=20scanning=20k8s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ivan Milchev --- explorer/scan/local_scanner.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/explorer/scan/local_scanner.go b/explorer/scan/local_scanner.go index 67624ea471..9e557ffe14 100644 --- a/explorer/scan/local_scanner.go +++ b/explorer/scan/local_scanner.go @@ -233,9 +233,17 @@ func (s *LocalScanner) distributeJob(job *Job, ctx context.Context, upstream *up for i := range assetCandidates { candidate := assetCandidates[i] - runtime, err := providers.Coordinator.EphemeralRuntimeFor(candidate.asset) - if err != nil { - return nil, false, err + var runtime *providers.Runtime + if candidate.asset.Connections[0].Type == "k8s" { + runtime, err = providers.Coordinator.RuntimeFor(candidate.asset, providers.DefaultRuntime()) + if err != nil { + return nil, false, err + } + } else { + runtime, err = providers.Coordinator.EphemeralRuntimeFor(candidate.asset) + if err != nil { + return nil, false, err + } } runtime.SetRecording(candidate.runtime.Recording)