Add parameters for cluster creation
This patch adds 'image_driver', 'image_pull_policy' and 'restart_policy' parameters into cluster creation action. Change-Id: I479e85787b0a2518968e8bb774159073b1573162
This commit is contained in:
parent
68ceee59da
commit
fa57cda20c
zun_ui
api
static/dashboard/container/containers/create
@ -15,6 +15,7 @@ from horizon import exceptions
|
|||||||
from horizon.utils.memoized import memoized
|
from horizon.utils.memoized import memoized
|
||||||
import logging
|
import logging
|
||||||
from openstack_dashboard.api import base
|
from openstack_dashboard.api import base
|
||||||
|
from zunclient.common import utils
|
||||||
from zunclient.v1 import client as zun_client
|
from zunclient.v1 import client as zun_client
|
||||||
|
|
||||||
|
|
||||||
@ -52,6 +53,9 @@ def container_create(request, **kwargs):
|
|||||||
elif key == "interactive":
|
elif key == "interactive":
|
||||||
args["interactive"] = value
|
args["interactive"] = value
|
||||||
continue
|
continue
|
||||||
|
elif key == "restart_policy":
|
||||||
|
args[key] = utils.check_restart_policy(value)
|
||||||
|
continue
|
||||||
|
|
||||||
if key in CONTAINER_CREATE_ATTRS:
|
if key in CONTAINER_CREATE_ATTRS:
|
||||||
args[str(key)] = str(value)
|
args[str(key)] = str(value)
|
||||||
|
@ -37,9 +37,13 @@
|
|||||||
uuid: null,
|
uuid: null,
|
||||||
name: null,
|
name: null,
|
||||||
image: null,
|
image: null,
|
||||||
|
image_driver: "docker",
|
||||||
|
image_pull_policy: null,
|
||||||
command: null,
|
command: null,
|
||||||
cpu: null,
|
cpu: null,
|
||||||
memory: null,
|
memory: null,
|
||||||
|
restart_policy: null,
|
||||||
|
restart_policy_max_retry: null,
|
||||||
environment: null,
|
environment: null,
|
||||||
workdir: null,
|
workdir: null,
|
||||||
labels: null,
|
labels: null,
|
||||||
|
@ -80,6 +80,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function submit() {
|
function submit() {
|
||||||
|
if (model.newContainerSpec.restart_policy === "on-failure") {
|
||||||
|
model.newContainerSpec.restart_policy =
|
||||||
|
model.newContainerSpec.restart_policy + ":" +
|
||||||
|
model.newContainerSpec.restart_policy_max_retry;
|
||||||
|
}
|
||||||
|
delete model.newContainerSpec.restart_policy_max_retry;
|
||||||
return model.createContainer().then(success);
|
return model.createContainer().then(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,23 @@
|
|||||||
<dd translate>An arbitrary human-readable name.</dd>
|
<dd translate>An arbitrary human-readable name.</dd>
|
||||||
<dt translate>Image</dt>
|
<dt translate>Image</dt>
|
||||||
<dd translate>Name or ID of container image.</dd>
|
<dd translate>Name or ID of container image.</dd>
|
||||||
|
<dt translate>Image Driver</dt>
|
||||||
|
<dd>
|
||||||
|
<translate>The image driver to use to pull container image.</translate>
|
||||||
|
<ul>
|
||||||
|
<li translate>Docker: Pull the image from Docker Hub.</li>
|
||||||
|
<li translate>Glance: Pull the image from Glance.</li>
|
||||||
|
</ul>
|
||||||
|
</dd>
|
||||||
|
<dt translate>Image Pull Policy</dt>
|
||||||
|
<dd translate>
|
||||||
|
The policy which determines if the image should be pulled prior to starting the container.
|
||||||
|
<ul>
|
||||||
|
<li translate>If not present: only pull the image if it does not already exist on the node.</li>
|
||||||
|
<li translate>Always: Always pull the image from repository.</li>
|
||||||
|
<li translate>Never: never pull the image.</li>
|
||||||
|
</ul>
|
||||||
|
</dd>
|
||||||
<dt translate>Command</dt>
|
<dt translate>Command</dt>
|
||||||
<dd translate>Command sent to the container.</dd>
|
<dd translate>Command sent to the container.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
@ -20,6 +20,28 @@
|
|||||||
placeholder="{$ 'Name or ID of the container image.'|translate $}">
|
placeholder="{$ 'Name or ID of the container image.'|translate $}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-xs-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="container-image-driver" translate>Image Driver</label>
|
||||||
|
<select name="container-image-driver" class="form-control" id="container-image-driver"
|
||||||
|
ng-model="model.newContainerSpec.image_driver">
|
||||||
|
<option value="docker" selected=selected>Docker</option>
|
||||||
|
<option value="glance">Glance</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="container-image-pull-policy" translate>Image Pull Policy</label>
|
||||||
|
<select name="container-image-pull-policy" class="form-control" id="container-image-pull-policy"
|
||||||
|
ng-model="model.newContainerSpec.image_pull_policy">
|
||||||
|
<option value="" selected=selected translate>Select policy.</option>
|
||||||
|
<option value="ifnotpresent" translate>If not present</option>
|
||||||
|
<option value="always" translate>Always</option>
|
||||||
|
<option value="never" translate>Never</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="col-xs-12">
|
<div class="col-xs-12">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label" for="container-command" translate>Command</label>
|
<label class="control-label" for="container-command" translate>Command</label>
|
||||||
|
@ -27,8 +27,15 @@
|
|||||||
.controller('createContainerSpecController', createContainerSpecController);
|
.controller('createContainerSpecController', createContainerSpecController);
|
||||||
|
|
||||||
createContainerSpecController.$inject = [
|
createContainerSpecController.$inject = [
|
||||||
|
'$scope'
|
||||||
];
|
];
|
||||||
|
|
||||||
function createContainerSpecController() {
|
function createContainerSpecController($scope) {
|
||||||
|
var ctrl = this;
|
||||||
|
ctrl.onChangeRestartPolicy = function () {
|
||||||
|
if ($scope.model.newContainerSpec.restart_policy !== 'on-failure') {
|
||||||
|
$scope.model.newContainerSpec.restart_policy_max_retry = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
@ -3,4 +3,6 @@
|
|||||||
<dd translate>The number of virtual cpus.</dd>
|
<dd translate>The number of virtual cpus.</dd>
|
||||||
<dt translate>Memory</dt>
|
<dt translate>Memory</dt>
|
||||||
<dd translate>The container memory size in MiB.</dd>
|
<dd translate>The container memory size in MiB.</dd>
|
||||||
|
<dt translate>Restart Policy</dt>
|
||||||
|
<dd translate>Restart policy to apply when a container exits.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
@ -17,5 +17,29 @@
|
|||||||
id="container-memory">
|
id="container-memory">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-xs-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="container-restart" translate>Restart Policy</label>
|
||||||
|
<select name="container-restart" class="form-control" id="container-memory"
|
||||||
|
ng-model="model.newContainerSpec.restart_policy"
|
||||||
|
ng-change="ctrl.onChangeRestartPolicy()">
|
||||||
|
<option value="" selected=selected translate>Select policy.</option>
|
||||||
|
<option value="no" translate>No</option>
|
||||||
|
<option value="on-failure" translate>On failure</option>
|
||||||
|
<option value="always" translate>Always</option>
|
||||||
|
<option value="unless-stopped" translate>Unless Stopped</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="container-restart-max-retry" translate>Max Retry</label>
|
||||||
|
<input name="container-restart-max-retry" type="number" min="1"
|
||||||
|
class="form-control" ng-model="model.newContainerSpec.restart_policy_max_retry"
|
||||||
|
id="container-restart-max-retry"
|
||||||
|
placeholder="{$ 'Retry times for \'On failure\' policy.'|translate $}"
|
||||||
|
ng-disabled="model.newContainerSpec.restart_policy!=='on-failure'">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user