mirror of https://github.com/rancher/ui.git
commit
a9166ce3fb
|
|
@ -180,9 +180,7 @@ export const DEFAULT_AKS_NODE_POOL_CONFIG = {
|
|||
availabilityZones: ['1', '2', '3'],
|
||||
count: 1,
|
||||
enableAutoScaling: false,
|
||||
maxCount: 3,
|
||||
maxPods: 110,
|
||||
minCount: 1,
|
||||
mode: 'System',
|
||||
name: '',
|
||||
orchestratorVersion: '',
|
||||
|
|
@ -1311,11 +1309,13 @@ export default Resource.extend(Grafana, ResourceUsage, {
|
|||
const lhsMatch = get(lhs, k);
|
||||
const rhsMatch = get(rhs, k);
|
||||
|
||||
if (k !== 'nodeGroups' && k !== 'nodePools') {
|
||||
try {
|
||||
if (isEqual(JSON.stringify(lhsMatch), JSON.stringify(rhsMatch))) {
|
||||
return;
|
||||
}
|
||||
} catch (e){}
|
||||
}
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ export default Component.extend({
|
|||
diskTypes: OS_DISK_TYPES,
|
||||
upgradeVersion: false,
|
||||
showNodeUpgradePreventionReason: false,
|
||||
disableAzs: false,
|
||||
|
||||
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() {
|
||||
if (!isEmpty(get(this, 'originalCluster.aksConfig.kubernetesVersion'))) {
|
||||
return get(this, 'originalCluster.aksConfig.kubernetesVersion');
|
||||
|
|
|
|||
|
|
@ -94,14 +94,58 @@
|
|||
</div>
|
||||
<div class="col span-3">
|
||||
<label class="acc-label">
|
||||
{{t "clusterNew.azureaks.nodePools.availablityZones.label"}}
|
||||
{{t "clusterNew.azureaks.availabilityZones.label"}}
|
||||
</label>
|
||||
<div class="form-control-static">
|
||||
{{#if nodePool.availabilityZones.length}}
|
||||
{{displayZones}}
|
||||
{{else}}
|
||||
{{t "generic.na"}}
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
{{#if isNewNodePool}}
|
||||
<Input
|
||||
@type="checkbox"
|
||||
@checked={{mut availablityZoneOne}}
|
||||
@disabled={{or disableAzs (not isNewNodePool)}}
|
||||
/>
|
||||
{{/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>
|
||||
|
|
|
|||
|
|
@ -64,9 +64,6 @@ export default Component.extend(ClusterDriver, {
|
|||
|
||||
configField: 'aksConfig',
|
||||
|
||||
availablityZoneOne: true,
|
||||
availablityZoneThree: true,
|
||||
availablityZoneTwo: true,
|
||||
clusterAdvanced: false,
|
||||
clusterErrors: null,
|
||||
clusterLocationSaved: false,
|
||||
|
|
@ -116,13 +113,6 @@ export default Component.extend(ClusterDriver, {
|
|||
if ( this.editing && this.importedClusterIsPending || (this.clusterIsPending && config?.privateCluster) ) {
|
||||
set(this, 'step', 4);
|
||||
} else {
|
||||
// reset on edit so we can get real az's
|
||||
setProperties(this, {
|
||||
availablityZoneOne: false,
|
||||
availablityZoneThree: false,
|
||||
availablityZoneTwo: false,
|
||||
});
|
||||
|
||||
this.syncUpstreamConfig();
|
||||
|
||||
const tags = { ...( config.tags || {} ) };
|
||||
|
|
@ -132,32 +122,6 @@ export default Component.extend(ClusterDriver, {
|
|||
if (!isEmpty(config?.authorizedIpRanges)) {
|
||||
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) {
|
||||
const store = get(this, 'globalStore')
|
||||
const { selectedCloudCredential } = this;
|
||||
const { selectedCloudCredential, regionsWithAZs } = this;
|
||||
const data = {
|
||||
cloudCredentialId: get(selectedCloudCredential, 'id'),
|
||||
// tenantId: get(this, 'config.tenantId'),
|
||||
|
|
@ -224,7 +188,21 @@ export default Component.extend(ClusterDriver, {
|
|||
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);
|
||||
|
||||
|
|
@ -309,12 +287,7 @@ export default Component.extend(ClusterDriver, {
|
|||
},
|
||||
|
||||
setTags(section) {
|
||||
const out = []
|
||||
|
||||
for (let key in section) {
|
||||
out.pushObject(`${ key }=${ section[key] }`)
|
||||
}
|
||||
set(this, 'config.tags', out);
|
||||
set(this, 'config.tags', section);
|
||||
},
|
||||
},
|
||||
|
||||
|
|
@ -344,12 +317,7 @@ export default Component.extend(ClusterDriver, {
|
|||
if (regionHasAz) {
|
||||
set(this, 'disableAzs', false);
|
||||
} else {
|
||||
setProperties(this, {
|
||||
disableAzs: true,
|
||||
availablityZoneOne: false,
|
||||
availablityZoneTwo: false,
|
||||
availablityZoneThree: false,
|
||||
})
|
||||
set(this, 'disableAzs', true);
|
||||
}
|
||||
}),
|
||||
|
||||
|
|
@ -372,22 +340,16 @@ export default Component.extend(ClusterDriver, {
|
|||
}
|
||||
}),
|
||||
|
||||
availablityZonesChanged: on('init', observer('availablityZoneOne', 'availablityZoneTwo', 'availablityZoneThree', 'config.nodePools.[]', function() {
|
||||
const {
|
||||
availablityZoneOne, availablityZoneTwo, availablityZoneThree
|
||||
} = this;
|
||||
availablityZonesChanged: on('init', observer('config.nodePools.[]', function() {
|
||||
const nodePools = get(this, 'config.nodePools') || [];
|
||||
const azs = [availablityZoneOne, availablityZoneTwo, availablityZoneThree];
|
||||
const anySet = azs.any((az) => az);
|
||||
const nodeAzs = [];
|
||||
const azs = [];
|
||||
|
||||
azs.forEach((az, idx) => {
|
||||
if (az) {
|
||||
const azNo = idx + 1;
|
||||
|
||||
nodeAzs.push(azNo);
|
||||
nodePools.forEach((np) => {
|
||||
if (np?.availabilityZones && np.availabilityZones.length > 0) {
|
||||
azs.pushObjects(np.availabilityZones);
|
||||
}
|
||||
});
|
||||
const anySet = azs.uniq().any((az) => az);
|
||||
|
||||
if (anySet) {
|
||||
setProperties(this, {
|
||||
|
|
@ -397,8 +359,6 @@ export default Component.extend(ClusterDriver, {
|
|||
} else {
|
||||
set(this, 'loadBalancerImmutable', false);
|
||||
}
|
||||
|
||||
nodePools.forEach((np) => set(np, 'availabilityZones', nodeAzs));
|
||||
})),
|
||||
|
||||
resetAdvancedOptions: on('init', observer('config.networkPlugin', function() {
|
||||
|
|
@ -582,11 +542,11 @@ export default Component.extend(ClusterDriver, {
|
|||
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') }));
|
||||
}
|
||||
|
||||
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') }));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -102,66 +102,13 @@
|
|||
</InputOrDisplay>
|
||||
</div>
|
||||
<div class="col span-6">
|
||||
<label class="acc-label">
|
||||
{{t "clusterNew.azureaks.availabilityZones.label"}}
|
||||
</label>
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
{{#if isNewOrEditable}}
|
||||
<Input
|
||||
@type="checkbox"
|
||||
@checked={{mut availablityZoneOne}}
|
||||
@disabled={{and disableAzs (not isNewOrEditable)}}
|
||||
{{#if disableAzs}}
|
||||
<BannerMessage
|
||||
@icon="icon-alert"
|
||||
@color="bg-warning mb-10"
|
||||
@message={{t "clusterNew.azureaks.availabilityZoneWarning" }}
|
||||
/>
|
||||
{{/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>
|
||||
{{#if (eq step 2)}}
|
||||
|
|
@ -377,7 +324,9 @@
|
|||
<div class="col span-6">
|
||||
<label class="acc-label" for="azureaks-master-dns-prefix">
|
||||
{{t "clusterNew.azureaks.dns.label"}}
|
||||
{{#if isNew}}
|
||||
<FieldRequired />
|
||||
{{/if}}
|
||||
</label>
|
||||
<InputOrDisplay
|
||||
@editable={{isNewOrEditable}}
|
||||
|
|
@ -641,6 +590,7 @@
|
|||
<div class="row">
|
||||
{{#each config.nodePools as |nodePool|}}
|
||||
<AksNodePoolRow
|
||||
@disableAzs={{disableAzs}}
|
||||
@originalCluster={{model.originalCluster}}
|
||||
@isNew={{isNewOrEditable}}
|
||||
@mode={{mode}}
|
||||
|
|
|
|||
|
|
@ -16,24 +16,6 @@
|
|||
@showExpand={{false}}
|
||||
>
|
||||
<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)}}
|
||||
<FormAuthCloudCredential
|
||||
@cloudCredentialKey="aksConfig.azureCredentialSecret"
|
||||
|
|
@ -48,7 +30,6 @@
|
|||
}}
|
||||
@primaryResource={{primaryResource}}
|
||||
@progressStep={{action "fetchAksResources"}}
|
||||
@disableSave={{not config.tenantId}}
|
||||
/>
|
||||
{{else}}
|
||||
<div class="row">
|
||||
|
|
|
|||
|
|
@ -3471,6 +3471,7 @@ clusterNew:
|
|||
title: Networking
|
||||
|
||||
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:
|
||||
cloudCred: Cloud Credential
|
||||
detail: Configure the Azure Active Directory (AD) Service Principal that will be used to talk to Azure
|
||||
|
|
|
|||
Loading…
Reference in New Issue