Skip to content

Commit 64a0d5e

Browse files
author
Gordon Byers
authored
Merge pull request #142 from Azure/gb-biceptweaks
A few small bicep param improvements
2 parents 3485c12 + 423b952 commit 64a0d5e

File tree

7 files changed

+220
-31
lines changed

7 files changed

+220
-31
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
3+
"contentVersion": "1.0.0.0",
4+
"parameters": {
5+
"resourceName": {
6+
"value": "az-k8s-keyvault"
7+
},
8+
"custom_vnet": {
9+
"value": true
10+
},
11+
"registries_sku": {
12+
"value": "Premium"
13+
},
14+
"omsagent": {
15+
"value": true
16+
},
17+
"ingressApplicationGateway": {
18+
"value": true
19+
},
20+
"appGWcount": {
21+
"value": 0
22+
},
23+
"appGWsku": {
24+
"value": "WAF_v2"
25+
},
26+
"appGWmaxCount": {
27+
"value": 2
28+
},
29+
"privateIpApplicationGateway": {
30+
"value": "10.2.0.4"
31+
},
32+
"appgwKVIntegration": {
33+
"value": true
34+
},
35+
"azureKeyvaultSecretsProvider": {
36+
"value": true
37+
},
38+
"createKV": {
39+
"value": true
40+
},
41+
"kvIPWhitelist": {
42+
"value": [
43+
"1.2.3.4/32"
44+
]
45+
}
46+
}
47+
}

CONTRIBUTING.md

+17-4
Original file line numberDiff line numberDiff line change
@@ -72,21 +72,34 @@ We anticipate the use of the Develop branch is temporary.
7272

7373
Releases are used to capture a tested release (all stages, not just Validation), where there are significant new features or bugfixes. The release does not include CI Action files, just the Bicep code.
7474

75-
## The Wizard Web App
75+
## Area change guidance
76+
77+
### Bicep code
78+
79+
When changing the Bicep code, try to build into your `developer inner loop` the following
80+
81+
- Review the linting warnings in VSCode. When you push, the bicep will be compiled to json with warnings/errors picked up
82+
- If making a breaking change (eg. changing a parameter datatype), pay attention to the Regression parameter files. These will be checked during PR. If the change you're making isn't covered by an existing parameter file, then add one.
83+
84+
#### Breaking Changes
85+
86+
Should be avoided wherever possible, and where necessary highlight the breaking change in the release notes.
87+
88+
### The Wizard Web App
7689

7790
The [configuration experience](https://azure.github.io/Aks-Construction/) is hosted in GitHub pages. It's a static web app, written in NodeJS using FluentUI.
7891

79-
### Playwright tests
92+
#### Playwright tests
8093

8194
Playwright is used to help verify that the app works properly, you can use Playwright in your local dev experience (see Codespaces below), but crucially it's also leveraged as part of the publish process. If the tests don't pass, then the app will not publish. The `fragile` keyword should be used in any tests where you're learning how they work and run. Once the test is of sufficient quality to be considered a core test, the `fragile` keyword is removed.
8295

8396
We're trying to ensure that PR's that contain Web UI changes have appropriate Playwright tests that use `data-testid` for navigating the dom.
8497

85-
## Dev Container / Codespaces
98+
### Dev Container / Codespaces
8699

87100
A dev container is present in the repo which makes dev and testing of the UI Helper component much easier.
88101

89-
### Commands
102+
#### Commands
90103

91104
Some helpful terminal commands for when you're getting started with DevContainer/Codespaces experience
92105

bicep/compiled/main.json

+44-12
Large diffs are not rendered by default.

bicep/main.bicep

+32-14
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ param KeyVaultSoftDelete bool = true
159159
param KeyVaultPurgeProtection bool = true
160160

161161
@description('Add IP to firewall whitelist')
162-
param kvIPWhitelist string = ''
162+
param kvIPWhitelist array = []
163163

164164
var akvName = 'kv-${replace(resourceName, '-', '')}'
165165

@@ -178,12 +178,7 @@ resource kv 'Microsoft.KeyVault/vaults@2021-06-01-preview' = if (createKV) {
178178
networkAcls: privateLinks && !empty(kvIPWhitelist) ? {
179179
bypass: 'AzureServices'
180180
defaultAction: 'Deny'
181-
182-
ipRules: empty(kvIPWhitelist) ? [] : [
183-
{
184-
value: kvIPWhitelist
185-
}
186-
]
181+
ipRules: kvIPWhitelist
187182
virtualNetworkRules: []
188183
} : {}
189184

@@ -674,24 +669,48 @@ param JustUseSystemPool bool = false
674669
@allowed([
675670
'Cost-Optimised'
676671
'Standard'
672+
'HighSpec'
673+
'Custom'
677674
])
678675
@description('The System Pool Preset sizing')
679676
param SystemPoolType string = 'Cost-Optimised'
680677

678+
@description('A custom system pool spec')
679+
param SystemPoolCustomPreset object = {}
680+
681+
@description('System Pool presets are derived from the recommended system pool specs')
681682
var systemPoolPresets = {
682683
'Cost-Optimised' : {
683684
vmSize: 'Standard_B4ms'
684685
count: 1
685686
minCount: 1
686687
maxCount: 3
687688
enableAutoScaling: true
689+
availabilityZones: []
688690
}
689691
'Standard' : {
692+
vmSize: 'Standard_DS2_v2'
693+
count: 3
694+
minCount: 3
695+
maxCount: 5
696+
enableAutoScaling: true
697+
availabilityZones: [
698+
'1'
699+
'2'
700+
'3'
701+
]
702+
}
703+
'HighSpec' : {
690704
vmSize: 'Standard_D4s_v3'
691-
count: 2
692-
minCount: 2
693-
maxCount: 3
705+
count: 3
706+
minCount: 3
707+
maxCount: 5
694708
enableAutoScaling: true
709+
availabilityZones: [
710+
'1'
711+
'2'
712+
'3'
713+
]
695714
}
696715
}
697716

@@ -701,7 +720,6 @@ var systemPoolBase = {
701720
osType: 'Linux'
702721
maxPods: 30
703722
type: 'VirtualMachineScaleSets'
704-
availabilityZones: !empty(availabilityZones) ? availabilityZones : null
705723
vnetSubnetID: !empty(aksSubnetId) ? aksSubnetId : json('null')
706724
upgradeSettings: {
707725
maxSurge: '33%'
@@ -717,6 +735,7 @@ var userPoolVmProfile = {
717735
minCount: autoScale ? agentCount : json('null')
718736
maxCount: autoScale ? agentCountMax : json('null')
719737
enableAutoScaling: autoScale
738+
availabilityZones: !empty(availabilityZones) ? availabilityZones : null
720739
}
721740

722741
var agentPoolProfileUser = union({
@@ -727,14 +746,13 @@ var agentPoolProfileUser = union({
727746
osType: 'Linux'
728747
maxPods: maxPods
729748
type: 'VirtualMachineScaleSets'
730-
availabilityZones: !empty(availabilityZones) ? availabilityZones : null
731749
vnetSubnetID: !empty(aksSubnetId) ? aksSubnetId : json('null')
732750
upgradeSettings: {
733751
maxSurge: '33%'
734752
}
735753
}, userPoolVmProfile)
736754

737-
var agentPoolProfiles = JustUseSystemPool ? array(union(systemPoolBase, userPoolVmProfile)) : concat(array(union(systemPoolBase, systemPoolPresets[SystemPoolType])), array(agentPoolProfileUser))
755+
var agentPoolProfiles = JustUseSystemPool ? array(union(systemPoolBase, userPoolVmProfile)) : concat(array(union(systemPoolBase, SystemPoolType=='Custom' && SystemPoolCustomPreset != {} ? SystemPoolCustomPreset : systemPoolPresets[SystemPoolType])), array(agentPoolProfileUser))
738756

739757
var akssku = AksPaidSkuForSLA ? 'Paid' : 'Free'
740758

@@ -988,8 +1006,8 @@ resource FastAlertingRole_Aks_Law 'Microsoft.Authorization/roleAssignments@2021-
9881006
}
9891007
}
9901008

991-
9921009
output LogAnalyticsName string = (createLaw) ? aks_law.name : ''
9931010
output LogAnalyticsGuid string = (createLaw) ? aks_law.properties.customerId : ''
1011+
output LogAnalyticsId string = (createLaw) ? aks_law.id : ''
9941012

9951013
//ACSCII Art link : https://textkool.com/en/ascii-art-generator?hl=default&vl=default&font=Star%20Wars&text=changeme

helper/src/components/deployTab.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export default function DeployTab({ defaults, updateFn, tabValues, invalidArray,
4444
...(net.afw && { azureFirewalls: true, ...(addons.certMan && {certManagerFW: true}), ...(net.vnet_opt === "custom" && defaults.net.vnetFirewallSubnetAddressPrefix !== net.vnetFirewallSubnetAddressPrefix && { vnetFirewallSubnetAddressPrefix: net.vnetFirewallSubnetAddressPrefix }) }),
4545
...(net.vnet_opt === "custom" && net.vnetprivateend && {
4646
privateLinks: true,
47-
...(addons.csisecret === 'akvNew' && deploy.kvIPWhitelist && apiips_array.length > 0 && {kvIPWhitelist: `"${apiips_array[0]}"`}),
47+
...(addons.csisecret === 'akvNew' && deploy.kvIPWhitelist && apiips_array.length > 0 && {kvIPWhitelist: apiips_array }),
4848
...(defaults.net.privateLinkSubnetAddressPrefix !== net.privateLinkSubnetAddressPrefix && {privateLinkSubnetAddressPrefix: net.privateLinkSubnetAddressPrefix}),
4949
}),
5050
...(addons.monitor === "aci" && { omsagent: true, retentionInDays: addons.retentionInDays, ...( addons.createAksMetricAlerts !== defaults.addons.createAksMetricAlerts && {createAksMetricAlerts: addons.createAksMetricAlerts }) }),

samples/README.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Samples
2+
3+
Filename | Description
4+
|---|---|
5+
[SampleAppMain.bicep](SampleAppMain.bicep) | When consuming the AKS Construction Bicep as a module, doing so from your own Bicep file is recommended. This sample shows using `environment mapping`, `custom naming` and basic conditional logic for using the module.
6+
[SystemPresetExample.bicep](SystemPresetExample.bicep) | The AKS Construction Bicep uses preset configurations for the system pool. Where you wish to deviate from these recommended presets, you can provide your own custom preset. This sample shows how to achieve that.
7+
[NetworkForByo.bicep](NetworkForByo.bicep) | When using the BYO network configuration you'll usually be deploying to a subscription with a peered virtual network already deployed with the correct subnets. This bicep file bridges the gap where you don't yet have that virtual network, but want to BYO network.

samples/SystemPresetExample.bicep

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
//------Application General Parameters------
2+
@description('The individual name of your application')
3+
@minLength(3)
4+
@maxLength(6)
5+
param nameseed string = 'app'
6+
param location string = resourceGroup().location
7+
8+
@allowed([
9+
'dev'
10+
'test'
11+
'qa'
12+
'prod'
13+
])
14+
param env string = 'dev'
15+
16+
var envSystemPoolPresetMap = {
17+
'dev' : {
18+
vmSize: 'Standard_B4ms'
19+
count: 1
20+
minCount: 1
21+
maxCount: 3
22+
enableAutoScaling: true
23+
availabilityZones: []
24+
}
25+
'test' : {
26+
vmSize: 'Standard_B4ms'
27+
count: 2
28+
minCount: 2
29+
maxCount: 6
30+
enableAutoScaling: true
31+
availabilityZones: []
32+
}
33+
'qa' : {
34+
vmSize: 'Standard_D4s_v3'
35+
count: 2
36+
minCount: 2
37+
maxCount: 3
38+
enableAutoScaling: true
39+
availabilityZones: [
40+
'1'
41+
'2'
42+
'3'
43+
]
44+
}
45+
'prod' : {
46+
vmSize: 'Standard_D4s_v3'
47+
count: 3
48+
minCount: 3
49+
maxCount: 3
50+
enableAutoScaling: true
51+
availabilityZones: [
52+
'1'
53+
'2'
54+
'3'
55+
]
56+
}
57+
}
58+
59+
//---------Kubernetes Construction---------
60+
//ref: https://github.com/Azure/Aks-Construction
61+
62+
module aksconst '../bicep/main.bicep' = {
63+
name: 'aksconstruction'
64+
params: {
65+
location : location
66+
resourceName: nameseed
67+
SystemPoolCustomPreset: envSystemPoolPresetMap[env]
68+
SystemPoolType: 'Custom'
69+
}
70+
}
71+
output aksClusterName string = aksconst.outputs.aksClusterName
72+
output ApplicationGatewayName string = aksconst.outputs.ApplicationGatewayName

0 commit comments

Comments
 (0)