Skip to content

Commit 8ced3d1

Browse files
authored
Merge pull request #18214 from rifelpet/disallow-gce-apiserver-none
gce: Disallow role=apiserver with dns=none
2 parents cfb47e3 + 9b37c31 commit 8ced3d1

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

pkg/apis/kops/validation/instancegroup.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ func CrossValidateInstanceGroup(g *kops.InstanceGroup, cluster *kops.Cluster, cl
242242
if cluster.GetCloudProvider() != kops.CloudProviderAWS && cluster.GetCloudProvider() != kops.CloudProviderGCE {
243243
allErrs = append(allErrs, field.Forbidden(field.NewPath("spec", "role"), "APIServer role only supported on AWS and GCE"))
244244
}
245-
if cluster.UsesNoneDNS() && cluster.GetCloudProvider() != kops.CloudProviderGCE {
245+
if cluster.UsesNoneDNS() {
246246
allErrs = append(allErrs, field.Forbidden(field.NewPath("spec", "role"), "APIServer cannot be used with topology.dns.type=None"))
247247
}
248248
}

pkg/apis/kops/validation/instancegroup_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ func TestCrossValidateAPIServerRole(t *testing.T) {
541541
ExpectedErrors: 0,
542542
},
543543
{
544-
Description: "APIServer role allowed on GCE with dns=None",
544+
Description: "APIServer role forbidden on GCE with dns=None",
545545
Cluster: &kops.Cluster{
546546
Spec: kops.ClusterSpec{
547547
CloudProvider: kops.CloudProviderSpec{
@@ -550,7 +550,7 @@ func TestCrossValidateAPIServerRole(t *testing.T) {
550550
Networking: kops.NetworkingSpec{Topology: noneDNSTopology},
551551
},
552552
},
553-
ExpectedErrors: 0,
553+
ExpectedErrors: 1,
554554
},
555555
{
556556
Description: "APIServer role forbidden on AWS with dns=None",

0 commit comments

Comments
 (0)