Skip to content
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
2 changes: 1 addition & 1 deletion pkg/apis/kops/validation/instancegroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ func CrossValidateInstanceGroup(g *kops.InstanceGroup, cluster *kops.Cluster, cl
if cluster.GetCloudProvider() != kops.CloudProviderAWS && cluster.GetCloudProvider() != kops.CloudProviderGCE {
allErrs = append(allErrs, field.Forbidden(field.NewPath("spec", "role"), "APIServer role only supported on AWS and GCE"))
}
if cluster.UsesNoneDNS() {
if cluster.UsesNoneDNS() && cluster.GetCloudProvider() != kops.CloudProviderGCE {
allErrs = append(allErrs, field.Forbidden(field.NewPath("spec", "role"), "APIServer cannot be used with topology.dns.type=None"))
}
}
Expand Down
25 changes: 25 additions & 0 deletions pkg/apis/kops/validation/instancegroup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ func createMinimalInstanceGroup() *kops.InstanceGroup {
}

func TestCrossValidateAPIServerRole(t *testing.T) {
noneDNSTopology := &kops.TopologySpec{DNS: kops.DNSTypeNone}
grid := []struct {
Description string
Cluster *kops.Cluster
Expand Down Expand Up @@ -539,6 +540,30 @@ func TestCrossValidateAPIServerRole(t *testing.T) {
},
ExpectedErrors: 0,
},
{
Description: "APIServer role allowed on GCE with dns=None",
Cluster: &kops.Cluster{
Spec: kops.ClusterSpec{
CloudProvider: kops.CloudProviderSpec{
GCE: &kops.GCESpec{},
},
Networking: kops.NetworkingSpec{Topology: noneDNSTopology},
},
},
ExpectedErrors: 0,
},
{
Description: "APIServer role forbidden on AWS with dns=None",
Cluster: &kops.Cluster{
Spec: kops.ClusterSpec{
CloudProvider: kops.CloudProviderSpec{
AWS: &kops.AWSSpec{},
},
Networking: kops.NetworkingSpec{Topology: noneDNSTopology},
},
},
ExpectedErrors: 1,
},
{
Description: "APIServer role forbidden on DO",
Cluster: &kops.Cluster{
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/templates/apiserver-gce.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ spec:
type: Public
topology:
dns:
type: Public
type: None

---

Expand Down
Loading