Skip to content

Commit

Permalink
remove single kubeContext validation (#6394)
Browse files Browse the repository at this point in the history
  • Loading branch information
gsquared94 authored Aug 11, 2021
1 parent a453306 commit 2664f56
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 89 deletions.
14 changes: 0 additions & 14 deletions pkg/skaffold/schema/validation/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ func Process(configs parser.SkaffoldConfigSet, validateConfig Options) error {
errs = append(errs, wrapWithContext(config, cfgErrs...)...)
}
errs = append(errs, validateArtifactDependencies(configs)...)
errs = append(errs, validateSingleKubeContext(configs)...)
if validateConfig.CheckDeploySource {
// TODO(6050) validate for other deploy types - helm, kpt, etc.
errs = append(errs, validateKubectlManifests(configs)...)
Expand Down Expand Up @@ -554,19 +553,6 @@ func validateLogPrefix(lc latestV1.LogsConfig) []error {
return nil
}

func validateSingleKubeContext(configs parser.SkaffoldConfigSet) []error {
if len(configs) < 2 {
return nil
}
k := configs[0].Deploy.KubeContext
for _, c := range configs {
if c.Deploy.KubeContext != k {
return []error{errors.New("all configs should have the same value for `deploy.kubeContext`")}
}
}
return nil
}

// validateCustomTest
// - makes sure that command is not empty
// - makes sure that dependencies.ignore is only used in conjunction with dependencies.paths
Expand Down
75 changes: 0 additions & 75 deletions pkg/skaffold/schema/validation/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package validation

import (
"context"
"errors"
"fmt"
"os"
"path/filepath"
Expand Down Expand Up @@ -1248,80 +1247,6 @@ func TestValidateUniqueDependencyAliases(t *testing.T) {
testutil.CheckDeepEqual(t, expected, errs, cmp.Comparer(errorsComparer))
}

func TestValidateSingleKubeContext(t *testing.T) {
tests := []struct {
description string
configs []*latestV1.SkaffoldConfig
err []error
}{
{
description: "different kubeContext specified",
configs: []*latestV1.SkaffoldConfig{
{
Pipeline: latestV1.Pipeline{
Deploy: latestV1.DeployConfig{
KubeContext: "",
},
},
},
{
Pipeline: latestV1.Pipeline{
Deploy: latestV1.DeployConfig{
KubeContext: "foo",
},
},
},
},
err: []error{errors.New("all configs should have the same value for `deploy.kubeContext`")},
},
{
description: "same kubeContext specified",
configs: []*latestV1.SkaffoldConfig{
{
Pipeline: latestV1.Pipeline{
Deploy: latestV1.DeployConfig{
KubeContext: "foo",
},
},
},
{
Pipeline: latestV1.Pipeline{
Deploy: latestV1.DeployConfig{
KubeContext: "foo",
},
},
},
},
},
{
description: "no kubeContext specified",
configs: []*latestV1.SkaffoldConfig{
{
Pipeline: latestV1.Pipeline{
Deploy: latestV1.DeployConfig{},
},
},
{
Pipeline: latestV1.Pipeline{
Deploy: latestV1.DeployConfig{},
},
},
},
},
}

for _, test := range tests {
testutil.Run(t, test.description, func(t *testutil.T) {
set := parser.SkaffoldConfigSet{}
for _, c := range test.configs {
set = append(set, &parser.SkaffoldConfigEntry{SkaffoldConfig: c})
}
errs := validateSingleKubeContext(set)
t.CheckDeepEqual(test.err, errs, cmp.Comparer(errorsComparer))
})
}
}

func TestValidateValidDependencyAliases(t *testing.T) {
cfgs := parser.SkaffoldConfigSet{
&parser.SkaffoldConfigEntry{
Expand Down

0 comments on commit 2664f56

Please sign in to comment.