Skip to content

Commit

Permalink
Ensure the subnet name is set
Browse files Browse the repository at this point in the history
  • Loading branch information
kylewuolle committed Nov 29, 2024
1 parent 901cd16 commit f3f9c0f
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions test/e2e/managedcluster/azure/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,23 @@ func SetAzureEnvironmentVariables(clusterName string, kc *kubeclient.KubeClient)

resourceGroup := spec["resourceGroup"]
GinkgoT().Setenv("AZURE_RESOURCE_GROUP", fmt.Sprintf("%s", resourceGroup))
subnetMap, ok := subnets[0].(map[string]any)
Expect(ok).To(BeTrue())

var subnetMap map[string]any
for _, subnet := range subnets {
sMap, ok := subnet.(map[string]any)
Expect(ok).To(BeTrue())

routeTable, exists, err := unstructured.NestedMap(sMap, "routeTable")
Expect(err).NotTo(HaveOccurred())
Expect(exists).To(BeTrue())
routeTableName := routeTable["name"]

if routeTableName != nil && len(fmt.Sprintf("%s", routeTableName)) > 0 {
subnetMap = sMap
break
}
}

subnetName := subnetMap["name"]
GinkgoT().Setenv("AZURE_NODE_SUBNET", fmt.Sprintf("%s", subnetName))

Expand Down

0 comments on commit f3f9c0f

Please sign in to comment.