Skip to content

Commit

Permalink
Added logic to load locations and VM sku's from json files (#444)
Browse files Browse the repository at this point in the history
* Change to load sku's and filter on location

* Added locations, skufamily and compute type logic

* Fixes a few testing issues with flow of options

* tested and cleanup for PR

* testing update

* Added custom selection box

* label rewording

* check for null subscriptionid

* changes from bash to sh syntax

* Removing empty file

* added azure login for vm sku list build

* adding step timeout

Co-authored-by: Mark Graham <magraham@microsoft.com>
Co-authored-by: Gordon Byers <gordon.byers@microsoft.com>
  • Loading branch information
3 people authored Nov 8, 2022
1 parent 902156f commit c98db36
Show file tree
Hide file tree
Showing 9 changed files with 2,140 additions and 37 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@ jobs:
run: |
echo "GitHub Ref: ${{ github.ref }}"
- name: Azure Login
uses: Azure/login@v1.4.6
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Build VM Sku json file
timeout-minutes: 3
run: |
cd postdeploy/scripts
./generate-vm-sku-list-v2.sh
- name: Build node app with bicep release
run: |
cd helper
Expand Down
38 changes: 19 additions & 19 deletions helper/src/components/clusterTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,21 @@
import React from 'react';
import { mergeStyles, TextField, Link, Separator, DropdownMenuItemType, Dropdown, Slider, Stack, Text, Label, ChoiceGroup, Checkbox, MessageBar, MessageBarType } from '@fluentui/react';
import { adv_stackstyle, getError, hasError } from './common'
import vmSKUs from '../vmSKUs.json'

const optionRootClass = mergeStyles({
display: 'flex',
alignItems: 'baseline'
});

export const VMs = [
{ key: 'b', text: 'Burstable (dev/test)', itemType: DropdownMenuItemType.Header },
{ key: 'Standard_B2s', text: '2 vCPU, 4 GiB RAM, 8GiB SSD, 40% -> 200% CPU', eph: false },
{ key: 'dv2', text: 'General purpose V2', itemType: DropdownMenuItemType.Header },
{ key: 'default', text: '2 vCPU, 7 GiB RAM, 14GiB SSD, 86 GiB cache (8000 IOPS)', eph: false },
{ key: 'Standard_DS3_v2', text: '4 vCPU, 14 GiB RAM, 28GiB SSD, 172 GiB cache (16000 IOPS)', eph: true },
{ key: 'dv4', text: 'General purpose V4', itemType: DropdownMenuItemType.Header },
{ key: 'Standard_D2ds_v4', text: '2 vCPU, 8 GiB RAM, 75GiB SSD, (19000 IOPS)', eph: false },
{ key: 'Standard_D4ds_v4', text: '4 vCPU, 16 GiB RAM, 150GiB SSD, 100 GiB cache (38500 IOPS)', eph: false },
{ key: 'Standard_D8ds_v4', text: '8 vCPU, 32 GiB RAM, 300GiB SSD, (77000 IOPS)', eph: true },
{ key: 'fv2', text: 'Compute optimized', itemType: DropdownMenuItemType.Header },
{ key: 'Standard_F2s_v2', text: '2 vCPU, 4 GiB RAM, 16GiB SSD, (3200 IOPS)', eph: false }
]
export var VMs = vmSKUs

export default function ({ tabValues, updateFn, featureFlag, invalidArray }) {
const { net, addons, cluster, deploy } = tabValues
const defenderFeatureFlag = featureFlag.includes('defender')

//Initial filter on load
VMs = vmSKUs.filter(l => {return l.location.toLowerCase() === (deploy.location.toLowerCase()) && l.computeType.toLowerCase() === cluster.computeType.toLowerCase()}) //Filter VM Sku list based on location

function sliderUpdateFn(updates) {

Expand All @@ -51,6 +42,14 @@ export default function ({ tabValues, updateFn, featureFlag, invalidArray }) {
updatevals = {...updatevals, agentCount: AGENT_COUNT_MAX }
}

//clear when changing computeType
if (newp.computeType)
{
updatevals = {...updatevals, vmSize: null}

}


return updatevals
})
}
Expand Down Expand Up @@ -124,8 +123,8 @@ export default function ({ tabValues, updateFn, featureFlag, invalidArray }) {
<Stack.Item>
<Label >Compute Type</Label>
<ChoiceGroup

selectedKey="gp"
onChange={(ev, { key }) => { sliderUpdateFn({computeType: key}) }}
selectedKey={cluster.computeType}
options={[
{
key: 'gp',
Expand All @@ -144,12 +143,13 @@ export default function ({ tabValues, updateFn, featureFlag, invalidArray }) {
text: 'GPU Workloads',
disabled: true
}
]} />
]}
/>
</Stack.Item>

<Stack.Item>
<Label >Node Size</Label>
<Stack tokens={{ childrenGap: 10 }} styles={{ root: { width: 450 } }}>
<Label >Virtual Machine Node Selection</Label>
<Stack tokens={{ childrenGap: 10 }} styles={{ root: { width: 500 } }}>
<Dropdown

selectedKey={cluster.vmSize}
Expand All @@ -158,10 +158,10 @@ export default function ({ tabValues, updateFn, featureFlag, invalidArray }) {
options={VMs}
styles={{ dropdown: { width: "100%" } }}
/>

{hasError(invalidArray, 'osDiskType') &&
<MessageBar messageBarType={MessageBarType.error}>{getError(invalidArray, 'osDiskType')}</MessageBar>
}
<TextField label="VM SKU" onChange={(ev, val) => updateFn('vmSize', val)} required errorMessage={getError(invalidArray, 'vmSize')} value={cluster.vmSize} />
<ChoiceGroup
onChange={(ev, { key }) => updateFn("osDiskType", key)}
selectedKey={cluster.osDiskType}
Expand Down
19 changes: 2 additions & 17 deletions helper/src/components/deployTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Checkbox, Pivot, PivotItem, Image, TextField, Link, Separator, Dropdow

import { CodeBlock, adv_stackstyle, getError } from './common'
import dependencies from "../dependencies.json";
import locations from '../locations.json';

export default function DeployTab({ defaults, updateFn, tabValues, invalidArray, invalidTabs, urlParams, featureFlag }) {
const terraformFeatureFlag = featureFlag.includes('tf')
Expand Down Expand Up @@ -326,23 +327,7 @@ az role assignment create --role "Managed Identity Operator" --assignee-principa
label="Location"
selectedKey={deploy.location}
onChange={(ev, { key }) => updateFn('location', key)}
options={[
{ key: 'europe', text: 'Europe', itemType: DropdownMenuItemType.Header },
{ key: "WestEurope", text: "West Europe" },
{ key: "NorthEurope", text: "North Europe" },
{ key: "UKSouth", text: "UK South" },
{ key: "UKSouth2", text: "UK South2" },
{ key: "UKWest", text: "UK West" },
{ key: 'middleeast', text: 'Middle East', itemType: DropdownMenuItemType.Header },
{ key: "UAENorth", text: "UAE North" },
{ key: 'america', text: 'North America', itemType: DropdownMenuItemType.Header },
{ key: "CentralUS", text: "Central US" },
{ key: "EastUS", text: "East US" },
{ key: "EastUS2", text: "East US2" },
{ key: "WestUS", text: "West US" },
{ key: "WestUS2", text: "West US2" },
{ key: "WestCentralUS", text: "West Central US" }
]}
options={locations}
styles={{ dropdown: { width: 300 } }}
/>
</Stack>
Expand Down
4 changes: 3 additions & 1 deletion helper/src/components/portalnav.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,9 @@ export default function PortalNav({ config }) {
const { deploy, cluster, net, addons } = tabValues

console.log(`PortalNav: Evaluating configruation warnings...`)
invalidFn('cluster', 'osDiskType', cluster.osDiskType === 'Ephemeral' && !VMs.find(i => i.key === cluster.vmSize).eph, 'The selected VM cache is not large enough to support Ephemeral. Select \'Managed\' or a VM with a larger cache')

invalidFn('cluster', 'osDiskType', ((typeof VMs.find(i => i.key === cluster.vmSize) !== "undefined") ? cluster.osDiskType === 'Ephemeral' && !VMs.find(i => i.key === cluster.vmSize).eph : false), 'The selected VM cache is not large enough to support Ephemeral. Select \'Managed\' or a VM with a larger cache')
invalidFn('cluster', 'vmSize', cluster.vmSize === "" , 'Enter node size from list or custom node size above')
invalidFn('cluster', 'aad_tenant_id', cluster.enable_aad && cluster.use_alt_aad && cluster.aad_tenant_id.length !== 36, 'Enter Valid Directory ID')
invalidFn('addons', 'registry', net.vnetprivateend && (addons.registry !== 'Premium' && addons.registry !== 'none'), 'Premium tier is required for Private Link, either select Premium, or disable Private Link')
invalidFn('cluster', 'keyVaultKmsByoKeyId', cluster.keyVaultKms === "byoprivate" && !cluster.keyVaultKmsByoKeyId.match('https:\/\/[^]+.vault.azure.net/keys/[^ ]+/[^ ]+$'), 'Enter valid KeyVault Versioned Key ID (https://YOURVAULTNAME.vault.azure.net/keys/YOURKEYNAME/KEYVERSIONSTRING)')
Expand Down
1 change: 1 addition & 0 deletions helper/src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"SystemPoolType": "CostOptimised",
"agentCount": 3,
"maxCount": 20,
"computeType": "gp",
"vmSize": "Standard_DS3_v2",
"osDiskSizeGB": 0,
"osDiskType": "Ephemeral",
Expand Down
16 changes: 16 additions & 0 deletions helper/src/locations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[
{ "key": "europe", "text": "Europe", "itemType": 2},
{ "key": "WestEurope", "text": "West Europe"},
{ "key": "NorthEurope", "text": "North Europe"},
{ "key": "UKSouth", "text": "UK South"},
{ "key": "UKWest", "text": "UK West" },
{ "key": "middleeast", "text": "Middle East", "itemType": 2 },
{ "key": "UAENorth", "text": "UAE North" },
{ "key": "america", "text": "North America", "itemType": 2 },
{ "key": "CentralUS", "text": "Central US" },
{ "key": "EastUS", "text": "East US" },
{ "key": "EastUS2", "text": "East US2" },
{ "key": "WestUS", "text": "West US" },
{ "key": "WestUS2", "text": "West US2" },
{ "key": "WestCentralUS", "text": "West Central US" }
]
6 changes: 6 additions & 0 deletions helper/src/skuFamilies.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[
{"key": "standardDSv2Family", "text": "General Purpose V2", "computeType": "gp"},
{"key": "standardDDSv4Family", "text": "General Purpose V4", "computeType": "gp"},
{"key": "standardFSv2Family", "text": "Compute Optimized","computeType": "gp"},
{"key": "standardBSFamily", "text": "Burstable (dev/test)","computeType": "gp"}
]
Loading

0 comments on commit c98db36

Please sign in to comment.