Allow keypair in cluster creation
The patch introduces the same functionality as the command line interface. When the template contains keypair, user can either provide a new keypair for the cluster or inherit one from the template. When template has no keypair attached, user has to provide a keypair for the cluster, otherwise the error will be returned (exactly as for the CLI). Closes-Bug: #1645754 Change-Id: I07c43be68022492f3c59b391ce6c31efc7b0aa79
This commit is contained in:
parent
8934671b75
commit
40c8338e48
@ -38,7 +38,7 @@ CLUSTER_TEMPLATE_CREATE_ATTRS = ['name', 'image_id', 'flavor_id',
|
||||
|
||||
CLUSTER_CREATE_ATTRS = ['name', 'cluster_template_id', 'node_count',
|
||||
'discovery_url', 'create_timeout',
|
||||
'master_count']
|
||||
'master_count', 'keypair']
|
||||
|
||||
CERTIFICATE_CREATE_ATTRS = ['cluster_uuid', 'csr']
|
||||
|
||||
|
@ -79,6 +79,9 @@
|
||||
.setProperty('node_count', {
|
||||
label: gettext('Node Count')
|
||||
})
|
||||
.setProperty('keypair', {
|
||||
label: gettext('Keypair')
|
||||
})
|
||||
.setListFunction(clustersService.getClustersPromise)
|
||||
.tableColumns
|
||||
.append({
|
||||
@ -103,6 +106,10 @@
|
||||
.append({
|
||||
id: 'node_count',
|
||||
priority: 2
|
||||
})
|
||||
.append({
|
||||
id: 'keypair',
|
||||
priority: 2
|
||||
});
|
||||
|
||||
// for magic-search
|
||||
@ -148,6 +155,11 @@
|
||||
'label': gettext('Node Count'),
|
||||
'name': 'node_count',
|
||||
'singleton': true
|
||||
})
|
||||
.append({
|
||||
'label': gettext('Keypair'),
|
||||
'name': 'keypair',
|
||||
'singleton': true
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,8 @@
|
||||
master_count: null,
|
||||
node_count: null,
|
||||
discover_url: null,
|
||||
create_timeout: null
|
||||
create_timeout: null,
|
||||
keypair: null
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,8 @@
|
||||
master_count: null,
|
||||
node_count: null,
|
||||
discover_url: null,
|
||||
create_timeout: null
|
||||
create_timeout: null,
|
||||
keypair: null
|
||||
};
|
||||
|
||||
beforeEach(module('horizon.dashboard.container-infra.clusters'));
|
||||
|
@ -48,7 +48,8 @@
|
||||
public: "",
|
||||
registry_enabled: "",
|
||||
tls_disabled: "",
|
||||
apiserver_port: ""
|
||||
apiserver_port: "",
|
||||
keypair: ""
|
||||
};
|
||||
|
||||
$scope.changeClusterTemplate = function() {
|
||||
@ -62,6 +63,7 @@
|
||||
$scope.cluster_template_detail.registry_enabled = model.registry_enabled;
|
||||
$scope.cluster_template_detail.tls_disabled = model.tls_disabled;
|
||||
$scope.cluster_template_detail.apiserver_port = model.apiserver_port;
|
||||
$scope.cluster_template_detail.keypair = model.keypair;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@ -30,9 +30,26 @@
|
||||
.controller('createClusterMiscController', createClusterMiscController);
|
||||
|
||||
createClusterMiscController.$inject = [
|
||||
'$scope',
|
||||
'horizon.app.core.openstack-service-api.nova'
|
||||
];
|
||||
|
||||
function createClusterMiscController() {
|
||||
function createClusterMiscController($scope, nova) {
|
||||
var ctrl = this;
|
||||
ctrl.keypairs = [{id:null, name: gettext("Choose a Keypair")}];
|
||||
$scope.model.newClusterSpec.keypair = null;
|
||||
|
||||
init();
|
||||
|
||||
function init() {
|
||||
nova.getKeypairs().success(onGetKeypairs);
|
||||
}
|
||||
|
||||
function onGetKeypairs(response) {
|
||||
angular.forEach(response.items, function(item) {
|
||||
ctrl.keypairs.push({id: item.keypair.name, name: item.keypair.name});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
})();
|
||||
|
@ -13,5 +13,13 @@
|
||||
ng-model="model.newClusterSpec.create_timeout" id="cluster-timeout"
|
||||
placeholder="{$ 'The timeout for cluster creation in minutes. Set to 0 for no timeout. The default is no timeout.'|translate $}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="cluster-keypair" translate>Keypair</label>
|
||||
<select name="cluster-keypair" type="text" class="form-control" id="cluster-keypair"
|
||||
ng-model="model.newClusterSpec.keypair" ng-required="false"
|
||||
ng-options="keypair.id as keypair.name for keypair in ctrl.keypairs">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -57,6 +57,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</dd>
|
||||
<dt translate>Keypair</dt>
|
||||
<dd>{$ ctrl.cluster.keypair $}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="col-md-6 detail">
|
||||
|
Loading…
Reference in New Issue
Block a user