Skip to content

Commit b0a3b53

Browse files
author
Federico Arambarri
committed
Creating vnet.More vnet refactoring. Changing documentation
1 parent 4680d4a commit b0a3b53

7 files changed

+327
-43
lines changed

cluster-stamp.bicep

+23-6
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ param jumpBoxImageResourceId string
7474
@minLength(100)
7575
param jumpBoxCloudInitAsBase64 string
7676

77+
@description('Subnet resource Id for the AKS jumpbox subnet')
78+
@minLength(79)
79+
param aksJumpboxSubnetResourceId string
80+
7781
/*** VARIABLES ***/
7882

7983
var kubernetesVersion = '1.23.12'
@@ -123,6 +127,24 @@ var pdEnforceImageSourceId = tenantResourceId('Microsoft.Authorization/policyDef
123127

124128
/*** EXISTING RESOURCE GROUP RESOURCES ***/
125129

130+
@description('The resource group name containing virtual network in which Jumpbox will be dropped.')
131+
resource rgJumpBoxVirutalNetwork 'Microsoft.Resources/resourceGroups@2021-04-01' existing = {
132+
scope: subscription()
133+
name: split(aksJumpboxSubnetResourceId, '/')[4]
134+
}
135+
136+
@description('Jumpbox Spoke Virtual Network')
137+
resource aksJumpBoxSpokeVnet 'Microsoft.Network/virtualNetworks@2022-01-01' existing = {
138+
scope: rgJumpBoxVirutalNetwork
139+
name: split(aksJumpboxSubnetResourceId, '/')[8]
140+
}
141+
142+
@description('Jumpbox subnet')
143+
resource aksJumpboxSubnet 'Microsoft.Network/virtualNetworks/subnets@2022-01-01' existing = {
144+
parent: aksJumpBoxSpokeVnet
145+
name: last(split(aksJumpboxSubnetResourceId, '/'))
146+
}
147+
126148
@description('Spoke resource group')
127149
resource spokeResourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' existing = {
128150
scope: subscription()
@@ -144,11 +166,6 @@ resource vnetSpoke 'Microsoft.Network/virtualNetworks@2022-01-01' existing = {
144166
name: 'snet-privatelinkendpoints'
145167
}
146168

147-
// spoke virtual network's subnet for managment ops
148-
resource snetManagmentOps 'subnets' existing = {
149-
name: 'snet-management-ops'
150-
}
151-
152169
// spoke virtual network's subnet for managment acr agent pools
153170
resource snetManagmentCrAgents 'subnets' existing = {
154171
name: 'snet-management-acragents'
@@ -817,7 +834,7 @@ resource vmssJumpboxes 'Microsoft.Compute/virtualMachineScaleSets@2020-12-01' =
817834
privateIPAddressVersion: 'IPv4'
818835
publicIPAddressConfiguration: null
819836
subnet: {
820-
id: vnetSpoke::snetManagmentOps.id
837+
id: aksJumpboxSubnet.id
821838
}
822839
}
823840
}

docs/deploy/06-aks-jumpboximage.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ You are going to be using Azure Image Builder to generate a Kubernetes-specific
3434

3535
### Deploy the spoke
3636

37-
1. Create the AKS jump box image builder network spoke.
37+
1. Create the AKS jump box image builder and JumpBox network spoke.
3838

3939
```bash
4040
RESOURCEID_VNET_HUB=$(az deployment group show -g rg-enterprise-networking-hubs -n hub-region.v0 --query properties.outputs.hubVnetId.value -o tsv)
@@ -52,8 +52,10 @@ You are going to be using Azure Image Builder to generate a Kubernetes-specific
5252
```bash
5353
RESOURCEID_SUBNET_AIB=$(az deployment group show -g rg-enterprise-networking-spokes -n spoke-BU0001A0005-00 --query properties.outputs.imageBuilderSubnetResourceId.value -o tsv)
5454

55+
RESOURCEID_SUBNET_JUMPBOX=$(az deployment group show -g rg-enterprise-networking-spokes -n spoke-BU0001A0005-00 --query properties.outputs.jumpboxSubnetResourceId.value -o tsv)
56+
5557
# [This takes about five minutes to run.]
56-
az deployment group create -g rg-enterprise-networking-hubs -f networking/hub-region.v1.bicep -p location=eastus2 aksImageBuilderSubnetResourceId="${RESOURCEID_SUBNET_AIB}"
58+
az deployment group create -g rg-enterprise-networking-hubs -f networking/hub-region.v1.bicep -p location=eastus2 aksImageBuilderSubnetResourceId="${RESOURCEID_SUBNET_AIB}" aksJumpboxSubnetResourceId="${RESOURCEID_SUBNET_JUMPBOX}"
5759
```
5860

5961
### Build and deploy the jump box image

docs/deploy/08-cluster-networking.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,8 @@ Your `rg-enterprise-networking-spokes` will be populated with the dedicated regi
3333
> :eyes: If you're curious to see what changed in the regional hub, [view the diff](https://diffviewer.azureedge.net/?l=https://raw.githubusercontent.com/mspnp/aks-baseline-regulated/main/networking/hub-region.v1.bicep&r=https://raw.githubusercontent.com/mspnp/aks-baseline-regulated/main/networking/hub-region.v2.bicep).
3434
3535
```bash
36-
RESOURCEID_SUBNET_AIB=$(az deployment group show -g rg-enterprise-networking-spokes -n spoke-BU0001A0005-00 --query properties.outputs.imageBuilderSubnetResourceId.value -o tsv)
3736
RESOURCEID_SUBNET_NODEPOOLS="['$(az deployment group show -g rg-enterprise-networking-spokes -n spoke-BU0001A0005-01 --query "properties.outputs.nodepoolSubnetResourceIds.value | join ('\',\'',@)" -o tsv)']"
38-
RESOURCEID_SUBNET_JUMPBOX=$(az deployment group show -g rg-enterprise-networking-spokes -n spoke-BU0001A0005-01 --query properties.outputs.jumpboxSubnetResourceId.value -o tsv)
39-
37+
4038
# [This takes about seven minutes to run.]
4139
az deployment group create -g rg-enterprise-networking-hubs -f networking/hub-region.v2.bicep -p location=eastus2 aksImageBuilderSubnetResourceId="${RESOURCEID_SUBNET_AIB}" nodepoolSubnetResourceIds="${RESOURCEID_SUBNET_NODEPOOLS}" aksJumpboxSubnetResourceId="${RESOURCEID_SUBNET_JUMPBOX}"
4240
```

networking/hub-region.v1.bicep

+33
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ targetScope = 'resourceGroup'
66
@minLength(79)
77
param aksImageBuilderSubnetResourceId string
88

9+
@description('Subnet resource Id for the AKS jumpbox subnet')
10+
@minLength(79)
11+
param aksJumpboxSubnetResourceId string
12+
913
@allowed([
1014
'australiaeast'
1115
'canadacentral'
@@ -70,6 +74,24 @@ resource aksImageBuilderSubnet 'Microsoft.Network/virtualNetworks/subnets@2022-0
7074
name: last(split(aksImageBuilderSubnetResourceId, '/'))
7175
}
7276

77+
@description('The resource group name containing virtual network in which Jumpbox will be dropped.')
78+
resource rgJumpBoxVirutalNetwork 'Microsoft.Resources/resourceGroups@2021-04-01' existing = {
79+
scope: subscription()
80+
name: split(aksJumpboxSubnetResourceId, '/')[4]
81+
}
82+
83+
@description('Jumpbox Spoke Virtual Network')
84+
resource aksJumpBoxSpokeVnet 'Microsoft.Network/virtualNetworks@2022-01-01' existing = {
85+
scope: rgJumpBoxVirutalNetwork
86+
name: split(aksJumpboxSubnetResourceId, '/')[8]
87+
}
88+
89+
@description('Jumpbox subnet')
90+
resource aksJumpboxSubnet 'Microsoft.Network/virtualNetworks/subnets@2022-01-01' existing = {
91+
parent: aksJumpBoxSpokeVnet
92+
name: last(split(aksJumpboxSubnetResourceId, '/'))
93+
}
94+
7395
resource networkWatcherResourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' existing = if (deployFlowLogResources) {
7496
scope: subscription()
7597
name: 'networkWatcherRG'
@@ -480,6 +502,17 @@ resource imageBuilder_ipgroups 'Microsoft.Network/ipGroups@2021-05-01' = {
480502
}
481503
}
482504

505+
@description('This holds IP addresses of known AKS Jumpbox image building subnets in attached spokes.')
506+
resource jumpbox_ipgroups 'Microsoft.Network/ipGroups@2021-05-01' = {
507+
name: 'ipg-${location}-AksJumpboxes'
508+
location: location
509+
properties: {
510+
ipAddresses: [
511+
aksJumpboxSubnet.properties.addressPrefix
512+
]
513+
}
514+
}
515+
483516
resource region_flowlog_storageAccount_diagnosticSettings 'Microsoft.Insights/diagnosticSettings@2017-05-01-preview' = if (deployFlowLogResources) {
484517
name: 'default'
485518
scope: flowlogs_storageAccount::blobStorage

networking/hub-region.v2.bicep

+16
Original file line numberDiff line numberDiff line change
@@ -905,6 +905,22 @@ resource hubFirewall 'Microsoft.Network/azureFirewalls@2021-05-01' = {
905905
'login.microsoftonline.com'
906906
]
907907
}
908+
{
909+
name: 'api-server-address'
910+
description: 'Allow jumpboxes to perform kubectl.'
911+
sourceIpGroups: [
912+
aksJumpbox_ipgroup.id
913+
]
914+
protocols: [
915+
{
916+
protocolType: 'Https'
917+
port: 443
918+
}
919+
]
920+
targetFqdns: [
921+
'*.privatelink.${location}.azmk8s.io'
922+
]
923+
}
908924
{
909925
name: 'az-management-api'
910926
description: 'Allow jumpboxes to communicate with Azure management APIs.'

0 commit comments

Comments
 (0)