Skip to content

Commit 2664f56

Browse files
authored
remove single kubeContext validation (#6394)
1 parent a453306 commit 2664f56

File tree

2 files changed

+0
-89
lines changed

2 files changed

+0
-89
lines changed

pkg/skaffold/schema/validation/validation.go

-14
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ func Process(configs parser.SkaffoldConfigSet, validateConfig Options) error {
8080
errs = append(errs, wrapWithContext(config, cfgErrs...)...)
8181
}
8282
errs = append(errs, validateArtifactDependencies(configs)...)
83-
errs = append(errs, validateSingleKubeContext(configs)...)
8483
if validateConfig.CheckDeploySource {
8584
// TODO(6050) validate for other deploy types - helm, kpt, etc.
8685
errs = append(errs, validateKubectlManifests(configs)...)
@@ -554,19 +553,6 @@ func validateLogPrefix(lc latestV1.LogsConfig) []error {
554553
return nil
555554
}
556555

557-
func validateSingleKubeContext(configs parser.SkaffoldConfigSet) []error {
558-
if len(configs) < 2 {
559-
return nil
560-
}
561-
k := configs[0].Deploy.KubeContext
562-
for _, c := range configs {
563-
if c.Deploy.KubeContext != k {
564-
return []error{errors.New("all configs should have the same value for `deploy.kubeContext`")}
565-
}
566-
}
567-
return nil
568-
}
569-
570556
// validateCustomTest
571557
// - makes sure that command is not empty
572558
// - makes sure that dependencies.ignore is only used in conjunction with dependencies.paths

pkg/skaffold/schema/validation/validation_test.go

-75
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package validation
1818

1919
import (
2020
"context"
21-
"errors"
2221
"fmt"
2322
"os"
2423
"path/filepath"
@@ -1248,80 +1247,6 @@ func TestValidateUniqueDependencyAliases(t *testing.T) {
12481247
testutil.CheckDeepEqual(t, expected, errs, cmp.Comparer(errorsComparer))
12491248
}
12501249

1251-
func TestValidateSingleKubeContext(t *testing.T) {
1252-
tests := []struct {
1253-
description string
1254-
configs []*latestV1.SkaffoldConfig
1255-
err []error
1256-
}{
1257-
{
1258-
description: "different kubeContext specified",
1259-
configs: []*latestV1.SkaffoldConfig{
1260-
{
1261-
Pipeline: latestV1.Pipeline{
1262-
Deploy: latestV1.DeployConfig{
1263-
KubeContext: "",
1264-
},
1265-
},
1266-
},
1267-
{
1268-
Pipeline: latestV1.Pipeline{
1269-
Deploy: latestV1.DeployConfig{
1270-
KubeContext: "foo",
1271-
},
1272-
},
1273-
},
1274-
},
1275-
err: []error{errors.New("all configs should have the same value for `deploy.kubeContext`")},
1276-
},
1277-
{
1278-
description: "same kubeContext specified",
1279-
configs: []*latestV1.SkaffoldConfig{
1280-
{
1281-
Pipeline: latestV1.Pipeline{
1282-
Deploy: latestV1.DeployConfig{
1283-
KubeContext: "foo",
1284-
},
1285-
},
1286-
},
1287-
{
1288-
Pipeline: latestV1.Pipeline{
1289-
Deploy: latestV1.DeployConfig{
1290-
KubeContext: "foo",
1291-
},
1292-
},
1293-
},
1294-
},
1295-
},
1296-
{
1297-
description: "no kubeContext specified",
1298-
configs: []*latestV1.SkaffoldConfig{
1299-
{
1300-
Pipeline: latestV1.Pipeline{
1301-
Deploy: latestV1.DeployConfig{},
1302-
},
1303-
},
1304-
{
1305-
Pipeline: latestV1.Pipeline{
1306-
Deploy: latestV1.DeployConfig{},
1307-
},
1308-
},
1309-
},
1310-
},
1311-
}
1312-
1313-
for _, test := range tests {
1314-
testutil.Run(t, test.description, func(t *testutil.T) {
1315-
set := parser.SkaffoldConfigSet{}
1316-
for _, c := range test.configs {
1317-
set = append(set, &parser.SkaffoldConfigEntry{SkaffoldConfig: c})
1318-
}
1319-
errs := validateSingleKubeContext(set)
1320-
t.CheckDeepEqual(test.err, errs, cmp.Comparer(errorsComparer))
1321-
})
1322-
}
1323-
}
1324-
13251250
func TestValidateValidDependencyAliases(t *testing.T) {
13261251
cfgs := parser.SkaffoldConfigSet{
13271252
&parser.SkaffoldConfigEntry{

0 commit comments

Comments
 (0)