Skip to content

Commit

Permalink
disk selection by region (#92)
Browse files Browse the repository at this point in the history
disk selection by region

FIx opentelekomcloud/kontainer-engine-driver-otc#57

Reviewed-by: Artem Lifshits
  • Loading branch information
anton-sidelnikov authored Mar 1, 2024
1 parent bbd1279 commit 91b9e0b
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions component/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ const clusterTypes = [
},
]
const regions = ['eu-de', 'eu-nl', 'eu-ch2']
const diskTypes = ['SATA', 'SAS', 'SSD']
const diskTypesAll = ['SATA', 'SAS', 'SSD']
const diskTypesCH = ['SAS', 'SSD']
const availabilityZonesDE = [
'eu-de-01',
'eu-de-02',
Expand Down Expand Up @@ -183,7 +184,7 @@ function azs(region) {
}

/**
* Return proper supporte os based on cluster version
* Return proper support os based on cluster version
* @param clusterVersion {string}
* @returns {string[]}
*/
Expand All @@ -197,6 +198,22 @@ function osList(clusterVersion) {
return result
}

/**
* Return proper disk types based on region
* @param region {string}
* @returns {string[]}
*/
function diskTypesList(region) {
let disks
if (region === 'eu-de' || region === 'eu-nl') {
disks = diskTypesAll
}
if (region === 'eu-ch2'){
disks = diskTypesCH
}
return disks
}

function field(label, placeholder = '', detail = '') {
return {
label: label,
Expand Down Expand Up @@ -445,8 +462,8 @@ export default Ember.Component.extend(ClusterDriver, {
// node disks
rootVolumeSize: 40,
dataVolumeSize: 100,
rootVolumeType: diskTypes[0],
dataVolumeType: diskTypes[0],
rootVolumeType: '',
dataVolumeType: '',
// LB config
createLoadBalancer: false,
});
Expand Down Expand Up @@ -638,7 +655,11 @@ export default Ember.Component.extend(ClusterDriver, {
}),
clusterVersionChoices: m2f(k8sVersions),
clusterTypeChoices: clusterTypes,
diskTypeChoices: a2f(diskTypes),
diskTypeChoices: computed('config.region', function () {
const r = String(get(this, 'config.region'))
console.log(`Region changed to ${r}. Checking available disk types choices... `)
return a2f(diskTypesList(r))
}),
networkModeChoices: computed('config.clusterType', function () {
const type = String(get(this, 'config.clusterType'))
console.log(`Cluster type changed to ${type}. Checking available mode choices... `)
Expand Down

0 comments on commit 91b9e0b

Please sign in to comment.