Add cluster template options

Following updates of magnumclient, this patch adds
some properties to cluster template creation and views.

To spec section:
- docker_storage_driver: 'devicemapper' or 'overlay', default='devicemapper'

To network section:
- fixed_subnet: string
- floating_ip_enabled: boolean, default=True
- master_lb_enabled: boolean, default=False

Change-Id: Ibeb9933e68f533b0aea3b6951a3c293dc85343e4
Implements: blueprint cluster-template-options
Depends-On: I971ef74f0cc79346a76c1faba55777b0a44465da
This commit is contained in:
Shu Muto 2016-08-29 15:04:42 +09:00
parent 04c6e4433a
commit 8d7104be1a
8 changed files with 80 additions and 23 deletions

View File

@ -31,7 +31,10 @@ CLUSTER_TEMPLATE_CREATE_ATTRS = ['name', 'image_id', 'flavor_id',
'dns_nameserver', 'docker_volume_size', 'dns_nameserver', 'docker_volume_size',
'labels', 'coe', 'http_proxy', 'https_proxy', 'labels', 'coe', 'http_proxy', 'https_proxy',
'no_proxy', 'network_driver', 'volume_driver', 'no_proxy', 'network_driver', 'volume_driver',
'public', 'registry_enabled', 'tls_disabled'] 'public', 'registry_enabled', 'tls_disabled',
'docker_storage_driver', 'fixed_subnet',
'floating_ip_enabled', 'master_lb_enabled',
'insecure_registry']
CLUSTER_CREATE_ATTRS = ['name', 'baymodel_id', 'node_count', CLUSTER_CREATE_ATTRS = ['name', 'baymodel_id', 'node_count',
'discovery_url', 'cluster_create_timeout', 'discovery_url', 'cluster_create_timeout',

View File

@ -45,6 +45,7 @@
flavor_id: "", flavor_id: "",
master_flavor_id: "", master_flavor_id: "",
docker_volume_size: null, docker_volume_size: null,
docker_storage_driver: "devicemapper",
keypair_id: "", keypair_id: "",
network_driver: "", network_driver: "",
volume_driver: "", volume_driver: "",
@ -53,13 +54,19 @@
no_proxy: null, no_proxy: null,
external_network_id: "", external_network_id: "",
fixed_network: "", fixed_network: "",
fixed_subnet: "",
dns_nameserver: null, dns_nameserver: null,
master_lb_enabled: "",
floating_ip_enabled: true,
labels: null, labels: null,
network_drivers : [{name: "docker", label: gettext("Docker")}, network_drivers : [{name: "", label: gettext("Choose a Network Driver")},
{name: "docker", label: gettext("Docker")},
{name: "flannel", label: gettext("Flannel")}], {name: "flannel", label: gettext("Flannel")}],
volume_drivers : [{name: "", label: gettext("Choose a Volume Driver")}, volume_drivers : [{name: "", label: gettext("Choose a Volume Driver")},
{name: "cinder", label: gettext("Cinder")}, {name: "cinder", label: gettext("Cinder")},
{name: "rexray", label: gettext("Rexray")}] {name: "rexray", label: gettext("Rexray")}],
docker_storage_drivers: [{name: "devicemapper", label: gettext("Device Mapper")},
{name: "overlay", label: gettext("Overley")}]
}; };
} }
@ -83,7 +90,7 @@
// These are not for submittion. // These are not for submittion.
for (var key in finalSpec) { for (var key in finalSpec) {
if (finalSpec.hasOwnProperty(key) && finalSpec[key] === null || finalSpec[key] === "" if (finalSpec.hasOwnProperty(key) && finalSpec[key] === null || finalSpec[key] === ""
|| key === "network_drivers" || key === "volume_drivers") { || key === "network_drivers" || key === "volume_drivers" || key === "docker_storage_drivers") {
delete finalSpec[key]; delete finalSpec[key];
} }
} }

View File

@ -2,3 +2,7 @@
<dd translate>This should really be named fixed-network-cidr. Default: 10.0.0.0/24</dd> <dd translate>This should really be named fixed-network-cidr. Default: 10.0.0.0/24</dd>
<dt translate>DNS</dt> <dt translate>DNS</dt>
<dd translate>Specify the nameserver to use for the cluster template. Default: 8.8.8.8</dd> <dd translate>Specify the nameserver to use for the cluster template. Default: 8.8.8.8</dd>
<dt translate>Master LB</dt>
<dd translate>Indicates whether created clusters should have a load balancer for master nodes or not. Default: False</dd>
<dt translate>Floating IP</dt>
<dd translate>Indicates whether created clusters should have a floating ip or not. Default: True</dd>

View File

@ -48,6 +48,13 @@
ng-model="model.newClusterTemplateSpec.fixed_network" ng-model="model.newClusterTemplateSpec.fixed_network"
placeholder="{$ 'The private Neutron network name to connect to this cluster template'|translate $}"> placeholder="{$ 'The private Neutron network name to connect to this cluster template'|translate $}">
</div> </div>
<div class="form-group">
<label class="control-label" for="cluster-template-fixed-subnet" translate>Fixed Subnet</label>
<input name="cluster-template-fixed-subnet" type="text" class="form-control"
id="cluster-template-fixed-subnet"
ng-model="model.newClusterTemplateSpec.fixed_subnet"
placeholder="{$ 'The private Neutron subnet name to connect to this cluster template'|translate $}">
</div>
<div class="form-group"> <div class="form-group">
<label class="control-label" for="cluster-template-dns-nameserver" translate>DNS</label> <label class="control-label" for="cluster-template-dns-nameserver" translate>DNS</label>
<input name="cluster-template-dns-nameserver" type="text" class="form-control" <input name="cluster-template-dns-nameserver" type="text" class="form-control"
@ -55,6 +62,20 @@
ng-model="model.newClusterTemplateSpec.dns_nameserver" ng-model="model.newClusterTemplateSpec.dns_nameserver"
placeholder="{$ 'The DNS nameserver to use for this cluster template'|translate $}"> placeholder="{$ 'The DNS nameserver to use for this cluster template'|translate $}">
</div> </div>
<div class="form-group">
<div class="themable-checkbox">
<input name="cluster-template-master-lb-enabled" type="checkbox" id="cluster-template-master-lb-enabled"
ng-model="model.newClusterTemplateSpec.master_lb_enabled">
<label for="cluster-template-master-lb-enabled" translate>Master LB</label>
</div>
</div>
<div class="form-group">
<div class="themable-checkbox">
<input name="cluster-template-floating-ip-enabled" type="checkbox" id="cluster-template-floating-ip-enabled"
ng-model="model.newClusterTemplateSpec.floating_ip_enabled">
<label for="cluster-template-floating-ip-enabled" translate>Floating IP</label>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,12 +1,12 @@
<dl> <dl>
<dt translate>Image</dt> <dt translate>Image</dt>
<dd translate>The name or UUID of the base image to customize for the cluster.</dd> <dd translate>The name or UUID of the base image to customize for the cluster.</dd>
<dt translate>Keypair</dt>
<dd translate>The name or UUID of the SSH keypair to load into the cluster nodes.</dd>
<dt translate>Flavor</dt> <dt translate>Flavor</dt>
<dd translate>The nova flavor id to use when launching the cluster. Default: m1.small</dd> <dd translate>The nova flavor id to use when launching the cluster. Default: m1.small</dd>
<dt translate>Master Flavor</dt> <dt translate>Master Flavor</dt>
<dd translate>The nova flavor id to use when launching the master node of the cluster. Default: m1.small</dd> <dd translate>The nova flavor id to use when launching the master node of the cluster. Default: m1.small</dd>
<dt translate>Docker Volume Size</dt> <dt translate>Docker Volume Size</dt>
<dd translate>The size in GB for Docker Volume. Default: 25</dd> <dd translate>The size in GB for Docker Volume. Default: 25</dd>
<dt translate>Keypair</dt>
<dd translate>The name or UUID of the SSH keypair to load into the cluster nodes.</dd>
</dl> </dl>

View File

@ -1,6 +1,6 @@
<div ng-controller="createClusterTemplateSpecController as ctrl"> <div ng-controller="createClusterTemplateSpecController as ctrl">
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col-xs-6">
<div class="form-group"> <div class="form-group">
<label class="control-label" for="cluster-template-image-id"> <label class="control-label" for="cluster-template-image-id">
<translate>Image</translate> <translate>Image</translate>
@ -12,6 +12,18 @@
</select> </select>
</div> </div>
</div> </div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label" for="cluster-template-keypair-id">
<translate>Keypair</translate>
<span class="hz-icon-required fa fa-asterisk"></span>
</label>
<select name="cluster-template-keypair-id" type="text" class="form-control" id="cluster-template-keypair-id"
ng-model="model.newClusterTemplateSpec.keypair_id" ng-required="true"
ng-options="keypair.id as keypair.name for keypair in ctrl.keypairs">
</select>
</div>
</div>
<div class="col-xs-6"> <div class="col-xs-6">
<div class="form-group"> <div class="form-group">
<label class="control-label" for="cluster-template-flavor-id" translate>Flavor</label> <label class="control-label" for="cluster-template-flavor-id" translate>Flavor</label>
@ -30,7 +42,7 @@
</select> </select>
</div> </div>
</div> </div>
<div class="col-xs-6"> <div class="col-xs-12">
<div class="form-group"> <div class="form-group">
<label class="control-label" for="cluster-template-volume-driver" translate>Volume Driver</label> <label class="control-label" for="cluster-template-volume-driver" translate>Volume Driver</label>
<select name="cluster-template-volume-driver" type="text" class="form-control" id="cluster-template-volume-driver" <select name="cluster-template-volume-driver" type="text" class="form-control" id="cluster-template-volume-driver"
@ -40,6 +52,15 @@
</select> </select>
</div> </div>
</div> </div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label" for="cluster-template-docker-storage-driver" translate>Docker Volume Driver</label>
<select name="cluster-template-docker-storage-driver" type="text" class="form-control" id="cluster-template-docker-storage-driver"
ng-model="model.newClusterTemplateSpec.docker_storage_driver"
ng-options="driver.name as driver.label for driver in model.newClusterTemplateSpec.docker_storage_drivers">
</select>
</div>
</div>
<div class="col-xs-6"> <div class="col-xs-6">
<div class="form-group"> <div class="form-group">
<label class="control-label" for="cluster-template-docker-volume-size" translate> <label class="control-label" for="cluster-template-docker-volume-size" translate>
@ -51,17 +72,5 @@
placeholder="{$ 'Specify the size in GB for the docker volume'|translate $}"> placeholder="{$ 'Specify the size in GB for the docker volume'|translate $}">
</div> </div>
</div> </div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label" for="cluster-template-keypair-id">
<translate>Keypair</translate>
<span class="hz-icon-required fa fa-asterisk"></span>
</label>
<select name="cluster-template-keypair-id" type="text" class="form-control" id="cluster-template-keypair-id"
ng-model="model.newClusterTemplateSpec.keypair_id" ng-required="true"
ng-options="keypair.id as keypair.name for keypair in ctrl.keypairs">
</select>
</div>
</div>
</div> </div>
</div> </div>

View File

@ -24,16 +24,18 @@
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<dt translate>Image ID</dt> <dt translate>Image ID</dt>
<dd><a href="project/images/{$ ctrl.image_uuid $}/" target="_self">{$ ctrl.cluster_template.image_id $}</a></dd> <dd><a href="project/images/{$ ctrl.image_uuid $}/" target="_self">{$ ctrl.cluster_template.image_id $}</a></dd>
<dt translate>Keypair ID</dt>
<dd><a href="project/access_and_security/keypairs/{$ ctrl.cluster_template.keypair_id $}/" target="_self">{$ ctrl.cluster_template.keypair_id $}</a></dd>
<dt translate>Flavor ID</dt> <dt translate>Flavor ID</dt>
<dd>{$ ctrl.cluster_template.flavor_id $}</dd> <dd>{$ ctrl.cluster_template.flavor_id $}</dd>
<dt translate>Master Flavor ID</dt> <dt translate>Master Flavor ID</dt>
<dd>{$ ctrl.cluster_template.master_flavor_id $}</dd> <dd>{$ ctrl.cluster_template.master_flavor_id $}</dd>
<dt translate>Volume Driver</dt> <dt translate>Volume Driver</dt>
<dd>{$ ctrl.cluster_template.volume_driver $}</dd> <dd>{$ ctrl.cluster_template.volume_driver $}</dd>
<dt translate>Docker Storage Driver</dt>
<dd>{$ ctrl.cluster_template.docker_storage_driver $}</dd>
<dt translate>Docker Volume Size</dt> <dt translate>Docker Volume Size</dt>
<dd>{$ ctrl.cluster_template.docker_volume_size | gb $}</dd> <dd>{$ ctrl.cluster_template.docker_volume_size | gb $}</dd>
<dt translate>Keypair ID</dt>
<dd><a href="project/access_and_security/keypairs/{$ ctrl.cluster_template.keypair_id $}/" target="_self">{$ ctrl.cluster_template.keypair_id $}</a></dd>
</dl> </dl>
</div> </div>
</div> </div>
@ -54,8 +56,14 @@
<dd>{$ ctrl.cluster_template.external_network_id $}</dd> <dd>{$ ctrl.cluster_template.external_network_id $}</dd>
<dt translate>Fixed Network</dt> <dt translate>Fixed Network</dt>
<dd>{$ ctrl.cluster_template.fixed_network $}</dd> <dd>{$ ctrl.cluster_template.fixed_network $}</dd>
<dt translate>Fixed Subnet</dt>
<dd>{$ ctrl.cluster_template.fixed_subnet $}</dd>
<dt translate>DNS</dt> <dt translate>DNS</dt>
<dd>{$ ctrl.cluster_template.dns_nameserver $}</dd> <dd>{$ ctrl.cluster_template.dns_nameserver $}</dd>
<dt translate>TLS Enabled</dt>
<dd>{$ ctrl.cluster_template.master_lb_enabled | yesno $}</dd>
<dt translate>Floating IP Enabled</dt>
<dd>{$ ctrl.cluster_template.floating_ip_enabled | yesno $}</dd>
</dl> </dl>
</div> </div>
<div class="col-md-6 detail"> <div class="col-md-6 detail">

View File

@ -37,7 +37,12 @@ def data(TEST):
"no-proxy": "", "no-proxy": "",
"labels": "", "labels": "",
"tls-disabled": "", "tls-disabled": "",
"public": ""} "public": "",
"docker_storage_driver": "",
"fixed_subnet": "",
"floating_ip_enabled": "",
"master_lb_enabled": "",
"insecure_registry": ""}
TEST.cluster_templates.add(cluster_template_dict_1) TEST.cluster_templates.add(cluster_template_dict_1)