mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 21:17:23 +00:00
Azure: Allow VNet to be in a separate Resource Group
Define a new config VnetResourceGroup in order to be able to use a VNet which is not in the same resource group as kubernetes. Signed-off-by: Sylvain Rabot <s.rabot@lectra.com>
This commit is contained in:
parent
0940a25440
commit
499d6c3473
@ -68,6 +68,8 @@ type Config struct {
|
|||||||
Location string `json:"location" yaml:"location"`
|
Location string `json:"location" yaml:"location"`
|
||||||
// The name of the VNet that the cluster is deployed in
|
// The name of the VNet that the cluster is deployed in
|
||||||
VnetName string `json:"vnetName" yaml:"vnetName"`
|
VnetName string `json:"vnetName" yaml:"vnetName"`
|
||||||
|
// The name of the resource group that the Vnet is deployed in
|
||||||
|
VnetResourceGroup string `json:"vnetResourceGroup" yaml:"vnetResourceGroup"`
|
||||||
// The name of the subnet that the cluster is deployed in
|
// The name of the subnet that the cluster is deployed in
|
||||||
SubnetName string `json:"subnetName" yaml:"subnetName"`
|
SubnetName string `json:"subnetName" yaml:"subnetName"`
|
||||||
// The name of the security group attached to the cluster's subnet
|
// The name of the security group attached to the cluster's subnet
|
||||||
|
@ -143,10 +143,17 @@ func (az *Cloud) getPublicIPAddress(name string) (pip network.PublicIPAddress, e
|
|||||||
|
|
||||||
func (az *Cloud) getSubnet(virtualNetworkName string, subnetName string) (subnet network.Subnet, exists bool, err error) {
|
func (az *Cloud) getSubnet(virtualNetworkName string, subnetName string) (subnet network.Subnet, exists bool, err error) {
|
||||||
var realErr error
|
var realErr error
|
||||||
|
var rg string
|
||||||
|
|
||||||
|
if len(az.VnetResourceGroup) > 0 {
|
||||||
|
rg = az.VnetResourceGroup
|
||||||
|
} else {
|
||||||
|
rg = az.ResourceGroup
|
||||||
|
}
|
||||||
|
|
||||||
az.operationPollRateLimiter.Accept()
|
az.operationPollRateLimiter.Accept()
|
||||||
glog.V(10).Infof("SubnetsClient.Get(%s): start", subnetName)
|
glog.V(10).Infof("SubnetsClient.Get(%s): start", subnetName)
|
||||||
subnet, err = az.SubnetsClient.Get(az.ResourceGroup, virtualNetworkName, subnetName, "")
|
subnet, err = az.SubnetsClient.Get(rg, virtualNetworkName, subnetName, "")
|
||||||
glog.V(10).Infof("SubnetsClient.Get(%s): end", subnetName)
|
glog.V(10).Infof("SubnetsClient.Get(%s): end", subnetName)
|
||||||
|
|
||||||
exists, realErr = checkResourceExistsFromError(err)
|
exists, realErr = checkResourceExistsFromError(err)
|
||||||
|
Loading…
Reference in New Issue
Block a user