Skip to content

Commit

Permalink
removed unnecessary validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Kanshyn committed Oct 17, 2023
1 parent 269b79e commit 1032a36
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 21 deletions.
6 changes: 0 additions & 6 deletions internal/resources/akscluster/akscluster_mapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,12 +290,6 @@ func constructNetworkConfig(data []any) (*models.VmwareTanzuManageV1alpha1Aksclu
networkConfig.PodCidrs = helper.SetPrimitiveList[string](v.([]any))
}

// Validation. DNS Server Ip or service CIDR cannot be set is network plugin is 'kubenet'
//TODO: this does not look like a valid requirement so far. Need an extra check
//if networkConfig.NetworkPlugin == "kubenet" && (networkConfig.DNSServiceIP != "" || networkConfig.ServiceCidrs != nil) {
// return networkConfig, errors.New("can not set network_config.dns_service_ip or network_config.service_cidr when network_config.network_plugin is set to kubenet")
//}

return networkConfig, nil
}

Expand Down
15 changes: 0 additions & 15 deletions internal/resources/akscluster/akscluster_mapper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,6 @@ func Test_ConstructAKSCluster(t *testing.T) {
assert.Equal(t, expected.Spec, result.Spec, "unexpected spec")
}

func Test_ConstructAKSCluster_withInvalidNetworkConfig(t *testing.T) {
t.Skip("Skip before we are sure that we have a valid requirements")
tests := []*schema.ResourceData{
schema.TestResourceDataRaw(t, akscluster.ClusterSchema, aTestClusterDataMap(withNetworkPlugin("kubenet"))),
schema.TestResourceDataRaw(t, akscluster.ClusterSchema, aTestClusterDataMap(withNetworkPlugin("kubenet"), withoutNetworkDNSServiceIP)),
schema.TestResourceDataRaw(t, akscluster.ClusterSchema, aTestClusterDataMap(withNetworkPlugin("kubenet"), withoutNetworkServiceCIDR)),
}

for _, d := range tests {
_, err := akscluster.ConstructCluster(d)
assert.NotNil(t, err)
assert.Equal(t, err.Error(), "can not set network_config.dns_service_ip or network_config.service_cidr when network_config.network_plugin is set to kubenet")
}
}

func Test_FlattenToMap_nilSpec(t *testing.T) {
got := akscluster.ToAKSClusterMap(nil, nil)
assert.Equal(t, []any{}, got)
Expand Down

0 comments on commit 1032a36

Please sign in to comment.