@@ -38,13 +38,14 @@ type ClusterParams struct {
3838}
3939
4040type Cluster struct {
41- Model * armcontainerservice.ManagedCluster
42- Kube * Kubeclient
43- KubeletIdentity * armcontainerservice.UserAssignedIdentity
44- SubnetID string
45- ClusterParams * ClusterParams
46- Bastion * Bastion
47- ProxyURL string
41+ Model * armcontainerservice.ManagedCluster
42+ Kube * Kubeclient
43+ KubeletIdentity * armcontainerservice.UserAssignedIdentity
44+ SubnetID string
45+ VNetResourceGUID string
46+ ClusterParams * ClusterParams
47+ Bastion * Bastion
48+ ProxyURL string
4849}
4950
5051// Returns true if the cluster is configured with Azure CNI
@@ -89,6 +90,9 @@ func prepareCluster(ctx context.Context, clusterModel *armcontainerservice.Manag
8990 })
9091 dag .Run (g , func (ctx context.Context ) error { return ensureMaintenanceConfiguration (ctx , cluster ) })
9192 subnet := dag .Go (g , func (ctx context.Context ) (string , error ) { return getClusterSubnetID (ctx , cluster ) })
93+ vNet := dag .Go (g , func (ctx context.Context ) (VNet , error ) {
94+ return getClusterVNet (ctx , * cluster .Properties .NodeResourceGroup )
95+ })
9296 kube := dag .Go (g , func (ctx context.Context ) (* Kubeclient , error ) { return getClusterKubeClient (ctx , cluster ) })
9397 identity := dag .Go (g , func (ctx context.Context ) (* armcontainerservice.UserAssignedIdentity , error ) {
9498 return getClusterKubeletIdentity (ctx , cluster )
@@ -131,13 +135,14 @@ func prepareCluster(ctx context.Context, clusterModel *armcontainerservice.Manag
131135 return nil , fmt .Errorf ("prepare cluster tasks: %w" , err )
132136 }
133137 return & Cluster {
134- Model : cluster ,
135- Kube : kube .MustGet (),
136- KubeletIdentity : identity .MustGet (),
137- SubnetID : subnet .MustGet (),
138- ClusterParams : extract .MustGet (),
139- Bastion : bastion .MustGet (),
140- ProxyURL : proxyURL .MustGet (),
138+ Model : cluster ,
139+ Kube : kube .MustGet (),
140+ KubeletIdentity : identity .MustGet (),
141+ SubnetID : subnet .MustGet (),
142+ VNetResourceGUID : vNet .MustGet ().resourceGUID ,
143+ ClusterParams : extract .MustGet (),
144+ Bastion : bastion .MustGet (),
145+ ProxyURL : proxyURL .MustGet (),
141146 }, nil
142147}
143148
@@ -702,8 +707,9 @@ func sanitizeAzureResourceName(name string) string {
702707}
703708
704709type VNet struct {
705- name string
706- subnetId string
710+ name string
711+ subnetId string
712+ resourceGUID string
707713}
708714
709715func getClusterVNet (ctx context.Context , mcResourceGroupName string ) (VNet , error ) {
@@ -717,7 +723,7 @@ func getClusterVNet(ctx context.Context, mcResourceGroupName string) (VNet, erro
717723 if v == nil {
718724 return VNet {}, fmt .Errorf ("aks vnet was empty" )
719725 }
720- return VNet {name : * v .Name , subnetId : fmt .Sprintf ("%s/subnets/%s" , * v .ID , "aks-subnet" )}, nil
726+ return VNet {name : * v .Name , subnetId : fmt .Sprintf ("%s/subnets/%s" , * v .ID , "aks-subnet" ), resourceGUID : * v . Properties . ResourceGUID }, nil
721727 }
722728 }
723729 return VNet {}, fmt .Errorf ("failed to find aks vnet" )
0 commit comments