Merge pull request #2635 from loganhz/aliyun-version

Support alibaba ACK managed kubernetes
This commit is contained in:
Westly Wright 2019-02-16 08:08:03 -07:00 committed by GitHub
commit b34426e1e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 144 additions and 83 deletions

View File

@ -11,12 +11,9 @@ const ENDPOINT = 'ecs.aliyuncs.com';
const PAGE_SIZE = 50;
const K8S_1_11_5 = '1.11.5';
const VERSIONS = [
{
label: K8S_1_11_5,
value: K8S_1_11_5
}
];
const VERSIONS = [K8S_1_11_5];
const KUBERNETES = 'Kubernetes';
const MANAGED = 'ManagedKubernetes'
const DISKS = [
{
@ -29,25 +26,39 @@ const DISKS = [
}
];
const CLUSTER_TYPES = [
{
label: 'clusterNew.aliyunkcs.clusters.k8s',
value: KUBERNETES
},
{
label: 'clusterNew.aliyunkcs.clusters.managed',
value: MANAGED
}
];
const REGIONS = [
{
label: 'cn-qingdao',
value: 'cn-qingdao'
value: 'cn-qingdao',
}, {
label: 'cn-beijing',
value: 'cn-beijing'
label: 'cn-beijing',
value: 'cn-beijing',
managed: true,
}, {
label: 'cn-zhangjiakou',
value: 'cn-zhangjiakou'
}, {
label: 'cn-shanghai',
value: 'cn-shanghai'
label: 'cn-shanghai',
value: 'cn-shanghai',
managed: true,
}, {
label: 'cn-shenzhen',
value: 'cn-shenzhen'
}, {
label: 'cn-hangzhou',
value: 'cn-hangzhou'
label: 'cn-hangzhou',
value: 'cn-hangzhou',
managed: true,
}, {
label: 'cn-hongkong',
value: 'cn-hongkong'
@ -58,17 +69,20 @@ const REGIONS = [
label: 'ap-northeast-1',
value: 'ap-northeast-1'
}, {
label: 'ap-south-1',
value: 'ap-south-1'
label: 'ap-south-1',
value: 'ap-south-1',
managed: true,
}, {
label: 'ap-southeast-1',
value: 'ap-southeast-1'
label: 'ap-southeast-1',
value: 'ap-southeast-1',
managed: true,
}, {
label: 'ap-southeast-2',
value: 'ap-southeast-2'
}, {
label: 'ap-southeast-5',
value: 'ap-southeast-5'
label: 'ap-southeast-5',
value: 'ap-southeast-5',
managed: true,
}, {
label: 'us-east-1',
value: 'us-east-1'
@ -82,8 +96,9 @@ const REGIONS = [
label: 'eu-central-1',
value: 'eu-central-1'
}, {
label: 'ap-southeast-3',
value: 'ap-southeast-3'
label: 'ap-southeast-3',
value: 'ap-southeast-3',
managed: true,
}];
export default Component.extend(ClusterDriver, {
@ -103,7 +118,6 @@ export default Component.extend(ClusterDriver, {
keyChoices: null,
allSubnets: null,
allInstances: null,
version: K8S_1_11_5,
init() {
this._super(...arguments);
@ -116,7 +130,8 @@ export default Component.extend(ClusterDriver, {
accessKeyId: null,
accessKeySecret: null,
regionId: 'cn-beijing',
clusterType: 'Kubernetes',
clusterType: KUBERNETES,
kubernetesVersion: K8S_1_11_5,
zoneId: null,
snatEntry: true,
publicSlb: true,
@ -195,19 +210,10 @@ export default Component.extend(ClusterDriver, {
return;
}
this.setInstances();
const instances = get(this, 'selectedZone.raw.AvailableInstanceTypes.InstanceTypes');
set(this, 'instanceChoices', instances.map((i) => {
const g = i.split('.')[1];
return {
group: g,
label: i,
value: i
}
}));
const found = instances.indexOf(get(this, 'config.masterInstanceType'));
if ( !found ) {
@ -219,12 +225,13 @@ export default Component.extend(ClusterDriver, {
},
configWorker(cb) {
this.setInstances();
const errors = get(this, 'errors') || [];
const intl = get(this, 'intl');
const masterInstanceType = get(this, 'config.masterInstanceType');
if ( !masterInstanceType ) {
if ( !masterInstanceType && get(this, 'config.clusterType') === KUBERNETES ) {
errors.push(intl.t('clusterNew.aliyunkcs.instanceType.required'));
}
@ -296,6 +303,30 @@ export default Component.extend(ClusterDriver, {
return zoneChoices.findBy('value', get(this, 'config.zoneId'));
}),
clusterTypeChoices: computed('config.regionId', 'zoneChoices', function() {
const region = REGIONS.findBy('value', get(this, 'config.regionId'));
if ( region && get(region, 'managed') ) {
return CLUSTER_TYPES;
} else {
return CLUSTER_TYPES.filter((type) => get(type, 'value') !== MANAGED);
}
}),
setInstances() {
const instances = get(this, 'selectedZone.raw.AvailableInstanceTypes.InstanceTypes');
set(this, 'instanceChoices', instances.map((i) => {
const g = i.split('.')[1];
return {
group: g,
label: i,
value: i
}
}));
},
fetch(resource, plural, page = 1) {
set(this, 'errors', []);
let ecs = get(this, 'ecsClient');

View File

@ -1,13 +1,13 @@
{{#accordion-list showExpandAll=false as | al expandFn |}}
{{#accordion-list-item title=(t 'clusterNew.aliyunkcs.access.title')
detail=(t 'clusterNew.aliyunkcs.access.detail')
{{#accordion-list-item title=(t "clusterNew.aliyunkcs.access.title")
detail=(t "clusterNew.aliyunkcs.access.detail")
expandAll=expandAll
expand=(action expandFn)
expandOnInit=true
}}
<div class="row">
<div class="col span-4">
<label class="acc-label">{{t 'clusterNew.aliyunkcs.regionId.label'}}</label>
<label class="acc-label">{{t "clusterNew.aliyunkcs.regionId.label"}}</label>
{{#if (eq step 1)}}
{{searchable-select class="form-control"
content=regionChoices
@ -18,12 +18,12 @@
{{/if}}
</div>
<div class="col span-4">
<label class="acc-label">{{t 'clusterNew.aliyunkcs.accessKeyId.label'}}{{field-required}}</label>
<label class="acc-label">{{t "clusterNew.aliyunkcs.accessKeyId.label"}}{{field-required}}</label>
{{#if (eq step 1)}}
{{input type="text"
name="username"
classNames="form-control"
placeholder=(t 'clusterNew.aliyunkcs.accessKeyId.placeholder')
placeholder=(t "clusterNew.aliyunkcs.accessKeyId.placeholder")
value=config.accessKeyId
}}
{{else}}
@ -31,17 +31,17 @@
{{/if}}
</div>
<div class="col span-4">
<label class="acc-label">{{t 'clusterNew.aliyunkcs.accessKeySecret.label'}}{{field-required}}</label>
<label class="acc-label">{{t "clusterNew.aliyunkcs.accessKeySecret.label"}}{{field-required}}</label>
{{#if (eq step 1)}}
{{input type="password" name="password" classNames="form-control" placeholder=(t 'clusterNew.aliyunkcs.accessKeySecret.placeholder') value=config.accessKeySecret}}
{{input type="password" name="password" classNames="form-control" placeholder=(t "clusterNew.aliyunkcs.accessKeySecret.placeholder") value=config.accessKeySecret}}
{{else}}
<div class="text-muted text-italic">{{t 'clusterNew.aliyunkcs.accessKeySecret.provided'}}</div>
<div class="text-muted text-italic">{{t "clusterNew.aliyunkcs.accessKeySecret.provided"}}</div>
{{/if}}
</div>
</div>
{{/accordion-list-item}}
{{#if (eq step 1)}}
{{save-cancel editing=(eq mode 'edit')
{{save-cancel editing=(eq mode "edit")
save="aliyunLogin"
cancel=close
createLabel="clusterNew.aliyunkcs.access.next"
@ -49,27 +49,42 @@
}}
{{/if}}
{{#if (gte step 2)}}
{{#accordion-list-item title=(t 'clusterNew.aliyunkcs.cluster.title')
detail=(t 'clusterNew.aliyunkcs.cluster.detail')
{{#accordion-list-item title=(t "clusterNew.aliyunkcs.cluster.title")
detail=(t "clusterNew.aliyunkcs.cluster.detail")
showExpand=false
expandOnInit=true
expandAll=al.expandAll
expand=(action expandFn)
}}
<div class="row">
<div class="col span-6">
<label class="acc-label">{{t 'clusterNew.aliyunkcs.version.label'}}</label>
<div class="col span-4">
<label class="acc-label">{{t "clusterNew.aliyunkcs.clusters.label"}}{{field-required}}</label>
{{#if (eq step 2)}}
{{searchable-select class="form-control"
content=versionChoices
value=version
content=clusterTypeChoices
value=config.clusterType
localizedLabel=true
}}
{{else}}
<div>{{version}}</div>
<div>{{config.clusterType}}</div>
{{/if}}
</div>
<div class="col span-6">
<label class="acc-label">{{t 'clusterNew.aliyunkcs.zoneId.label'}}{{field-required}}</label>
<div class="col span-4">
<label class="acc-label">{{t "clusterNew.aliyunkcs.version.label"}}</label>
{{#if (eq step 2)}}
{{form-versions
cluster=cluster
editing=(eq mode "edit")
value=config.kubernetesVersion
versions=versionChoices
initialVersion=config.version
}}
{{else}}
<div>{{config.version}}</div>
{{/if}}
</div>
<div class="col span-4">
<label class="acc-label">{{t "clusterNew.aliyunkcs.zoneId.label"}}{{field-required}}</label>
{{#if (eq step 2)}}
{{searchable-select class="form-control"
content=zoneChoices
@ -81,18 +96,25 @@
</div>
</div>
{{/accordion-list-item}}
{{#if (eq step 2)}}
{{save-cancel editing=(eq mode 'edit')
{{#if (and (eq step 2) (eq config.clusterType "Kubernetes"))}}
{{save-cancel editing=(eq mode "edit")
save="configMaster"
cancel=close
createLabel="clusterNew.aliyunkcs.cluster.next"
savingLabel="clusterNew.aliyunkcs.cluster.loading"
}}
{{else if (and (eq step 2) (eq config.clusterType "ManagedKubernetes"))}}
{{save-cancel editing=(eq mode "edit")
save="configWorker"
cancel=close
createLabel="clusterNew.aliyunkcs.master.next"
savingLabel="clusterNew.aliyunkcs.master.loading"
}}
{{/if}}
{{/if}}
{{#if (gte step 3)}}
{{#accordion-list-item title=(t 'clusterNew.aliyunkcs.master.title')
detail=(t 'clusterNew.aliyunkcs.master.detail')
{{#if (and (gte step 3) (eq config.clusterType "Kubernetes"))}}
{{#accordion-list-item title=(t "clusterNew.aliyunkcs.master.title")
detail=(t "clusterNew.aliyunkcs.master.detail")
showExpand=false
expandOnInit=true
expandAll=al.expandAll
@ -100,7 +122,7 @@
}}
<div class="row">
<div class="col span-6">
<label class="acc-label">{{t 'clusterNew.aliyunkcs.instanceType.label'}}{{field-required}}</label>
<label class="acc-label">{{t "clusterNew.aliyunkcs.instanceType.label"}}{{field-required}}</label>
{{#if (eq step 3)}}
{{searchable-select class="form-control"
content=instanceChoices
@ -111,13 +133,13 @@
{{/if}}
</div>
<div class="col span-6">
<label class="acc-label">{{t 'clusterNew.aliyunkcs.masterNum.label'}}</label>
<label class="acc-label">{{t "clusterNew.aliyunkcs.masterNum.label"}}</label>
<div>3</div>
</div>
</div>
<div class="row">
<div class="col span-6">
<label class="acc-label">{{t 'clusterNew.aliyunkcs.rootType.label'}}</label>
<label class="acc-label">{{t "clusterNew.aliyunkcs.rootType.label"}}</label>
{{#if (eq step 3)}}
{{searchable-select class="form-control"
content=diskChoices
@ -129,20 +151,20 @@
{{/if}}
</div>
<div class="col span-6">
<label class="acc-label">{{t 'clusterNew.aliyunkcs.rootSize.label'}}</label>
<label class="acc-label">{{t "clusterNew.aliyunkcs.rootSize.label"}}</label>
{{#if (eq step 3)}}
<div class="input-group">
{{input-integer min=40 max=500 value=config.masterSystemDiskSize classNames="form-control" placeholder=(t 'clusterNew.aliyunkcs.rootSize.placeholder')}}
<span class="input-group-addon bg-default">{{t 'generic.gigabyte'}}</span>
{{input-integer min=40 max=500 value=config.masterSystemDiskSize classNames="form-control" placeholder=(t "clusterNew.aliyunkcs.rootSize.placeholder")}}
<span class="input-group-addon bg-default">{{t "generic.gigabyte"}}</span>
</div>
{{else}}
<div>{{config.masterSystemDiskSize}} {{t 'generic.gigabyte'}}</div>
<div>{{config.masterSystemDiskSize}} {{t "generic.gigabyte"}}</div>
{{/if}}
</div>
</div>
{{/accordion-list-item}}
{{#if (eq step 3)}}
{{save-cancel editing=(eq mode 'edit')
{{save-cancel editing=(eq mode "edit")
save="configWorker"
cancel=close
createLabel="clusterNew.aliyunkcs.master.next"
@ -151,8 +173,8 @@
{{/if}}
{{/if}}
{{#if (gte step 4)}}
{{#accordion-list-item title=(t 'clusterNew.aliyunkcs.worker.title')
detail=(t 'clusterNew.aliyunkcs.worker.detail')
{{#accordion-list-item title=(t "clusterNew.aliyunkcs.worker.title")
detail=(t "clusterNew.aliyunkcs.worker.detail")
showExpand=false
expandOnInit=true
expandAll=al.expandAll
@ -160,7 +182,7 @@
}}
<div class="row">
<div class="col span-6">
<label class="acc-label">{{t 'clusterNew.aliyunkcs.instanceType.label'}}{{field-required}}</label>
<label class="acc-label">{{t "clusterNew.aliyunkcs.instanceType.label"}}{{field-required}}</label>
{{#if (eq step 4)}}
{{searchable-select class="form-control"
content=instanceChoices
@ -171,11 +193,11 @@
{{/if}}
</div>
<div class="col span-6">
<label class="acc-label">{{t 'clusterNew.aliyunkcs.numOfNodes.label'}}</label>
<label class="acc-label">{{t "clusterNew.aliyunkcs.numOfNodes.label"}}</label>
{{#if (eq step 4)}}
{{input-integer min=0 max=300 value=config.numOfNodes classNames="form-control" placeholder=(t 'clusterNew.aliyunkcs.numOfNodes.placeholder')}}
{{input-integer min=0 max=300 value=config.numOfNodes classNames="form-control" placeholder=(t "clusterNew.aliyunkcs.numOfNodes.placeholder")}}
<p class="help-block">
{{t 'clusterNew.aliyunkcs.numOfNodes.help'}}
{{t "clusterNew.aliyunkcs.numOfNodes.help"}}
</p>
{{else}}
<div>{{config.numOfNodes}}</div>
@ -184,7 +206,7 @@
</div>
<div class="row">
<div class="col span-6">
<label class="acc-label">{{t 'clusterNew.aliyunkcs.rootType.label'}}</label>
<label class="acc-label">{{t "clusterNew.aliyunkcs.rootType.label"}}</label>
{{searchable-select class="form-control"
content=diskChoices
localizedLabel=true
@ -192,16 +214,16 @@
}}
</div>
<div class="col span-6">
<label class="acc-label">{{t 'clusterNew.aliyunkcs.rootSize.label'}}</label>
<label class="acc-label">{{t "clusterNew.aliyunkcs.rootSize.label"}}</label>
<div class="input-group">
{{input-integer min=40 max=500 value=config.workerSystemDiskSize classNames="form-control" placeholder=(t 'clusterNew.aliyunkcs.rootSize.placeholder')}}
<span class="input-group-addon bg-default">{{t 'generic.gigabyte'}}</span>
{{input-integer min=40 max=500 value=config.workerSystemDiskSize classNames="form-control" placeholder=(t "clusterNew.aliyunkcs.rootSize.placeholder")}}
<span class="input-group-addon bg-default">{{t "generic.gigabyte"}}</span>
</div>
</div>
</div>
<div class="row">
<div class="col span-6">
<label class="acc-label">{{t 'clusterNew.aliyunkcs.storageType.label'}}</label>
<label class="acc-label">{{t "clusterNew.aliyunkcs.storageType.label"}}</label>
{{searchable-select class="form-control"
content=diskChoices
localizedLabel=true
@ -209,16 +231,16 @@
}}
</div>
<div class="col span-6">
<label class="acc-label">{{t 'clusterNew.aliyunkcs.storageSize.label'}}</label>
<label class="acc-label">{{t "clusterNew.aliyunkcs.storageSize.label"}}</label>
<div class="input-group">
{{input-integer min=40 max=32768 value=config.workerDataDiskSize classNames="form-control" placeholder=(t 'clusterNew.aliyunkcs.rootSize.placeholder')}}
<span class="input-group-addon bg-default">{{t 'generic.gigabyte'}}</span>
{{input-integer min=40 max=32768 value=config.workerDataDiskSize classNames="form-control" placeholder=(t "clusterNew.aliyunkcs.rootSize.placeholder")}}
<span class="input-group-addon bg-default">{{t "generic.gigabyte"}}</span>
</div>
</div>
</div>
<div class="row">
<div class="col span-6">
<label class="acc-label">{{t 'clusterNew.aliyunkcs.keyPair.label'}}{{field-required}}</label>
<label class="acc-label">{{t "clusterNew.aliyunkcs.keyPair.label"}}{{field-required}}</label>
{{searchable-select class="form-control"
content=keyChoices
value=config.keyPair
@ -227,7 +249,7 @@
</div>
{{/accordion-list-item}}
{{#if (eq step 4)}}
{{save-cancel editing=(eq mode 'edit')
{{save-cancel editing=(eq mode "edit")
save="save"
cancel=close
}}

View File

@ -2390,6 +2390,10 @@ clusterNew:
detail: Choose the Zone and Kubernetes version that will be used to launch Alibaba Kubernetes Service
next: "Next: Configure Master Nodes"
loading: "Loading Availability Zones from Alibaba"
clusters:
k8s: Kubernetes
managed: Managed Kubernetes
label: Cluster Type
master:
title: Master Nodes
detail: Configure the master nodes that will be used to launch Alibaba Kubernetes Service

View File

@ -2400,7 +2400,11 @@ clusterNew:
title: 集群配置
detail: 选择阿里云Kubernetes服务中使用的可用区和Kubernetes版本
next: "下一步: 设置Master节点"
loading: "Loading Availability Zones from Aliyun"
loading: "从阿里云获取可用区列表"
clusters:
k8s: Kubernetes
managed: Kubernetes托管版
label: 集群类型
master:
title: Master节点
detail: 配置阿里云Kubernetes服务中的Master节点
@ -6828,4 +6832,4 @@ rkeConfigComment:
" quota-backend-bytes: '4294967296'"
docker_root_dir: |
""
" # 自定义Rancher参数"
" # 自定义Rancher参数"