Skip to content

Commit

Permalink
chore(tests): update AKS cluster version in tests (#486)
Browse files Browse the repository at this point in the history
Update AKS cluster version in tests

Signed-off-by: Vivek Goyal <[email protected]>
  • Loading branch information
vivgoyal authored Dec 26, 2024
1 parent 9dc4062 commit 86f2f1a
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 2 deletions.
9 changes: 9 additions & 0 deletions internal/models/akscluster/network_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ const (

// VmwareTanzuManageV1alpha1AksClusterNetworkPluginModeOverlay captures value "overlay".
VmwareTanzuManageV1alpha1AksClusterNetworkPluginModeOverlay = "overlay"

// VmwareTanzuManageV1alpha1AksClusterNetworkDataplaneCilium captures value "cilium".
VmwareTanzuManageV1alpha1AksClusterNetworkDataplaneCilium = "cilium"

// VmwareTanzuManageV1alpha1AksClusterNetworkDataplaneAzure captures value "azure".
VmwareTanzuManageV1alpha1AksClusterNetworkDataplaneAzure = "azure"
)

// VmwareTanzuManageV1alpha1AksclusterNetworkConfig The network configuration for the AKS cluster.
Expand Down Expand Up @@ -52,6 +58,9 @@ type VmwareTanzuManageV1alpha1AksclusterNetworkConfig struct {

// The CIDR notation IP ranges from which to assign service cluster IPs.
ServiceCidrs []string `json:"serviceCidrs"`

// Network dataplane used in the Kubernetes cluster. The valid value is azure and cilium.
NetworkDataplane string `json:"networkDataplane,omitempty"`
}

// MarshalBinary interface implementation.
Expand Down
5 changes: 5 additions & 0 deletions internal/resources/akscluster/akscluster_mapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,10 @@ func constructNetworkConfig(data []any) *models.VmwareTanzuManageV1alpha1Aksclus
networkConfig.PodCidrs = helper.SetPrimitiveList[string](v.([]any), podCidrKey)
}

if v, ok := networkConfigData[networkDataplaneKey]; ok {
helper.SetPrimitiveValue(v, &networkConfig.NetworkDataplane, networkDataplaneKey)
}

return networkConfig
}

Expand Down Expand Up @@ -608,6 +612,7 @@ func toNetworkConfigMap(config *models.VmwareTanzuManageV1alpha1AksclusterNetwor
data[dockerBridgeCidrKey] = config.DockerBridgeCidr
data[podCidrKey] = toInterfaceArray(config.PodCidrs)
data[serviceCidrKey] = toInterfaceArray(config.ServiceCidrs)
data[networkDataplaneKey] = config.NetworkDataplane

return []any{data}
}
Expand Down
1 change: 1 addition & 0 deletions internal/resources/akscluster/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const (
loadBalancerSkuKey = "load_balancer_sku"
networkPluginKey = "network_plugin"
networkPluginModeKey = "network_plugin_mode"
networkDataplaneKey = "network_dataplane"
networkPolicyKey = "network_policy"
dnsServiceIPKey = "dns_service_ip"
dockerBridgeCidrKey = "docker_bridge_cidr"
Expand Down
1 change: 1 addition & 0 deletions internal/resources/akscluster/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ func aTestClusterDataMap(w ...mapWither) map[string]any {
"pod_cidr": nil,
"service_cidr": []any{"127.0.0.4"},
"dns_prefix": "net-prefix",
"network_dataplane": "",
}},
"storage_config": []any{map[string]any{
"enable_disk_csi_driver": true,
Expand Down
19 changes: 17 additions & 2 deletions internal/resources/akscluster/resource_akscluster_acc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import (
)

// Version of Kubernetes to deploy during acceptance tests.
var aksKubernetesVersion = "1.27.9"
var aksKubernetesVersion = "1.28.0"

func validateSetup(t *testing.T) {
// Check if the required environment variables are set
Expand Down Expand Up @@ -414,6 +414,9 @@ func testAKSCluster(fn *aksmodel.VmwareTanzuManageV1alpha1AksclusterFullName) st
count = 1
mode = "SYSTEM"
vm_size = "Standard_DS2_v2"
upgrade_config {
max_surge = "10%%"
}
}
}
}
Expand Down Expand Up @@ -448,6 +451,9 @@ func testAKSClusterEnableCSI(fn *aksmodel.VmwareTanzuManageV1alpha1AksclusterFul
count = 1
mode = "SYSTEM"
vm_size = "Standard_DS2_v2"
upgrade_config {
max_surge = "10%%"
}
}
}
}
Expand Down Expand Up @@ -482,6 +488,9 @@ func testAKSClusterAddUserNodepool(fn *aksmodel.VmwareTanzuManageV1alpha1Aksclus
count = 1
mode = "SYSTEM"
vm_size = "Standard_DS2_v2"
upgrade_config {
max_surge = "10%%"
}
}
}
nodepool {
Expand All @@ -490,6 +499,9 @@ func testAKSClusterAddUserNodepool(fn *aksmodel.VmwareTanzuManageV1alpha1Aksclus
count = 1
mode = "USER"
vm_size = "Standard_DS2_v2"
upgrade_config {
max_surge = "10%%"
}
}
}
}
Expand Down Expand Up @@ -545,7 +557,10 @@ func mockNodepool(w ...nodepoolWither) *aksmodel.VmwareTanzuManageV1alpha1Aksclu
Mode: aksmodel.VmwareTanzuManageV1alpha1AksclusterNodepoolModeSYSTEM.Pointer(),
OsType: aksmodel.VmwareTanzuManageV1alpha1AksclusterNodepoolOsTypeLINUX.Pointer(),
VMSize: "Standard_DS2_v2",
Type: aksmodel.VmwareTanzuManageV1alpha1AksclusterNodepoolTypeVIRTUALMACHINESCALESETS.Pointer(),
UpgradeConfig: &aksmodel.VmwareTanzuManageV1alpha1AksclusterNodepoolUpgradeConfig{
MaxSurge: "10%",
},
Type: aksmodel.VmwareTanzuManageV1alpha1AksclusterNodepoolTypeVIRTUALMACHINESCALESETS.Pointer(),
},
Status: &aksmodel.VmwareTanzuManageV1alpha1AksclusterNodepoolStatus{
Phase: aksmodel.VmwareTanzuManageV1alpha1AksclusterNodepoolPhaseREADY.Pointer(),
Expand Down
11 changes: 11 additions & 0 deletions internal/resources/akscluster/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,17 @@ var NetworkConfig = &schema.Resource{
ForceNew: true,
Required: true,
},
networkDataplaneKey: {
Type: schema.TypeString,
Description: "Network dataplane used in the Kubernetes cluster. The valid value is azure and cilium.",
ForceNew: true,
Optional: true,
Computed: true,
ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice([]string{"",
aksmodel.VmwareTanzuManageV1alpha1AksClusterNetworkDataplaneCilium,
aksmodel.VmwareTanzuManageV1alpha1AksClusterNetworkDataplaneAzure,
}, false)),
},
},
}

Expand Down

0 comments on commit 86f2f1a

Please sign in to comment.