Skip to content

Commit

Permalink
Move imagePullPolicy transform logic to kubectl Deploy
Browse files Browse the repository at this point in the history
Signed-off-by: Lucas Rodriguez <[email protected]>
  • Loading branch information
lucasrod16 committed Sep 18, 2024
1 parent 6be9283 commit 4c5d0cf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
11 changes: 11 additions & 0 deletions pkg/skaffold/deploy/kubectl/kubectl.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,17 @@ func (k *Deployer) Deploy(ctx context.Context, out io.Writer, builds []graph.Art
return err
}

cluster, err := config.GetCluster(ctx, config.GetClusterOpts{})
if err != nil {
return err
}
if cluster.Local {
manifests, err = manifests.ReplaceImagePullPolicy(manifest.NewResourceSelectorImagePullPolicy())
if err != nil {
return err
}
}

childCtx, endTrace = instrumentation.StartTrace(ctx, "Deploy_LoadImages")
if err := k.imageLoader.LoadImages(childCtx, out, k.localImages, k.originalImages, builds); err != nil {
endTrace(instrumentation.TraceEndError(err))
Expand Down
12 changes: 0 additions & 12 deletions pkg/skaffold/render/renderer/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (

apim "k8s.io/apimachinery/pkg/runtime/schema"

"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/config"
"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/graph"
"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/instrumentation"
"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/kubernetes/manifest"
Expand Down Expand Up @@ -77,17 +76,6 @@ func BaseTransform(ctx context.Context, manifests manifest.ManifestList, builds
endTrace()
}

cluster, err := config.GetCluster(ctx, config.GetClusterOpts{})
if err != nil {
return nil, err
}
if cluster.Local {
manifests, err = manifests.ReplaceImagePullPolicy(manifest.NewResourceSelectorImagePullPolicy())
if err != nil {
return nil, err
}
}

if !opts.EnablePlatformNodeAffinity {
// TODO (gaghosh): To support platform node affinity in offline mode, we'll need to save the image platform
// information in the build output file, and consume that here instead of looking up in the container registry.
Expand Down

0 comments on commit 4c5d0cf

Please sign in to comment.