Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node pool name customisation #462

Merged
merged 7 commits into from
Nov 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions bicep/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -890,6 +890,11 @@ param agentCount int = 3
param agentCountMax int = 0
var autoScale = agentCountMax > agentCount

@minLength(3)
@maxLength(20)
@description('Name for user node pool')
param nodePoolName string = 'npuser01'

@description('Allocate pod ips dynamically')
param cniDynamicIpAllocation bool = false

Expand Down Expand Up @@ -1084,7 +1089,7 @@ var systemPoolPresets = {
}

var systemPoolBase = {
name: 'npsystem'
name: JustUseSystemPool ? nodePoolName : 'npsystem'
mode: 'System'
osType: 'Linux'
maxPods: 30
Expand All @@ -1108,7 +1113,7 @@ var userPoolVmProfile = {
}

var agentPoolProfileUser = union({
name: 'npuser01'
name: nodePoolName
mode: 'User'
osDiskType: osDiskType
osDiskSizeGB: osDiskSizeGB
Expand All @@ -1123,6 +1128,10 @@ var agentPoolProfileUser = union({

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


output userNodePoolName string = nodePoolName
output systemNodePoolName string = JustUseSystemPool ? nodePoolName : 'npsystem'

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

var aks_addons = union({
Expand Down
2 changes: 2 additions & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,11 @@
"netpolicy",
"networkpolicy",
"newp",
"nodepool",
"noopener",
"noreferrer",
"notopmargin",
"npuser",
"NSG's",
"omsagent",
"pagename",
Expand Down
15 changes: 9 additions & 6 deletions helper/src/components/clusterTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ export default function ({ tabValues, updateFn, featureFlag, invalidArray }) {
console.log (`agentCount=${newp.agentCount} MIN=${AGENT_COUNT_MIN} MAX=${AGENT_COUNT_MAX}`)
console.log (`maxCount=${newp.maxCount} MIN=${MAXCOUNT_MIN}`)

if(newp.SystemPoolType!=='none' && !cluster.nodepoolName){
cluster.nodepoolName = 'npuser01'
}

if (newp.maxCount < MAXCOUNT_MIN) {
updatevals = {...updatevals, maxCount: MAXCOUNT_MIN}
}
Expand All @@ -43,12 +47,10 @@ export default function ({ tabValues, updateFn, featureFlag, invalidArray }) {
}

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

}

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

return updatevals
})
Expand Down Expand Up @@ -116,6 +118,7 @@ export default function ({ tabValues, updateFn, featureFlag, invalidArray }) {
label={`Node count range ${cluster.autoscale ? 'range' : ''}`} min={0} max={100} step={1}
value={cluster.autoscale? cluster.maxCount : cluster.agentCount} showValue={true}
onChange={(val, range) => sliderUpdateFn(cluster.autoscale ? {agentCount: range[0], maxCount: range[1]} : {agentCount: val})} />
<TextField placeholder='npuser01' label="Node pool name" onChange={(ev, val) => updateFn('nodepoolName', val)} required errorMessage={getError(invalidArray, 'nodepoolName')} value={cluster.nodepoolName} />
</Stack.Item>
</Stack>

Expand Down
3 changes: 3 additions & 0 deletions helper/src/components/deployTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ export default function DeployTab({ defaults, updateFn, tabValues, invalidArray,
...(cluster.AksPaidSkuForSLA !== defaults.cluster.AksPaidSkuForSLA && { AksPaidSkuForSLA: cluster.AksPaidSkuForSLA }),
...(cluster.SystemPoolType === 'none' ? { JustUseSystemPool: true } : cluster.SystemPoolType !== defaults.cluster.SystemPoolType && { SystemPoolType: cluster.SystemPoolType }),
...(cluster.vmSize !== defaults.cluster.vmSize && { agentVMSize: cluster.vmSize }),
...(((cluster.nodepoolName.toLowerCase() !== defaults.cluster.nodepoolName && cluster.SystemPoolType !== 'none')
|| ( cluster.SystemPoolType === 'none' && (cluster.nodepoolName.toLowerCase() !== defaults.cluster.systemNodepoolName && cluster.nodepoolName.toLowerCase() !== defaults.cluster.nodepoolName )))
&& { nodePoolName: cluster.nodepoolName }),
...(cluster.autoscale && { agentCountMax: cluster.maxCount }),
...(cluster.osDiskType === "Managed" && { osDiskType: cluster.osDiskType, ...(cluster.osDiskSizeGB > 0 && { osDiskSizeGB: cluster.osDiskSizeGB }) }),
...(net.vnet_opt === "custom" && {
Expand Down
2 changes: 2 additions & 0 deletions helper/src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
"autoscale": true,
"upgradeChannel": "none",
"SystemPoolType": "CostOptimised",
"nodepoolName": "npuser01",
"systemNodepoolName": "npsystem",
"agentCount": 3,
"maxCount": 20,
"computeType": "gp",
Expand Down