Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove podSelector from Runner #6076

Merged
merged 2 commits into from
Jun 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions integration/render_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ spec:
t.NewTempDir().
Write("deployment.yaml", test.input).
Chdir()
deployer, _, err := kubectl.NewDeployer(&runcontext.RunContext{
deployer, err := kubectl.NewDeployer(&runcontext.RunContext{
WorkingDir: ".",
Pipelines: runcontext.NewPipelines([]latestV1.Pipeline{{
Deploy: latestV1.DeployConfig{
Expand Down Expand Up @@ -235,7 +235,7 @@ spec:
Write("deployment.yaml", test.input).
Chdir()

deployer, _, err := kubectl.NewDeployer(&runcontext.RunContext{
deployer, err := kubectl.NewDeployer(&runcontext.RunContext{
WorkingDir: ".",
Pipelines: runcontext.NewPipelines([]latestV1.Pipeline{{
Deploy: latestV1.DeployConfig{
Expand Down Expand Up @@ -425,7 +425,7 @@ spec:
}
for _, test := range tests {
testutil.Run(t, test.description, func(t *testutil.T) {
deployer, _, err := helm.NewDeployer(&runcontext.RunContext{
deployer, err := helm.NewDeployer(&runcontext.RunContext{
Pipelines: runcontext.NewPipelines([]latestV1.Pipeline{{
Deploy: latestV1.DeployConfig{
DeployType: latestV1.DeployType{
Expand Down
8 changes: 4 additions & 4 deletions pkg/skaffold/deploy/helm/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@ type Config interface {
}

// NewDeployer returns a configured Deployer. Returns an error if current version of helm is less than 3.0.0.
func NewDeployer(cfg Config, labels map[string]string, provider deploy.ComponentProvider, h *latestV1.HelmDeploy) (*Deployer, *kubernetes.ImageList, error) {
func NewDeployer(cfg Config, labels map[string]string, provider deploy.ComponentProvider, h *latestV1.HelmDeploy) (*Deployer, error) {
hv, err := binVer()
if err != nil {
return nil, nil, versionGetErr(err)
return nil, versionGetErr(err)
}

if hv.LT(helm3Version) {
return nil, nil, minVersionErr()
return nil, minVersionErr()
}

originalImages := []graph.Artifact{}
Expand Down Expand Up @@ -155,7 +155,7 @@ func NewDeployer(cfg Config, labels map[string]string, provider deploy.Component
bV: hv,
enableDebug: cfg.Mode() == config.RunModes.Debug,
isMultiConfig: cfg.IsMultiConfig(),
}, podSelector, nil
}, nil
}

func (h *Deployer) GetAccessor() access.Accessor {
Expand Down
12 changes: 6 additions & 6 deletions pkg/skaffold/deploy/helm/helm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ func TestNewDeployer(t *testing.T) {
testutil.Run(t, test.description, func(t *testutil.T) {
t.Override(&util.DefaultExecCommand, testutil.CmdRunWithOutput("helm version --client", test.helmVersion))

_, _, err := NewDeployer(&helmConfig{}, nil, deploy.NoopComponentProvider, &testDeployConfig)
_, err := NewDeployer(&helmConfig{}, nil, deploy.NoopComponentProvider, &testDeployConfig)
t.CheckError(test.shouldErr, err)
})
}
Expand Down Expand Up @@ -1006,7 +1006,7 @@ func TestHelmDeploy(t *testing.T) {
t.Override(&util.DefaultExecCommand, test.commands)
t.Override(&osExecutable, func() (string, error) { return "SKAFFOLD-BINARY", nil })

deployer, _, err := NewDeployer(&helmConfig{
deployer, err := NewDeployer(&helmConfig{
namespace: test.namespace,
force: test.force,
configFile: "test.yaml",
Expand Down Expand Up @@ -1085,7 +1085,7 @@ func TestHelmCleanup(t *testing.T) {
t.Override(&util.OSEnviron, func() []string { return []string{"FOO=FOOBAR"} })
t.Override(&util.DefaultExecCommand, test.commands)

deployer, _, err := NewDeployer(&helmConfig{
deployer, err := NewDeployer(&helmConfig{
namespace: test.namespace,
}, nil, deploy.NoopComponentProvider, &test.helm)
t.RequireNoError(err)
Expand Down Expand Up @@ -1190,7 +1190,7 @@ func TestHelmDependencies(t *testing.T) {
local = tmpDir.Root()
}

deployer, _, err := NewDeployer(&helmConfig{}, nil, deploy.NoopComponentProvider, &latestV1.HelmDeploy{
deployer, err := NewDeployer(&helmConfig{}, nil, deploy.NoopComponentProvider, &latestV1.HelmDeploy{
Releases: []latestV1.HelmRelease{{
Name: "skaffold-helm",
ChartPath: local,
Expand Down Expand Up @@ -1453,7 +1453,7 @@ func TestHelmRender(t *testing.T) {

t.Override(&util.OSEnviron, func() []string { return append([]string{"FOO=FOOBAR"}, test.env...) })
t.Override(&util.DefaultExecCommand, test.commands)
deployer, _, err := NewDeployer(&helmConfig{
deployer, err := NewDeployer(&helmConfig{
namespace: test.namespace,
}, nil, deploy.NoopComponentProvider, &test.helm)
t.RequireNoError(err)
Expand Down Expand Up @@ -1524,7 +1524,7 @@ func TestGenerateSkaffoldDebugFilter(t *testing.T) {
for _, test := range tests {
testutil.Run(t, test.description, func(t *testutil.T) {
t.Override(&util.DefaultExecCommand, testutil.CmdRunWithOutput("helm version --client", version31))
h, _, err := NewDeployer(&helmConfig{}, nil, deploy.NoopComponentProvider, &testDeployConfig)
h, err := NewDeployer(&helmConfig{}, nil, deploy.NoopComponentProvider, &testDeployConfig)
t.RequireNoError(err)
result := h.generateSkaffoldDebugFilter(test.buildFile)
t.CheckDeepEqual(test.result, result)
Expand Down
4 changes: 2 additions & 2 deletions pkg/skaffold/deploy/kpt/kpt.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ type Config interface {
}

// NewDeployer generates a new Deployer object contains the kptDeploy schema.
func NewDeployer(cfg Config, labels map[string]string, provider deploy.ComponentProvider, d *latestV1.KptDeploy) (*Deployer, *kubernetes.ImageList) {
func NewDeployer(cfg Config, labels map[string]string, provider deploy.ComponentProvider, d *latestV1.KptDeploy) *Deployer {
podSelector := kubernetes.NewImageList()
return &Deployer{
KptDeploy: d,
Expand All @@ -114,7 +114,7 @@ func NewDeployer(cfg Config, labels map[string]string, provider deploy.Component
kubeContext: cfg.GetKubeContext(),
kubeConfig: cfg.GetKubeConfig(),
namespace: cfg.GetKubeNamespace(),
}, podSelector
}
}

func (k *Deployer) GetAccessor() access.Accessor {
Expand Down
14 changes: 7 additions & 7 deletions pkg/skaffold/deploy/kpt/kpt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ func TestKpt_Deploy(t *testing.T) {
t.Override(&util.DefaultExecCommand, test.commands)
t.NewTempDir().Chdir()

k, _ := NewDeployer(&kptConfig{}, nil, deploy.NoopComponentProvider, &test.kpt)
k := NewDeployer(&kptConfig{}, nil, deploy.NoopComponentProvider, &test.kpt)
if test.hasKustomization != nil {
k.hasKustomization = test.hasKustomization
}
Expand Down Expand Up @@ -374,7 +374,7 @@ func TestKpt_Dependencies(t *testing.T) {
tmpDir.WriteFiles(test.createFiles)
tmpDir.WriteFiles(test.kustomizations)

k, _ := NewDeployer(&kptConfig{}, nil, deploy.NoopComponentProvider, &test.kpt)
k := NewDeployer(&kptConfig{}, nil, deploy.NoopComponentProvider, &test.kpt)

res, err := k.Dependencies()

Expand Down Expand Up @@ -425,7 +425,7 @@ func TestKpt_Cleanup(t *testing.T) {
t.CheckNoError(os.Mkdir(test.applyDir, 0755))
}

k, _ := NewDeployer(&kptConfig{
k := NewDeployer(&kptConfig{
workingDir: ".",
}, nil, deploy.NoopComponentProvider, &latestV1.KptDeploy{
Live: latestV1.KptLive{
Expand Down Expand Up @@ -787,7 +787,7 @@ spec:
t.Override(&util.DefaultExecCommand, test.commands)
t.NewTempDir().Chdir()

k, _ := NewDeployer(&kptConfig{workingDir: "."}, test.labels, deploy.NoopComponentProvider, &test.kpt)
k := NewDeployer(&kptConfig{workingDir: "."}, test.labels, deploy.NoopComponentProvider, &test.kpt)
if test.hasKustomization != nil {
k.hasKustomization = test.hasKustomization
}
Expand Down Expand Up @@ -862,7 +862,7 @@ func TestKpt_GetApplyDir(t *testing.T) {
tmpDir.Touch(".kpt-hydrated/inventory-template.yaml")
}

k, _ := NewDeployer(&kptConfig{
k := NewDeployer(&kptConfig{
workingDir: ".",
}, nil, deploy.NoopComponentProvider, &latestV1.KptDeploy{
Live: test.live,
Expand Down Expand Up @@ -1023,7 +1023,7 @@ spec:
}
for _, test := range tests {
testutil.Run(t, test.description, func(t *testutil.T) {
k, _ := NewDeployer(&kptConfig{}, nil, deploy.NoopComponentProvider, nil)
k := NewDeployer(&kptConfig{}, nil, deploy.NoopComponentProvider, nil)
actualManifest, err := k.excludeKptFn(test.manifests)
t.CheckErrorAndDeepEqual(false, err, test.expected.String(), actualManifest.String())
})
Expand Down Expand Up @@ -1169,7 +1169,7 @@ func TestNonEmptyKubeconfig(t *testing.T) {

testutil.Run(t, "", func(t *testutil.T) {
t.Override(&util.DefaultExecCommand, commands)
k, _ := NewDeployer(&kptConfig{config: "testConfigPath"}, nil, deploy.NoopComponentProvider, &latestV1.KptDeploy{
k := NewDeployer(&kptConfig{config: "testConfigPath"}, nil, deploy.NoopComponentProvider, &latestV1.KptDeploy{
Dir: ".",
Live: latestV1.KptLive{
Apply: latestV1.KptApplyInventory{
Expand Down
6 changes: 3 additions & 3 deletions pkg/skaffold/deploy/kubectl/kubectl.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ type Deployer struct {

// NewDeployer returns a new Deployer for a DeployConfig filled
// with the needed configuration for `kubectl apply`
func NewDeployer(cfg Config, labels map[string]string, provider deploy.ComponentProvider, d *latestV1.KubectlDeploy) (*Deployer, *kubernetes.ImageList, error) {
func NewDeployer(cfg Config, labels map[string]string, provider deploy.ComponentProvider, d *latestV1.KubectlDeploy) (*Deployer, error) {
defaultNamespace := ""
if d.DefaultNamespace != nil {
var err error
defaultNamespace, err = util.ExpandEnvTemplate(*d.DefaultNamespace, nil)
if err != nil {
return nil, nil, err
return nil, err
}
}

Expand All @@ -100,7 +100,7 @@ func NewDeployer(cfg Config, labels map[string]string, provider deploy.Component
skipRender: cfg.SkipRender(),
labels: labels,
hydratedManifests: cfg.HydratedManifests(),
}, podSelector, nil
}, nil
}

func (k *Deployer) GetAccessor() access.Accessor {
Expand Down
18 changes: 9 additions & 9 deletions pkg/skaffold/deploy/kubectl/kubectl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func TestKubectlDeploy(t *testing.T) {
skaffoldNamespaceOption = TestNamespace
}

k, _, err := NewDeployer(&kubectlConfig{
k, err := NewDeployer(&kubectlConfig{
workingDir: ".",
force: test.forceDeploy,
waitForDeletions: config.WaitForDeletions{
Expand Down Expand Up @@ -313,7 +313,7 @@ func TestKubectlCleanup(t *testing.T) {
Write("deployment.yaml", DeploymentWebYAML).
Chdir()

k, _, err := NewDeployer(&kubectlConfig{
k, err := NewDeployer(&kubectlConfig{
workingDir: ".",
RunContext: runcontext.RunContext{Opts: config.SkaffoldOptions{Namespace: TestNamespace}},
}, nil, deploy.NoopComponentProvider, &test.kubectl)
Expand Down Expand Up @@ -360,7 +360,7 @@ func TestKubectlDeployerRemoteCleanup(t *testing.T) {
Write("deployment.yaml", DeploymentWebYAML).
Chdir()

k, _, err := NewDeployer(&kubectlConfig{
k, err := NewDeployer(&kubectlConfig{
workingDir: ".",
RunContext: runcontext.RunContext{Opts: config.SkaffoldOptions{Namespace: TestNamespace}},
}, nil, deploy.NoopComponentProvider, &test.kubectl)
Expand Down Expand Up @@ -391,7 +391,7 @@ func TestKubectlRedeploy(t *testing.T) {
AndRunInputOut("kubectl --context kubecontext get -f - --ignore-not-found -ojson", DeploymentAppYAMLv2+"\n---\n"+DeploymentWebYAMLv1, ""),
)

deployer, _, err := NewDeployer(&kubectlConfig{
deployer, err := NewDeployer(&kubectlConfig{
workingDir: ".",
waitForDeletions: config.WaitForDeletions{
Enabled: true,
Expand Down Expand Up @@ -454,7 +454,7 @@ func TestKubectlWaitForDeletions(t *testing.T) {
AndRunInput("kubectl --context kubecontext apply -f -", DeploymentWebYAMLv1),
)

deployer, _, err := NewDeployer(&kubectlConfig{
deployer, err := NewDeployer(&kubectlConfig{
workingDir: tmpDir.Root(),
waitForDeletions: config.WaitForDeletions{
Enabled: true,
Expand Down Expand Up @@ -491,7 +491,7 @@ func TestKubectlWaitForDeletionsFails(t *testing.T) {
}`),
)

deployer, _, err := NewDeployer(&kubectlConfig{
deployer, err := NewDeployer(&kubectlConfig{
workingDir: tmpDir.Root(),
waitForDeletions: config.WaitForDeletions{
Enabled: true,
Expand Down Expand Up @@ -559,7 +559,7 @@ func TestDependencies(t *testing.T) {
Touch("00/b.yaml", "00/a.yaml").
Chdir()

k, _, err := NewDeployer(&kubectlConfig{}, nil, deploy.NoopComponentProvider, &latestV1.KubectlDeploy{Manifests: test.manifests})
k, err := NewDeployer(&kubectlConfig{}, nil, deploy.NoopComponentProvider, &latestV1.KubectlDeploy{Manifests: test.manifests})
t.RequireNoError(err)

dependencies, err := k.Dependencies()
Expand Down Expand Up @@ -672,7 +672,7 @@ spec:
t.Override(&util.DefaultExecCommand, testutil.
CmdRunOut("kubectl version --client -ojson", KubectlVersion112).
AndRunOut("kubectl --context kubecontext create --dry-run -oyaml -f "+tmpDir.Path("deployment.yaml"), test.input))
deployer, _, err := NewDeployer(&kubectlConfig{
deployer, err := NewDeployer(&kubectlConfig{
workingDir: ".",
defaultRepo: "gcr.io/project",
}, nil, deploy.NoopComponentProvider, &latestV1.KubectlDeploy{
Expand Down Expand Up @@ -716,7 +716,7 @@ func TestGCSManifests(t *testing.T) {
if err := ioutil.WriteFile(manifest.ManifestTmpDir+"/deployment.yaml", []byte(DeploymentWebYAML), os.ModePerm); err != nil {
t.Fatal(err)
}
k, _, err := NewDeployer(&kubectlConfig{
k, err := NewDeployer(&kubectlConfig{
workingDir: ".",
skipRender: test.skipRender,
RunContext: runcontext.RunContext{Opts: config.SkaffoldOptions{Namespace: TestNamespace}},
Expand Down
6 changes: 3 additions & 3 deletions pkg/skaffold/deploy/kustomize/kustomize.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@ type Deployer struct {
useKubectlKustomize bool
}

func NewDeployer(cfg kubectl.Config, labels map[string]string, provider deploy.ComponentProvider, d *latestV1.KustomizeDeploy) (*Deployer, *kubernetes.ImageList, error) {
func NewDeployer(cfg kubectl.Config, labels map[string]string, provider deploy.ComponentProvider, d *latestV1.KustomizeDeploy) (*Deployer, error) {
defaultNamespace := ""
if d.DefaultNamespace != nil {
var err error
defaultNamespace, err = util.ExpandEnvTemplate(*d.DefaultNamespace, nil)
if err != nil {
return nil, nil, err
return nil, err
}
}

Expand All @@ -146,7 +146,7 @@ func NewDeployer(cfg kubectl.Config, labels map[string]string, provider deploy.C
globalConfig: cfg.GlobalConfig(),
labels: labels,
useKubectlKustomize: useKubectlKustomize,
}, podSelector, nil
}, nil
}

func (k *Deployer) GetAccessor() access.Accessor {
Expand Down
8 changes: 4 additions & 4 deletions pkg/skaffold/deploy/kustomize/kustomize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func TestKustomizeDeploy(t *testing.T) {
skaffoldNamespaceOption = kubectl.TestNamespace
}

k, _, err := NewDeployer(&kustomizeConfig{
k, err := NewDeployer(&kustomizeConfig{
workingDir: ".",
force: test.forceDeploy,
waitForDeletions: config.WaitForDeletions{
Expand Down Expand Up @@ -249,7 +249,7 @@ func TestKustomizeCleanup(t *testing.T) {
t.Override(&util.DefaultExecCommand, test.commands)
t.Override(&KustomizeBinaryCheck, func() bool { return true })

k, _, err := NewDeployer(&kustomizeConfig{
k, err := NewDeployer(&kustomizeConfig{
workingDir: tmpDir.Root(),
RunContext: runcontext.RunContext{Opts: config.SkaffoldOptions{
Namespace: kubectl.TestNamespace}},
Expand Down Expand Up @@ -455,7 +455,7 @@ func TestDependenciesForKustomization(t *testing.T) {
tmpDir.Write(path, contents)
}

k, _, err := NewDeployer(&kustomizeConfig{}, nil, deploy.NoopComponentProvider, &latestV1.KustomizeDeploy{KustomizePaths: kustomizePaths})
k, err := NewDeployer(&kustomizeConfig{}, nil, deploy.NoopComponentProvider, &latestV1.KustomizeDeploy{KustomizePaths: kustomizePaths})
t.RequireNoError(err)

deps, err := k.Dependencies()
Expand Down Expand Up @@ -696,7 +696,7 @@ spec:
t.Override(&util.DefaultExecCommand, fakeCmd)
t.NewTempDir().Chdir()

k, _, err := NewDeployer(&kustomizeConfig{
k, err := NewDeployer(&kustomizeConfig{
workingDir: ".",
RunContext: runcontext.RunContext{Opts: config.SkaffoldOptions{Namespace: kubectl.TestNamespace}},
}, test.labels, deploy.NoopComponentProvider, &latestV1.KustomizeDeploy{
Expand Down
Loading