export default function()

in helper/src/components/clusterTab.js [14:107]


export default function ({ defaults, 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) {

        updateFn ((p) => {
            let newp = {...p, ...updates}
            let updatevals = {...updates}

            const
                AGENT_COUNT_MIN = newp.SystemPoolType==='none' || !newp.autoscale  ? 1 : 0,
                AGENT_COUNT_MAX = newp.autoscale ? 99 : 100,
                MAXCOUNT_MIN = newp.autoscale ? newp.agentCount + 1 : 0

            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 = 'userpool01'
            }

            if (newp.maxCount < MAXCOUNT_MIN) {
                updatevals = {...updatevals, maxCount: MAXCOUNT_MIN}
            }
            // check agentCount
            if (newp.agentCount < AGENT_COUNT_MIN) {
                updatevals = {...updatevals, agentCount: AGENT_COUNT_MIN }
            } else if (newp.agentCount > AGENT_COUNT_MAX) {
                updatevals = {...updatevals, agentCount: AGENT_COUNT_MAX }
            }

            return updatevals
        })
    }

    function UpdateOsType(v) {
        //update the OSType property, where this fn was called from
        updateFn("osType", v)

        //provide windows node pool optimised settings
        if (v==='Windows') {
            updateFn("nodepoolName", "npwin1")
            updateFn("vmSize", "Standard_DS4_v2")
            updateFn("osSKU", "Windows2022")
         } else {
            updateFn("nodepoolName", defaults.cluster.nodepoolName)
            updateFn("vmSize", defaults.cluster.vmSize)
            updateFn("osSKU", defaults.cluster.osSKU)
         }
    }

    return (
        <Stack tokens={{ childrenGap: 15 }} styles={adv_stackstyle}>

            <Label style={{ marginBottom: "10px" }}>Cluster Performance & Scale Requirements</Label>
            <Stack vertical tokens={{ childrenGap: 15 }} style={{ marginTop: 0, marginLeft: '50px' }} >

                <Stack horizontal tokens={{ childrenGap: 55 }}>
                    <Stack.Item>
                        <Label >Uptime SLA <Link target='_' href='https://docs.microsoft.com/azure/aks/uptime-sla'>docs</Link></Label>
                        <ChoiceGroup
                            selectedKey={cluster.AksPaidSkuForSLA}
                            options={[
                                { key: false, text: 'Free clusters with a service level objective (SLO) of 99.5%' },
                                { key: true, text: 'Uptime SLA: 99.9% availability for the Kubernetes API server for clusters without Availability zones.' }
                            ]}
                            onChange={(ev, { key }) => updateFn("AksPaidSkuForSLA", key)}
                        />
                    </Stack.Item>
                </Stack>

                <Stack horizontal tokens={{ childrenGap: 55 }}>
                    <Stack.Item>
                        <Label >System Pool Type <Link target='_' href='https://docs.microsoft.com/azure/aks/use-system-pools#system-and-user-node-pools'>docs</Link></Label>
                        <ChoiceGroup
                            selectedKey={cluster.SystemPoolType}
                            options={[
                                { "data-testid":'cluster-systempool-none', key: 'none', text: 'No separate system pool: Use a single Linux pool for System and User workloads' },
                                { "data-testid":'cluster-systempool-Cost-Optimised', key: 'CostOptimised', text: 'CostOptimised: use low-cost Burstable VMs, with 1-3 node autoscale' },
                                { "data-testid":'cluster-systempool-Standard', key: 'Standard', text: 'Standard: use standard 4-core VMs, with 2-3 node autoscale' }
                            ]}
                            onChange={(ev, { key }) => { sliderUpdateFn({SystemPoolType: key}) }}
                        />
                    </Stack.Item>
                </Stack>

                <Stack horizontal tokens={{ childrenGap: 150 }}>
                    <Stack.Item>
                        <Label>User Pool - OS Type</Label>
                        <ChoiceGroup selectedKey={cluster.osType} onChange={(ev, { key }) => {  UpdateOsType(key) }}