Merge pull request #4648 from westlywright/bug.aksv2

AKS v2 Bugs
This commit is contained in:
Westly Wright 2021-06-07 09:40:09 -07:00 committed by GitHub
commit a9166ce3fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 172 additions and 160 deletions

View File

@ -180,9 +180,7 @@ export const DEFAULT_AKS_NODE_POOL_CONFIG = {
availabilityZones: ['1', '2', '3'], availabilityZones: ['1', '2', '3'],
count: 1, count: 1,
enableAutoScaling: false, enableAutoScaling: false,
maxCount: 3,
maxPods: 110, maxPods: 110,
minCount: 1,
mode: 'System', mode: 'System',
name: '', name: '',
orchestratorVersion: '', orchestratorVersion: '',
@ -1311,11 +1309,13 @@ export default Resource.extend(Grafana, ResourceUsage, {
const lhsMatch = get(lhs, k); const lhsMatch = get(lhs, k);
const rhsMatch = get(rhs, k); const rhsMatch = get(rhs, k);
if (k !== 'nodeGroups' && k !== 'nodePools') {
try { try {
if (isEqual(JSON.stringify(lhsMatch), JSON.stringify(rhsMatch))) { if (isEqual(JSON.stringify(lhsMatch), JSON.stringify(rhsMatch))) {
return; return;
} }
} catch (e){} } catch (e){}
}
if (k === 'nodeGroups' || k === 'nodePools' || k === 'tags' || k === 'labels') { if (k === 'nodeGroups' || k === 'nodePools' || k === 'tags' || k === 'labels') {
// Node Groups and Node Pools do not require a sync, we can safely send the entire object // Node Groups and Node Pools do not require a sync, we can safely send the entire object

View File

@ -26,6 +26,7 @@ export default Component.extend({
diskTypes: OS_DISK_TYPES, diskTypes: OS_DISK_TYPES,
upgradeVersion: false, upgradeVersion: false,
showNodeUpgradePreventionReason: false, showNodeUpgradePreventionReason: false,
disableAzs: false,
isSystemType: equal('nodePool.mode', 'System'), isSystemType: equal('nodePool.mode', 'System'),
@ -39,6 +40,81 @@ export default Component.extend({
} }
})), })),
resetAvailablity: on('init', observer('isNewNodePool', 'disableAzs', function() {
const {
isNewNodePool, disableAzs, nodePool: { availabilityZones }, mode
} = this;
if (mode !== 'edit' && !isNewNodePool || disableAzs) {
if (!isEmpty(availabilityZones)) {
set(this, 'nodePool.availabilityZones', []);
}
}
})),
availablityZoneOne: computed('nodePool.availabilityZones.[]', {
get() {
return (this.nodePool?.availabilityZones ?? []).find((az) => az === '1') ? true : false;
},
set(_key, value) {
let azs = (this.nodePool?.availabilityZones ?? []).slice();
if (value) {
if (!azs.find((az) => az === '1')) {
azs.push('1');
}
} else {
azs = azs.without('1');
}
set(this, 'nodePool.availabilityZones', azs.sort());
return value;
}
}),
availablityZoneThree: computed('nodePool.availabilityZones.[]', {
get() {
return (this.nodePool?.availabilityZones ?? []).find((az) => az === '2') ? true : false;
},
set(_key, value) {
let azs = (this.nodePool?.availabilityZones ?? []).slice();
if (value) {
if (!azs.find((az) => az === '2')) {
azs.push('2');
}
} else {
azs = azs.without('2');
}
set(this, 'nodePool.availabilityZones', azs.sort());
return value;
}
}),
availablityZoneTwo: computed('nodePool.availabilityZones.[]', {
get() {
return (this.nodePool?.availabilityZones ?? []).find((az) => az === '3') ? true : false;
},
set(_key, value) {
let azs = (this.nodePool?.availabilityZones ?? []).slice();
if (value) {
if (!azs.find((az) => az === '3')) {
azs.push('3');
}
} else {
azs = azs.without('3');
}
set(this, 'nodePool.availabilityZones', azs.sort());
return value;
}
}),
originalClusterVersion: computed('cluster.aksConfig.kubernetesVersion', 'originalCluster.aksConfig.kubernetesVersion', 'originalCluster.aksConfig.upstreamSpec.kubernetesVersion', function() { originalClusterVersion: computed('cluster.aksConfig.kubernetesVersion', 'originalCluster.aksConfig.kubernetesVersion', 'originalCluster.aksConfig.upstreamSpec.kubernetesVersion', function() {
if (!isEmpty(get(this, 'originalCluster.aksConfig.kubernetesVersion'))) { if (!isEmpty(get(this, 'originalCluster.aksConfig.kubernetesVersion'))) {
return get(this, 'originalCluster.aksConfig.kubernetesVersion'); return get(this, 'originalCluster.aksConfig.kubernetesVersion');

View File

@ -94,14 +94,58 @@
</div> </div>
<div class="col span-3"> <div class="col span-3">
<label class="acc-label"> <label class="acc-label">
{{t "clusterNew.azureaks.nodePools.availablityZones.label"}} {{t "clusterNew.azureaks.availabilityZones.label"}}
</label> </label>
<div class="form-control-static"> <div class="checkbox">
{{#if nodePool.availabilityZones.length}} <label>
{{displayZones}} {{#if isNewNodePool}}
{{else}} <Input
{{t "generic.na"}} @type="checkbox"
@checked={{mut availablityZoneOne}}
@disabled={{or disableAzs (not isNewNodePool)}}
/>
{{/if}} {{/if}}
{{t "clusterNew.azureaks.availabilityZones.zone" loc=1}}
{{#unless isNewNodePool}}
{{if availablityZoneOne (t "generic.enabled") (t "generic.disabled")
}}
{{/unless}}
</label>
</div>
<div class="checkbox">
<label>
{{#if isNewNodePool}}
<Input
@type="checkbox"
@checked={{mut availablityZoneTwo}}
@disabled={{or disableAzs (not isNewNodePool)}}
/>
{{/if}}
{{t "clusterNew.azureaks.availabilityZones.zone" loc=2}}
{{#unless isNewNodePool}}
{{if availablityZoneTwo (t "generic.enabled") (t "generic.disabled")
}}
{{/unless}}
</label>
</div>
<div class="checkbox">
<label>
{{#if isNewNodePool}}
<Input
@type="checkbox"
@checked={{mut availablityZoneThree}}
@disabled={{or disableAzs (not isNewNodePool)}}
/>
{{/if}}
{{t "clusterNew.azureaks.availabilityZones.zone" loc=3}}
{{#unless isNewNodePool}}
{{if
availablityZoneThree
(t "generic.enabled")
(t "generic.disabled")
}}
{{/unless}}
</label>
</div> </div>
</div> </div>
</div> </div>

View File

@ -64,9 +64,6 @@ export default Component.extend(ClusterDriver, {
configField: 'aksConfig', configField: 'aksConfig',
availablityZoneOne: true,
availablityZoneThree: true,
availablityZoneTwo: true,
clusterAdvanced: false, clusterAdvanced: false,
clusterErrors: null, clusterErrors: null,
clusterLocationSaved: false, clusterLocationSaved: false,
@ -116,13 +113,6 @@ export default Component.extend(ClusterDriver, {
if ( this.editing && this.importedClusterIsPending || (this.clusterIsPending && config?.privateCluster) ) { if ( this.editing && this.importedClusterIsPending || (this.clusterIsPending && config?.privateCluster) ) {
set(this, 'step', 4); set(this, 'step', 4);
} else { } else {
// reset on edit so we can get real az's
setProperties(this, {
availablityZoneOne: false,
availablityZoneThree: false,
availablityZoneTwo: false,
});
this.syncUpstreamConfig(); this.syncUpstreamConfig();
const tags = { ...( config.tags || {} ) }; const tags = { ...( config.tags || {} ) };
@ -132,32 +122,6 @@ export default Component.extend(ClusterDriver, {
if (!isEmpty(config?.authorizedIpRanges)) { if (!isEmpty(config?.authorizedIpRanges)) {
set(this, 'enabledAuthorizedIpRanges', true); set(this, 'enabledAuthorizedIpRanges', true);
} }
if (!isEmpty(config?.nodePools)) {
const azs = [];
config.nodePools.forEach((np) => {
if (!isEmpty(np?.availabilityZones)) {
azs.pushObjects(np.availabilityZones);
}
});
azs.uniq().forEach((az) => {
switch (az) {
case '1':
set(this, 'availablityZoneOne', true);
break;
case '2':
set(this, 'availablityZoneTwo', true);
break;
case '3':
set(this, 'availablityZoneThree', true);
break;
default:
break;
}
});
}
} }
} }
}, },
@ -211,7 +175,7 @@ export default Component.extend(ClusterDriver, {
}, },
async loadRegions(cb) { async loadRegions(cb) {
const store = get(this, 'globalStore') const store = get(this, 'globalStore')
const { selectedCloudCredential } = this; const { selectedCloudCredential, regionsWithAZs } = this;
const data = { const data = {
cloudCredentialId: get(selectedCloudCredential, 'id'), cloudCredentialId: get(selectedCloudCredential, 'id'),
// tenantId: get(this, 'config.tenantId'), // tenantId: get(this, 'config.tenantId'),
@ -224,7 +188,21 @@ export default Component.extend(ClusterDriver, {
method: 'GET', method: 'GET',
}); });
set(this, 'regions', regions?.body ?? []); const filteredRegions = (regions?.body ?? []).map((reg) => {
if (regionsWithAZs.includes(reg?.displayName || '')) {
return {
...reg,
...{ group: 'High Availablity' }
}
} else {
return {
...reg,
...{ group: 'Other' }
};
}
});
set(this, 'regions', filteredRegions);
cb(true); cb(true);
@ -309,12 +287,7 @@ export default Component.extend(ClusterDriver, {
}, },
setTags(section) { setTags(section) {
const out = [] set(this, 'config.tags', section);
for (let key in section) {
out.pushObject(`${ key }=${ section[key] }`)
}
set(this, 'config.tags', out);
}, },
}, },
@ -344,12 +317,7 @@ export default Component.extend(ClusterDriver, {
if (regionHasAz) { if (regionHasAz) {
set(this, 'disableAzs', false); set(this, 'disableAzs', false);
} else { } else {
setProperties(this, { set(this, 'disableAzs', true);
disableAzs: true,
availablityZoneOne: false,
availablityZoneTwo: false,
availablityZoneThree: false,
})
} }
}), }),
@ -372,22 +340,16 @@ export default Component.extend(ClusterDriver, {
} }
}), }),
availablityZonesChanged: on('init', observer('availablityZoneOne', 'availablityZoneTwo', 'availablityZoneThree', 'config.nodePools.[]', function() { availablityZonesChanged: on('init', observer('config.nodePools.[]', function() {
const {
availablityZoneOne, availablityZoneTwo, availablityZoneThree
} = this;
const nodePools = get(this, 'config.nodePools') || []; const nodePools = get(this, 'config.nodePools') || [];
const azs = [availablityZoneOne, availablityZoneTwo, availablityZoneThree]; const azs = [];
const anySet = azs.any((az) => az);
const nodeAzs = [];
azs.forEach((az, idx) => { nodePools.forEach((np) => {
if (az) { if (np?.availabilityZones && np.availabilityZones.length > 0) {
const azNo = idx + 1; azs.pushObjects(np.availabilityZones);
nodeAzs.push(azNo);
} }
}); });
const anySet = azs.uniq().any((az) => az);
if (anySet) { if (anySet) {
setProperties(this, { setProperties(this, {
@ -397,8 +359,6 @@ export default Component.extend(ClusterDriver, {
} else { } else {
set(this, 'loadBalancerImmutable', false); set(this, 'loadBalancerImmutable', false);
} }
nodePools.forEach((np) => set(np, 'availabilityZones', nodeAzs));
})), })),
resetAdvancedOptions: on('init', observer('config.networkPlugin', function() { resetAdvancedOptions: on('init', observer('config.networkPlugin', function() {
@ -582,11 +542,11 @@ export default Component.extend(ClusterDriver, {
clusterErrors = clusterErrors.concat(this.validateVnetInputs()); clusterErrors = clusterErrors.concat(this.validateVnetInputs());
} }
if ( !get(this, 'config.resourceGroup') ) { if ( this.isNew && !get(this, 'config.resourceGroup') ) {
clusterErrors.push(intl.t('validation.required', { key: intl.t('clusterNew.azureaks.resourceGroup.label') })); clusterErrors.push(intl.t('validation.required', { key: intl.t('clusterNew.azureaks.resourceGroup.label') }));
} }
if ( !get(this, 'config.dnsPrefix') ) { if ( this.isNew && !get(this, 'config.dnsPrefix') ) {
clusterErrors.push(intl.t('validation.required', { key: intl.t('clusterNew.azureaks.dns.label') })); clusterErrors.push(intl.t('validation.required', { key: intl.t('clusterNew.azureaks.dns.label') }));
} }

View File

@ -102,66 +102,13 @@
</InputOrDisplay> </InputOrDisplay>
</div> </div>
<div class="col span-6"> <div class="col span-6">
<label class="acc-label"> {{#if disableAzs}}
{{t "clusterNew.azureaks.availabilityZones.label"}} <BannerMessage
</label> @icon="icon-alert"
<div class="checkbox"> @color="bg-warning mb-10"
<label> @message={{t "clusterNew.azureaks.availabilityZoneWarning" }}
{{#if isNewOrEditable}}
<Input
@type="checkbox"
@checked={{mut availablityZoneOne}}
@disabled={{and disableAzs (not isNewOrEditable)}}
/> />
{{/if}} {{/if}}
{{t "clusterNew.azureaks.availabilityZones.zone" loc=1}}
{{#unless isNewOrEditable}}
{{if
availablityZoneOne
(t "generic.enabled")
(t "generic.disabled")
}}
{{/unless}}
</label>
</div>
<div class="checkbox">
<label>
{{#if isNewOrEditable}}
<Input
@type="checkbox"
@checked={{mut availablityZoneTwo}}
@disabled={{and disableAzs (not isNewOrEditable)}}
/>
{{/if}}
{{t "clusterNew.azureaks.availabilityZones.zone" loc=2}}
{{#unless isNewOrEditable}}
{{if
availablityZoneTwo
(t "generic.enabled")
(t "generic.disabled")
}}
{{/unless}}
</label>
</div>
<div class="checkbox">
<label>
{{#if isNewOrEditable}}
<Input
@type="checkbox"
@checked={{mut availablityZoneThree}}
@disabled={{and disableAzs (not isNewOrEditable)}}
/>
{{/if}}
{{t "clusterNew.azureaks.availabilityZones.zone" loc=3}}
{{#unless isNewOrEditable}}
{{if
availablityZoneThree
(t "generic.enabled")
(t "generic.disabled")
}}
{{/unless}}
</label>
</div>
</div> </div>
</div> </div>
{{#if (eq step 2)}} {{#if (eq step 2)}}
@ -377,7 +324,9 @@
<div class="col span-6"> <div class="col span-6">
<label class="acc-label" for="azureaks-master-dns-prefix"> <label class="acc-label" for="azureaks-master-dns-prefix">
{{t "clusterNew.azureaks.dns.label"}} {{t "clusterNew.azureaks.dns.label"}}
{{#if isNew}}
<FieldRequired /> <FieldRequired />
{{/if}}
</label> </label>
<InputOrDisplay <InputOrDisplay
@editable={{isNewOrEditable}} @editable={{isNewOrEditable}}
@ -641,6 +590,7 @@
<div class="row"> <div class="row">
{{#each config.nodePools as |nodePool|}} {{#each config.nodePools as |nodePool|}}
<AksNodePoolRow <AksNodePoolRow
@disableAzs={{disableAzs}}
@originalCluster={{model.originalCluster}} @originalCluster={{model.originalCluster}}
@isNew={{isNewOrEditable}} @isNew={{isNewOrEditable}}
@mode={{mode}} @mode={{mode}}

View File

@ -16,24 +16,6 @@
@showExpand={{false}} @showExpand={{false}}
> >
<div class="row"> <div class="row">
<div class="col span-4 mb-0">
<label class="acc-label" for="azureaks-tenant-id">
{{t "clusterNew.azureaks.tenant.label"}}
<FieldRequired />
</label>
<InputOrDisplay
@editable={{and (not isEdit) (eq step 1)}}
@value={{config.tenantId}}
>
<Input
@classNames="form-control"
@id="azureaks-tenant-id"
@placeholder={{t "clusterNew.azureaks.tenant.placeholder"}}
@type="text"
@value={{mut config.tenantId}}
/>
</InputOrDisplay>
</div>
{{#if (eq step 1)}} {{#if (eq step 1)}}
<FormAuthCloudCredential <FormAuthCloudCredential
@cloudCredentialKey="aksConfig.azureCredentialSecret" @cloudCredentialKey="aksConfig.azureCredentialSecret"
@ -48,7 +30,6 @@
}} }}
@primaryResource={{primaryResource}} @primaryResource={{primaryResource}}
@progressStep={{action "fetchAksResources"}} @progressStep={{action "fetchAksResources"}}
@disableSave={{not config.tenantId}}
/> />
{{else}} {{else}}
<div class="row"> <div class="row">

View File

@ -3471,6 +3471,7 @@ clusterNew:
title: Networking title: Networking
azureaks: azureaks:
availabilityZoneWarning: No availablity zones are available for the selected region. For the most resiliency it is recommended to select a High Availablity region.
access: access:
cloudCred: Cloud Credential cloudCred: Cloud Credential
detail: Configure the Azure Active Directory (AD) Service Principal that will be used to talk to Azure detail: Configure the Azure Active Directory (AD) Service Principal that will be used to talk to Azure