Skip to content

Commit 584cdb9

Browse files
author
Federico Arambarri
committed
Creating vnet.More vnet refactoring. Changing documentation
1 parent 87912dd commit 584cdb9

8 files changed

+328
-44
lines changed

cluster-stamp.bicep

+23-6
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ param gitOpsBootstrappingRepoHttpsUrl string
5252
@minLength(1)
5353
param gitOpsBootstrappingRepoBranch string = 'main'
5454

55+
@description('Subnet resource Id for the AKS jumpbox subnet')
56+
@minLength(79)
57+
param aksJumpboxSubnetResourceId string
58+
5559
/*** VARIABLES ***/
5660

5761
var kubernetesVersion = '1.23.12'
@@ -102,6 +106,24 @@ var pdEnforceImageSourceId = tenantResourceId('Microsoft.Authorization/policyDef
102106

103107
/*** EXISTING RESOURCE GROUP RESOURCES ***/
104108

109+
@description('The resource group name containing virtual network in which Jumpbox will be dropped.')
110+
resource rgJumpBoxVirutalNetwork 'Microsoft.Resources/resourceGroups@2021-04-01' existing = {
111+
scope: subscription()
112+
name: split(aksJumpboxSubnetResourceId, '/')[4]
113+
}
114+
115+
@description('Jumpbox Spoke Virtual Network')
116+
resource aksJumpBoxSpokeVnet 'Microsoft.Network/virtualNetworks@2022-01-01' existing = {
117+
scope: rgJumpBoxVirutalNetwork
118+
name: split(aksJumpboxSubnetResourceId, '/')[8]
119+
}
120+
121+
@description('Jumpbox subnet')
122+
resource aksJumpboxSubnet 'Microsoft.Network/virtualNetworks/subnets@2022-01-01' existing = {
123+
parent: aksJumpBoxSpokeVnet
124+
name: last(split(aksJumpboxSubnetResourceId, '/'))
125+
}
126+
105127
@description('Spoke resource group')
106128
resource spokeResourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' existing = {
107129
scope: subscription()
@@ -123,11 +145,6 @@ resource vnetSpoke 'Microsoft.Network/virtualNetworks@2022-01-01' existing = {
123145
name: 'snet-privatelinkendpoints'
124146
}
125147

126-
// spoke virtual network's subnet for managment ops
127-
resource snetManagmentOps 'subnets' existing = {
128-
name: 'snet-management-ops'
129-
}
130-
131148
// spoke virtual network's subnet for managment acr agent pools
132149
resource snetManagmentCrAgents 'subnets' existing = {
133150
name: 'snet-management-acragents'
@@ -677,7 +694,7 @@ resource vmssJumpboxes 'Microsoft.Compute/virtualMachineScaleSets@2020-12-01' =
677694
privateIPAddressVersion: 'IPv4'
678695
publicIPAddressConfiguration: null
679696
subnet: {
680-
id: vnetSpoke::snetManagmentOps.id
697+
id: aksJumpboxSubnet.id
681698
}
682699
}
683700
}

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
```

docs/deploy/10-aks-cluster.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Now that the all the [necessary bootstrapping requirements are deployed](./09-pr
5050
echo GITOPS_CURRENT_BRANCH_NAME: $GITOPS_CURRENT_BRANCH_NAME
5151

5252
# [This takes about 20 minutes to run.]
53-
az deployment group create -g rg-bu0001a0005 -f cluster-stamp.bicep -p targetVnetResourceId=${RESOURCEID_VNET_CLUSTERSPOKE} clusterAdminAadGroupObjectId=${AADOBJECTID_GROUP_CLUSTERADMIN} k8sControlPlaneAuthorizationTenantId=${TENANTID_K8SRBAC} appGatewayListenerCertificate=${APP_GATEWAY_LISTENER_CERTIFICATE_BASE64} jumpBoxImageResourceId=${RESOURCEID_IMAGE_JUMPBOX} jumpBoxCloudInitAsBase64=${CLOUDINIT_BASE64} gitOpsBootstrappingRepoHttpsUrl=${GITOPS_REPOURL} gitOpsBootstrappingRepoBranch=${GITOPS_CURRENT_BRANCH_NAME}
53+
az deployment group create -g rg-bu0001a0005 -f cluster-stamp.bicep -p targetVnetResourceId=${RESOURCEID_VNET_CLUSTERSPOKE} clusterAdminAadGroupObjectId=${AADOBJECTID_GROUP_CLUSTERADMIN} k8sControlPlaneAuthorizationTenantId=${TENANTID_K8SRBAC} appGatewayListenerCertificate=${APP_GATEWAY_LISTENER_CERTIFICATE_BASE64} jumpBoxImageResourceId=${RESOURCEID_IMAGE_JUMPBOX} jumpBoxCloudInitAsBase64=${CLOUDINIT_BASE64} gitOpsBootstrappingRepoHttpsUrl=${GITOPS_REPOURL} gitOpsBootstrappingRepoBranch=${GITOPS_CURRENT_BRANCH_NAME} aksJumpboxSubnetResourceId="${RESOURCEID_SUBNET_JUMPBOX}"
5454

5555
# Or if you updated and wish to use the parameters file …
5656
#az deployment group create -g rg-bu0001a0005 -f cluster-stamp.bicep -p "@azuredeploy.parameters.prod.json"

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
@@ -907,6 +907,22 @@ resource hubFirewall 'Microsoft.Network/azureFirewalls@2021-05-01' = {
907907
'login.microsoftonline.com'
908908
]
909909
}
910+
{
911+
name: 'api-server-address'
912+
description: 'Allow jumpboxes to perform kubectl.'
913+
sourceIpGroups: [
914+
aksJumpbox_ipgroup.id
915+
]
916+
protocols: [
917+
{
918+
protocolType: 'Https'
919+
port: 443
920+
}
921+
]
922+
targetFqdns: [
923+
'*.privatelink.${location}.azmk8s.io'
924+
]
925+
}
910926
{
911927
name: 'az-management-api'
912928
description: 'Allow jumpboxes to communicate with Azure management APIs.'

0 commit comments

Comments
 (0)