add parameter to set network for cloud shell containers
Closes-Bug: #1826658 Change-Id: I8b8bfb299f7fcbb01cdf81f87c0b50588e67af80
This commit is contained in:
1 parent
fd86b87a43
commit
d36bd31b8b
5 files changed
+17
-1
No files matched your search
@@ -1 +1,2 @@
|
||||
CLOUD_SHELL_IMAGE = "gbraad/openstack-client:alpine"
|
||||
CLOUD_SHELL_NETWORK = ""
|
||||
@@ -0,0 +1,2 @@
|
||||
features:
|
||||
- it is now possible to specify a network for cloud-shell containers.
|
||||
@@ -24,4 +24,9 @@ class CloudShellView(views.HorizonTemplateView):
|
||||
context['CLOUD_SHELL_IMAGE'] = settings.CLOUD_SHELL_IMAGE
|
||||
else:
|
||||
context['CLOUD_SHELL_IMAGE'] = "gbraad/openstack-client:alpine"
|
||||
|
||||
if hasattr(settings, "CLOUD_SHELL_NETWORK"):
|
||||
context['CLOUD_SHELL_NETWORK'] = settings.CLOUD_SHELL_NETWORK
|
||||
else:
|
||||
context['CLOUD_SHELL_NETWORK'] = ""
|
||||
return context
|
||||
@@ -130,13 +130,20 @@
|
||||
function onFailGetContainer() {
|
||||
// create new container and attach console to it.
|
||||
var image = angular.element("#cloud-shell-menu").attr("cloud-shell-image");
|
||||
var cloudShellNetwork = angular.element("#cloud-shell-menu").attr("cloud-shell-network");
|
||||
if (cloudShellNetwork === "") {
|
||||
var cloudShellNetwork = [];
|
||||
} else {
|
||||
var cloudShellNetwork = [{"network": cloudShellNetwork}];
|
||||
}
|
||||
var model = {
|
||||
image: image,
|
||||
command: "/bin/bash",
|
||||
interactive: true,
|
||||
run: true,
|
||||
environment: "OS_CLOUD=openstack",
|
||||
labels: "cloud-shell=" + ctrl.containerLabel
|
||||
labels: "cloud-shell=" + ctrl.containerLabel,
|
||||
nets: cloudShellNetwork
|
||||
};
|
||||
zun.createContainer(model).then(function (response) {
|
||||
// attach
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
id="cloud-shell-menu"
|
||||
class="fa fa-terminal"
|
||||
cloud-shell-image="{{ CLOUD_SHELL_IMAGE }}"
|
||||
cloud-shell-network="{{ CLOUD_SHELL_NETWORK }}"
|
||||
onclick="angular.element(document.body).injector().get('horizon.cloud-shell.service').init();">
|
||||
{% trans "Cloud Shell" %}
|
||||
</span>
|
||||
Reference in new issue
Block a user