diff --git a/cmd/skaffold/app/cmd/runner.go b/cmd/skaffold/app/cmd/runner.go index df8ff3f6da7..9d5ba856bb2 100644 --- a/cmd/skaffold/app/cmd/runner.go +++ b/cmd/skaffold/app/cmd/runner.go @@ -24,7 +24,7 @@ import ( "github.com/GoogleContainerTools/skaffold/pkg/skaffold/config" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/constants" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner" - runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/context" + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/defaults" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest" diff --git a/integration/build_test.go b/integration/build_test.go index dca812d94c3..034763c5f64 100644 --- a/integration/build_test.go +++ b/integration/build_test.go @@ -27,7 +27,7 @@ import ( "4d63.com/tz" "github.com/GoogleContainerTools/skaffold/integration/skaffold" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/docker" - runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/context" + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/util" "github.com/docker/docker/api/types" "github.com/sirupsen/logrus" diff --git a/pkg/skaffold/build/cache/cache.go b/pkg/skaffold/build/cache/cache.go index e551ce15bad..e4641c78a27 100644 --- a/pkg/skaffold/build/cache/cache.go +++ b/pkg/skaffold/build/cache/cache.go @@ -23,7 +23,7 @@ import ( "github.com/GoogleContainerTools/skaffold/pkg/skaffold/constants" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/docker" - runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/context" + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/util" homedir "github.com/mitchellh/go-homedir" diff --git a/pkg/skaffold/build/cache/retrieve_test.go b/pkg/skaffold/build/cache/retrieve_test.go index 90340757258..1418b6e2914 100644 --- a/pkg/skaffold/build/cache/retrieve_test.go +++ b/pkg/skaffold/build/cache/retrieve_test.go @@ -27,7 +27,7 @@ import ( "github.com/GoogleContainerTools/skaffold/pkg/skaffold/build/tag" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/config" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/docker" - runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/context" + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest" "github.com/GoogleContainerTools/skaffold/testutil" ) diff --git a/pkg/skaffold/build/cluster/cluster_test.go b/pkg/skaffold/build/cluster/cluster_test.go index 2b928b7275a..0d015c80c2c 100644 --- a/pkg/skaffold/build/cluster/cluster_test.go +++ b/pkg/skaffold/build/cluster/cluster_test.go @@ -19,7 +19,7 @@ package cluster import ( "testing" - runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/context" + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest" "github.com/GoogleContainerTools/skaffold/testutil" ) diff --git a/pkg/skaffold/build/cluster/types.go b/pkg/skaffold/build/cluster/types.go index 72f0dfe6c56..7cc80d45136 100644 --- a/pkg/skaffold/build/cluster/types.go +++ b/pkg/skaffold/build/cluster/types.go @@ -25,7 +25,7 @@ import ( "github.com/GoogleContainerTools/skaffold/pkg/skaffold/build" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/constants" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/docker" - runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/context" + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/util" "github.com/pkg/errors" diff --git a/pkg/skaffold/build/cluster/types_test.go b/pkg/skaffold/build/cluster/types_test.go index 2158e2bc431..676d2fbd6e1 100644 --- a/pkg/skaffold/build/cluster/types_test.go +++ b/pkg/skaffold/build/cluster/types_test.go @@ -21,8 +21,7 @@ import ( "testing" "time" - runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/context" - + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest" "github.com/GoogleContainerTools/skaffold/testutil" "github.com/google/go-cmp/cmp" diff --git a/pkg/skaffold/build/gcb/types.go b/pkg/skaffold/build/gcb/types.go index 47448249482..c6b73f82824 100644 --- a/pkg/skaffold/build/gcb/types.go +++ b/pkg/skaffold/build/gcb/types.go @@ -25,7 +25,7 @@ import ( "github.com/GoogleContainerTools/skaffold/pkg/skaffold/constants" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/docker" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/jib" - runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/context" + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/util" "github.com/pkg/errors" diff --git a/pkg/skaffold/build/local/custom_test.go b/pkg/skaffold/build/local/custom_test.go index 5412df5fded..f205a661406 100644 --- a/pkg/skaffold/build/local/custom_test.go +++ b/pkg/skaffold/build/local/custom_test.go @@ -20,7 +20,7 @@ import ( "testing" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/docker" - runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/context" + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest" "github.com/GoogleContainerTools/skaffold/testutil" ) diff --git a/pkg/skaffold/build/local/jib_gradle_test.go b/pkg/skaffold/build/local/jib_gradle_test.go index 69dda7f1f88..253ac94c564 100644 --- a/pkg/skaffold/build/local/jib_gradle_test.go +++ b/pkg/skaffold/build/local/jib_gradle_test.go @@ -23,7 +23,7 @@ import ( "github.com/GoogleContainerTools/skaffold/pkg/skaffold/docker" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/jib" - runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/context" + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/util" "github.com/GoogleContainerTools/skaffold/testutil" diff --git a/pkg/skaffold/build/local/jib_maven_test.go b/pkg/skaffold/build/local/jib_maven_test.go index 8c4b81423ae..b333d51aa60 100644 --- a/pkg/skaffold/build/local/jib_maven_test.go +++ b/pkg/skaffold/build/local/jib_maven_test.go @@ -23,7 +23,7 @@ import ( "github.com/GoogleContainerTools/skaffold/pkg/skaffold/docker" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/jib" - runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/context" + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/util" "github.com/GoogleContainerTools/skaffold/testutil" diff --git a/pkg/skaffold/build/local/local_test.go b/pkg/skaffold/build/local/local_test.go index 1df20b19e80..77bcb5453e8 100644 --- a/pkg/skaffold/build/local/local_test.go +++ b/pkg/skaffold/build/local/local_test.go @@ -25,7 +25,7 @@ import ( "github.com/GoogleContainerTools/skaffold/pkg/skaffold/build/tag" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/docker" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/event" - runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/context" + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/util" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/warnings" diff --git a/pkg/skaffold/build/local/types.go b/pkg/skaffold/build/local/types.go index 86dcdb2482f..c36005e6169 100644 --- a/pkg/skaffold/build/local/types.go +++ b/pkg/skaffold/build/local/types.go @@ -24,7 +24,7 @@ import ( configutil "github.com/GoogleContainerTools/skaffold/cmd/skaffold/app/cmd/config" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/constants" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/docker" - runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/context" + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest" "github.com/pkg/errors" "github.com/sirupsen/logrus" diff --git a/pkg/skaffold/debug/debug.go b/pkg/skaffold/debug/debug.go index 7ae6aba8bed..5a856ead60a 100644 --- a/pkg/skaffold/debug/debug.go +++ b/pkg/skaffold/debug/debug.go @@ -25,7 +25,7 @@ import ( "github.com/GoogleContainerTools/skaffold/pkg/skaffold/build" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/deploy/kubectl" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/docker" - runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/context" + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext" "github.com/pkg/errors" "github.com/sirupsen/logrus" "k8s.io/apimachinery/pkg/runtime" diff --git a/pkg/skaffold/deploy/helm.go b/pkg/skaffold/deploy/helm.go index bf308b0dac7..6e091467e6a 100644 --- a/pkg/skaffold/deploy/helm.go +++ b/pkg/skaffold/deploy/helm.go @@ -34,10 +34,10 @@ import ( "github.com/GoogleContainerTools/skaffold/pkg/skaffold/constants" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/docker" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/event" - runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/context" + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/util" - "github.com/mitchellh/go-homedir" + homedir "github.com/mitchellh/go-homedir" "github.com/pkg/errors" "github.com/sirupsen/logrus" yaml "gopkg.in/yaml.v2" diff --git a/pkg/skaffold/deploy/helm_test.go b/pkg/skaffold/deploy/helm_test.go index c1bb7542a74..3e9da432646 100644 --- a/pkg/skaffold/deploy/helm_test.go +++ b/pkg/skaffold/deploy/helm_test.go @@ -32,7 +32,7 @@ import ( "github.com/GoogleContainerTools/skaffold/pkg/skaffold/config" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/docker" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/event" - runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/context" + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest" schemautil "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/util" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/util" diff --git a/pkg/skaffold/deploy/kubectl.go b/pkg/skaffold/deploy/kubectl.go index 9dc2de1a5be..cc71e3fea64 100644 --- a/pkg/skaffold/deploy/kubectl.go +++ b/pkg/skaffold/deploy/kubectl.go @@ -25,7 +25,7 @@ import ( "github.com/GoogleContainerTools/skaffold/pkg/skaffold/constants" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/deploy/kubectl" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/event" - runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/context" + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/util" "github.com/pkg/errors" diff --git a/pkg/skaffold/deploy/kubectl_test.go b/pkg/skaffold/deploy/kubectl_test.go index d8e18903d9f..656873400a4 100644 --- a/pkg/skaffold/deploy/kubectl_test.go +++ b/pkg/skaffold/deploy/kubectl_test.go @@ -24,7 +24,7 @@ import ( "github.com/GoogleContainerTools/skaffold/pkg/skaffold/build" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/config" - runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/context" + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/util" "github.com/GoogleContainerTools/skaffold/testutil" diff --git a/pkg/skaffold/deploy/kustomize.go b/pkg/skaffold/deploy/kustomize.go index 1693a27af40..3935c4a4a19 100644 --- a/pkg/skaffold/deploy/kustomize.go +++ b/pkg/skaffold/deploy/kustomize.go @@ -32,7 +32,7 @@ import ( "github.com/GoogleContainerTools/skaffold/pkg/skaffold/constants" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/deploy/kubectl" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/event" - runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/context" + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/util" "github.com/pkg/errors" diff --git a/pkg/skaffold/deploy/kustomize_test.go b/pkg/skaffold/deploy/kustomize_test.go index 64ba89d6250..02f913c8cf4 100644 --- a/pkg/skaffold/deploy/kustomize_test.go +++ b/pkg/skaffold/deploy/kustomize_test.go @@ -23,7 +23,7 @@ import ( "github.com/GoogleContainerTools/skaffold/pkg/skaffold/build" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/config" - runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/context" + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/util" "github.com/GoogleContainerTools/skaffold/testutil" diff --git a/pkg/skaffold/deploy/status_check.go b/pkg/skaffold/deploy/status_check.go index 77e6a512c89..35f30445162 100644 --- a/pkg/skaffold/deploy/status_check.go +++ b/pkg/skaffold/deploy/status_check.go @@ -25,7 +25,7 @@ import ( "github.com/GoogleContainerTools/skaffold/pkg/skaffold/deploy/kubectl" kubernetesutil "github.com/GoogleContainerTools/skaffold/pkg/skaffold/kubernetes" - runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/context" + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext" "github.com/pkg/errors" "github.com/sirupsen/logrus" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/pkg/skaffold/docker/client.go b/pkg/skaffold/docker/client.go index 02736f56ae9..382e185aa97 100644 --- a/pkg/skaffold/docker/client.go +++ b/pkg/skaffold/docker/client.go @@ -30,7 +30,7 @@ import ( "sync" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/constants" - runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/context" + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/util" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/version" "github.com/docker/docker/api" diff --git a/pkg/skaffold/docker/image_util.go b/pkg/skaffold/docker/image_util.go index 82b0d8d34c3..3b54d8d3e38 100644 --- a/pkg/skaffold/docker/image_util.go +++ b/pkg/skaffold/docker/image_util.go @@ -20,7 +20,7 @@ import ( "context" "strings" - runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/context" + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext" v1 "github.com/google/go-containerregistry/pkg/v1" "github.com/pkg/errors" "github.com/sirupsen/logrus" diff --git a/pkg/skaffold/docker/parse.go b/pkg/skaffold/docker/parse.go index 76d9519b3c0..32e4bd52268 100644 --- a/pkg/skaffold/docker/parse.go +++ b/pkg/skaffold/docker/parse.go @@ -24,7 +24,7 @@ import ( "path/filepath" "strings" - runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/context" + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/util" v1 "github.com/google/go-containerregistry/pkg/v1" "github.com/moby/buildkit/frontend/dockerfile/command" diff --git a/pkg/skaffold/runner/deploy_test.go b/pkg/skaffold/runner/deploy_test.go index 9d289290c37..391005588b8 100644 --- a/pkg/skaffold/runner/deploy_test.go +++ b/pkg/skaffold/runner/deploy_test.go @@ -25,7 +25,7 @@ import ( "github.com/GoogleContainerTools/skaffold/pkg/skaffold/build" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/deploy" - runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/context" + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext" "github.com/GoogleContainerTools/skaffold/testutil" "k8s.io/client-go/tools/clientcmd/api" ) diff --git a/pkg/skaffold/runner/context/context.go b/pkg/skaffold/runner/runcontext/context.go similarity index 99% rename from pkg/skaffold/runner/context/context.go rename to pkg/skaffold/runner/runcontext/context.go index c76745851b4..f5cdaea8b62 100644 --- a/pkg/skaffold/runner/context/context.go +++ b/pkg/skaffold/runner/runcontext/context.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package context +package runcontext import ( "os" diff --git a/pkg/skaffold/runner/runner.go b/pkg/skaffold/runner/runner.go index 178856a6808..93c024b2aa6 100644 --- a/pkg/skaffold/runner/runner.go +++ b/pkg/skaffold/runner/runner.go @@ -35,11 +35,10 @@ import ( "github.com/GoogleContainerTools/skaffold/pkg/skaffold/filemon" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/kubernetes" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/kubernetes/portforward" - runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/context" + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/server" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/sync" - "github.com/GoogleContainerTools/skaffold/pkg/skaffold/sync/kubectl" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/test" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/trigger" "github.com/pkg/errors" @@ -114,6 +113,7 @@ func NewForConfig(runCtx *runcontext.RunContext) (*SkaffoldRunner, error) { } tester := getTester(runCtx) + syncer := getSyncer(runCtx) deployer, err := getDeployer(runCtx) if err != nil { @@ -144,7 +144,7 @@ func NewForConfig(runCtx *runcontext.RunContext) (*SkaffoldRunner, error) { Tester: tester, Deployer: deployer, Tagger: tagger, - Syncer: kubectl.NewSyncer(runCtx.Namespaces), + Syncer: syncer, monitor: monitor, listener: &SkaffoldListener{ Monitor: monitor, @@ -246,6 +246,10 @@ func getTester(runCtx *runcontext.RunContext) test.Tester { return test.NewTester(runCtx) } +func getSyncer(runCtx *runcontext.RunContext) sync.Syncer { + return sync.NewSyncer(runCtx) +} + func getDeployer(runCtx *runcontext.RunContext) (deploy.Deployer, error) { switch { case runCtx.Cfg.Deploy.HelmDeploy != nil: diff --git a/pkg/skaffold/runner/runner_test.go b/pkg/skaffold/runner/runner_test.go index 1c4901e15fa..1d44c443128 100644 --- a/pkg/skaffold/runner/runner_test.go +++ b/pkg/skaffold/runner/runner_test.go @@ -29,7 +29,7 @@ import ( "github.com/GoogleContainerTools/skaffold/pkg/skaffold/config" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/deploy" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/filemon" - runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/context" + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/defaults" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/sync" diff --git a/pkg/skaffold/sync/kubectl.go b/pkg/skaffold/sync/kubectl.go new file mode 100644 index 00000000000..3e69181908c --- /dev/null +++ b/pkg/skaffold/sync/kubectl.go @@ -0,0 +1,57 @@ +/* +Copyright 2019 The Skaffold Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package sync + +import ( + "context" + "io" + "os/exec" + + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/util" + v1 "k8s.io/api/core/v1" +) + +func deleteFileFn(ctx context.Context, pod v1.Pod, container v1.Container, files syncMap) *exec.Cmd { + args := []string{"exec", pod.Name, "--namespace", pod.Namespace, "-c", container.Name, + "--", "rm", "-rf", "--"} + + for _, dsts := range files { + args = append(args, dsts...) + } + + delete := exec.CommandContext(ctx, "kubectl", args...) + return delete +} + +func copyFileFn(ctx context.Context, pod v1.Pod, container v1.Container, files syncMap) *exec.Cmd { + args := []string{"exec", pod.Name, "--namespace", pod.Namespace, "-c", container.Name, "-i", + "--", "tar", "xmf", "-", "-C", "/", "--no-same-owner"} + + // Use "m" flag to touch the files as they are copied. + reader, writer := io.Pipe() + go func() { + if err := util.CreateMappedTar(writer, "/", files); err != nil { + writer.CloseWithError(err) + } else { + writer.Close() + } + }() + + copy := exec.CommandContext(ctx, "kubectl", args...) + copy.Stdin = reader + return copy +} diff --git a/pkg/skaffold/sync/kubectl/kubectl.go b/pkg/skaffold/sync/kubectl/kubectl.go deleted file mode 100644 index e11dcf4064f..00000000000 --- a/pkg/skaffold/sync/kubectl/kubectl.go +++ /dev/null @@ -1,87 +0,0 @@ -/* -Copyright 2019 The Skaffold Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package kubectl - -import ( - "context" - "io" - "os/exec" - - "github.com/GoogleContainerTools/skaffold/pkg/skaffold/sync" - "github.com/GoogleContainerTools/skaffold/pkg/skaffold/util" - "github.com/pkg/errors" - "github.com/sirupsen/logrus" - v1 "k8s.io/api/core/v1" -) - -type Syncer struct { - namespaces []string -} - -func NewSyncer(namespaces []string) *Syncer { - return &Syncer{ - namespaces: namespaces, - } -} - -func (k *Syncer) Sync(ctx context.Context, s *sync.Item) error { - if len(s.Copy) > 0 { - logrus.Infoln("Copying files:", s.Copy, "to", s.Image) - - if err := sync.Perform(ctx, s.Image, s.Copy, copyFileFn, k.namespaces); err != nil { - return errors.Wrap(err, "copying files") - } - } - - if len(s.Delete) > 0 { - logrus.Infoln("Deleting files:", s.Delete, "from", s.Image) - - if err := sync.Perform(ctx, s.Image, s.Delete, deleteFileFn, k.namespaces); err != nil { - return errors.Wrap(err, "deleting files") - } - } - - return nil -} - -func deleteFileFn(ctx context.Context, pod v1.Pod, container v1.Container, files map[string][]string) []*exec.Cmd { - // "kubectl" is below... - deleteCmd := []string{"exec", pod.Name, "--namespace", pod.Namespace, "-c", container.Name, "--", "rm", "-rf", "--"} - args := make([]string, 0, len(deleteCmd)+len(files)) - args = append(args, deleteCmd...) - for _, dsts := range files { - args = append(args, dsts...) - } - delete := exec.CommandContext(ctx, "kubectl", args...) - return []*exec.Cmd{delete} -} - -func copyFileFn(ctx context.Context, pod v1.Pod, container v1.Container, files map[string][]string) []*exec.Cmd { - // Use "m" flag to touch the files as they are copied. - reader, writer := io.Pipe() - copy := exec.CommandContext(ctx, "kubectl", "exec", pod.Name, "--namespace", pod.Namespace, "-c", container.Name, "-i", - "--", "tar", "xmf", "-", "-C", "/", "--no-same-owner") - copy.Stdin = reader - go func() { - defer writer.Close() - - if err := util.CreateMappedTar(writer, "/", files); err != nil { - logrus.Errorln("Error creating tar archive:", err) - } - }() - return []*exec.Cmd{copy} -} diff --git a/pkg/skaffold/sync/sync.go b/pkg/skaffold/sync/sync.go index f4566345f49..8d0f5b82a95 100644 --- a/pkg/skaffold/sync/sync.go +++ b/pkg/skaffold/sync/sync.go @@ -43,20 +43,6 @@ var ( WorkingDir = docker.RetrieveWorkingDir ) -type Syncer interface { - Sync(context.Context, *Item) error -} - -type syncMap map[string][]string - -type Item struct { - Image string - Copy map[string][]string - Delete map[string][]string -} - -type DestinationProvider func() (map[string][]string, error) - func NewItem(a *latest.Artifact, e filemon.Events, builds []build.Artifact, insecureRegistries map[string]bool, destProvider DestinationProvider) (*Item, error) { if !e.HasChanged() || a.Sync == nil { return nil, nil @@ -208,12 +194,33 @@ func matchSyncRules(syncRules []*latest.SyncRule, relPath, containerWd string) ( return dsts, nil } -func Perform(ctx context.Context, image string, files syncMap, cmdFn func(context.Context, v1.Pod, v1.Container, map[string][]string) []*exec.Cmd, namespaces []string) error { - errs, ctx := errgroup.WithContext(ctx) +func (k *podSyncer) Sync(ctx context.Context, s *Item) error { + if len(s.Copy) > 0 { + logrus.Infoln("Copying files:", s.Copy, "to", s.Image) + + if err := Perform(ctx, s.Image, s.Copy, copyFileFn, k.namespaces); err != nil { + return errors.Wrap(err, "copying files") + } + } + + if len(s.Delete) > 0 { + logrus.Infoln("Deleting files:", s.Delete, "from", s.Image) + + if err := Perform(ctx, s.Image, s.Delete, deleteFileFn, k.namespaces); err != nil { + return errors.Wrap(err, "deleting files") + } + } + + return nil +} + +func Perform(ctx context.Context, image string, files syncMap, cmdFn func(context.Context, v1.Pod, v1.Container, syncMap) *exec.Cmd, namespaces []string) error { if len(files) == 0 { return nil } + errs, ctx := errgroup.WithContext(ctx) + client, err := kubernetes.Client() if err != nil { return errors.Wrap(err, "getting k8s client") @@ -238,14 +245,12 @@ func Perform(ctx context.Context, image string, files syncMap, cmdFn func(contex continue } - cmds := cmdFn(ctx, p, c, files) - for _, cmd := range cmds { - errs.Go(func() error { - _, err := util.RunCmdOut(cmd) - return err - }) - numSynced++ - } + cmd := cmdFn(ctx, p, c, files) + errs.Go(func() error { + _, err := util.RunCmdOut(cmd) + return err + }) + numSynced++ } } } diff --git a/pkg/skaffold/sync/sync_test.go b/pkg/skaffold/sync/sync_test.go index cdf40b02b77..78568469a7d 100644 --- a/pkg/skaffold/sync/sync_test.go +++ b/pkg/skaffold/sync/sync_test.go @@ -730,16 +730,16 @@ func (t *TestCmdRecorder) RunCmdOut(cmd *exec.Cmd) ([]byte, error) { return nil, t.RunCmd(cmd) } -func fakeCmd(ctx context.Context, p v1.Pod, c v1.Container, files map[string][]string) []*exec.Cmd { - cmds := make([]*exec.Cmd, len(files)) - i := 0 +func fakeCmd(ctx context.Context, p v1.Pod, c v1.Container, files syncMap) *exec.Cmd { + var args []string + for src, dsts := range files { for _, dst := range dsts { - cmds[i] = exec.CommandContext(ctx, "copy", src, dst) - i++ + args = append(args, src, dst) } } - return cmds + + return exec.CommandContext(ctx, "copy", args...) } var pod = &v1.Pod{ @@ -788,7 +788,7 @@ func TestPerform(t *testing.T) { image string files syncMap pod *v1.Pod - cmdFn func(context.Context, v1.Pod, v1.Container, map[string][]string) []*exec.Cmd + cmdFn func(context.Context, v1.Pod, v1.Container, syncMap) *exec.Cmd cmdErr error clientErr error expected []string diff --git a/pkg/skaffold/sync/types.go b/pkg/skaffold/sync/types.go new file mode 100644 index 00000000000..b08412627b7 --- /dev/null +++ b/pkg/skaffold/sync/types.go @@ -0,0 +1,47 @@ +/* +Copyright 2019 The Skaffold Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package sync + +import ( + "context" + + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext" +) + +type syncMap map[string][]string + +type Item struct { + Image string + Copy map[string][]string + Delete map[string][]string +} + +type DestinationProvider func() (map[string][]string, error) + +type Syncer interface { + Sync(context.Context, *Item) error +} + +type podSyncer struct { + namespaces []string +} + +func NewSyncer(runCtx *runcontext.RunContext) Syncer { + return &podSyncer{ + namespaces: runCtx.Namespaces, + } +} diff --git a/pkg/skaffold/test/test.go b/pkg/skaffold/test/test.go index 415d77e641c..60e1e7a0d17 100644 --- a/pkg/skaffold/test/test.go +++ b/pkg/skaffold/test/test.go @@ -21,7 +21,7 @@ import ( "io" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/build" - runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/context" + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/test/structure" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/util" diff --git a/pkg/skaffold/test/test_test.go b/pkg/skaffold/test/test_test.go index 8cdab239709..61581f253df 100644 --- a/pkg/skaffold/test/test_test.go +++ b/pkg/skaffold/test/test_test.go @@ -23,7 +23,7 @@ import ( "testing" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/build" - runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/context" + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/util" "github.com/GoogleContainerTools/skaffold/testutil" diff --git a/pkg/skaffold/trigger/triggers.go b/pkg/skaffold/trigger/triggers.go index f30ac93d04e..75619c12047 100644 --- a/pkg/skaffold/trigger/triggers.go +++ b/pkg/skaffold/trigger/triggers.go @@ -27,7 +27,7 @@ import ( "time" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/color" - runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/context" + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext" "github.com/rjeczalik/notify" "github.com/sirupsen/logrus" ) diff --git a/pkg/skaffold/trigger/triggers_test.go b/pkg/skaffold/trigger/triggers_test.go index ab85ce0fbd4..02444448b1b 100644 --- a/pkg/skaffold/trigger/triggers_test.go +++ b/pkg/skaffold/trigger/triggers_test.go @@ -22,7 +22,7 @@ import ( "time" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/config" - runcontext "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/context" + "github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext" "github.com/GoogleContainerTools/skaffold/testutil" )