diff --git a/pkg/skaffold/runner/build_deploy.go b/pkg/skaffold/runner/build_deploy.go index 92d3797343f..4e609af2a72 100644 --- a/pkg/skaffold/runner/build_deploy.go +++ b/pkg/skaffold/runner/build_deploy.go @@ -62,7 +62,7 @@ func (r *SkaffoldRunner) BuildAndTest(ctx context.Context, out io.Writer, artifa // Update which images are logged. for _, build := range bRes { - r.imageList.Add(build.Tag) + r.podSelector.Add(build.Tag) } // Make sure all artifacts are redeployed. Not only those that were just built. diff --git a/pkg/skaffold/runner/logger.go b/pkg/skaffold/runner/logger.go index 627c53a85f5..9b04a3f37cb 100644 --- a/pkg/skaffold/runner/logger.go +++ b/pkg/skaffold/runner/logger.go @@ -34,5 +34,5 @@ func (r *SkaffoldRunner) createLogger(out io.Writer, artifacts []*latest.Artifac func (r *SkaffoldRunner) newLoggerForImages(out io.Writer, images []string) *kubernetes.LogAggregator { kubectlCLI := kubectl.NewFromRunContext(r.runCtx) - return kubernetes.NewLogAggregator(out, kubectlCLI, images, r.imageList, r.runCtx.Namespaces) + return kubernetes.NewLogAggregator(out, kubectlCLI, images, r.podSelector, r.runCtx.Namespaces) } diff --git a/pkg/skaffold/runner/new.go b/pkg/skaffold/runner/new.go index 43b197c3a69..98c81dec120 100644 --- a/pkg/skaffold/runner/new.go +++ b/pkg/skaffold/runner/new.go @@ -109,7 +109,7 @@ func NewForConfig(runCtx *runcontext.RunContext) (*SkaffoldRunner, error) { labellers: labellers, defaultLabeller: defaultLabeller, portForwardResources: runCtx.Cfg.PortForward, - imageList: kubernetes.NewImageList(), + podSelector: kubernetes.NewImageList(), cache: artifactCache, runCtx: runCtx, intents: newIntents(runCtx.Opts.AutoBuild, runCtx.Opts.AutoSync, runCtx.Opts.AutoDeploy), diff --git a/pkg/skaffold/runner/portforwarder.go b/pkg/skaffold/runner/portforwarder.go index 977e1992d83..8f1bd4ff4c2 100644 --- a/pkg/skaffold/runner/portforwarder.go +++ b/pkg/skaffold/runner/portforwarder.go @@ -26,7 +26,7 @@ import ( func (r *SkaffoldRunner) createForwarder(out io.Writer, kubectlCLI *kubectl.CLI) { r.forwarderManager = portforward.NewForwarderManager(out, kubectlCLI, - r.imageList, + r.podSelector, r.runCtx.Namespaces, r.defaultLabeller.RunIDKeyValueString(), r.runCtx.Opts.PortForward, diff --git a/pkg/skaffold/runner/runner.go b/pkg/skaffold/runner/runner.go index 96d5a68b3ec..67a344924d0 100644 --- a/pkg/skaffold/runner/runner.go +++ b/pkg/skaffold/runner/runner.go @@ -66,11 +66,14 @@ type SkaffoldRunner struct { defaultLabeller *deploy.DefaultLabeller portForwardResources []*latest.PortForwardResource builds []build.Artifact - imageList *kubernetes.ImageList - imagesAreLocal bool - hasBuilt bool - hasDeployed bool - intents *intents + + // podSelector is used to determine relevant pods for logging and portForwarding + podSelector *kubernetes.ImageList + + imagesAreLocal bool + hasBuilt bool + hasDeployed bool + intents *intents } // for testing