This repository has been archived by the owner on Nov 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
run-pre-checks.sh
executable file
·59 lines (51 loc) · 2.52 KB
/
run-pre-checks.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
az provider register --namespace Microsoft.Kubernetes
az provider register --namespace Microsoft.KubernetesConfiguration
# Zones - Location
if [[ $ZONES = "true" ]]; then
azLocations=(centralus eastus eastus2 westus2 francecentral northeurope uksouth westeurope japaneast southeastasia)
if [[ ! " ${azLocations[@]} " =~ " ${LOCATION} " ]]; then
1>&2 echo "The location you selected doesn't support Availability Zones!"
fi
fi
# Zones - VM SKU
if [[ $ZONES = "true" ]]; then
zonesEnabled=$(az vm list-skus -l $LOCATION --size $NODE_SIZE --query "[0].locationInfo[0].zoneDetails")
echo $zonesEnabled
fi
# VM quota
vmFamily=$(az vm list-skus -l $LOCATION -s $NODE_SIZE --query [0].family -o tsv)
az vm list-usage -l $LOCATION --query "[?name.value=='$vmFamily']"
quotaCurrentValue=$(az vm list-usage -l $LOCATION --query "[?name.value=='$vmFamily'] | [0].currentValue" -o tsv)
quotaLimit=$(az vm list-usage -l $LOCATION --query "[?name.value=='$vmFamily'] | [0].limit" -o tsv)
expr $quotaLimit - $quotaCurrentValue
if [[ $quotaRemaining < ($NODES_COUNT * 2) ]];
then
1>&2 echo "You don't have enough quota remaining to provision your AKS cluster based on the VM family selected!"
fi
# Accelerated Networking
# https://docs.microsoft.com/azure/virtual-network/create-vm-accelerated-networking-cli
acceleratedNetworkingEnabled=$(az vm list-skus -l $LOCATION --size $NODE_SIZE --query "[0].capabilities | [?name=='AcceleratedNetworkingEnabled'].value" -o tsv)
if [[ $acceleratedNetworkingEnabled = "False" ]];
then
1>&2 echo "The Node's size you have selected doesn't support Accelerated Networking which could degrade network performance!"
fi
# Premium Disk
# https://docs.microsoft.com/azure/virtual-machines/linux/disks-types#premium-ssd
premiumDiskEnabled=$(az vm list-skus -l $LOCATION --size $NODE_SIZE --query "[0].capabilities | [?name=='PremiumIO'].value" -o tsv)
if [[ $premiumDiskEnabled = "False" ]];
then
1>&2 echo "The Node's size you have selected doesn't support Premium Disk which could degrade IO performance!"
fi
# Commands below in progress... WIP/FIXME
# IOPS (VM vs Disk)
# Fam. - Size - IOPS
# P10 - 128 - 500
# P15 - 256 - 1100
# P20 - 512 - 2300
# P30 - 1024 - 5000
# P40 - 2048 - 7500
az vm list-skus -l $LOCATION --size $NODE_SIZE --query "[0].capabilities | [?name=='UncachedDiskIOPS'].value" -o tsv
az vm list-skus -l $LOCATION -r disks --query "[?name=='Premium_LRS']" -o table
# TODOs:
# The specified service CIDR 10.101.0.0/16 is conflicted with an existing subnet CIDR