You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2020/08/30 15:03:53 UTC
[libcloud] branch trunk updated (e6c32e5 -> 2cc87a0)
This is an automated email from the ASF dual-hosted git repository.
tomaz pushed a change to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git.
from e6c32e5 Add changelog entry.
add 4ca5435 Add expose ports through services for VMs, extra ports and services data will be kept by each node. For each VM and each service type a single service will be made through which multiple ports can be opened.
add 6588564 Add back initial connection class to driver for the tests
add 77663a1 Update tests with necessary changes
add caa446b Fix flake8
new 2337206 Add ex_delete_service per Tomas' comments, beautify code
new 65a5202 Merge branch 'kubevirt_update' of https://github.com/Eis-D-Z/libcloud into Eis-D-Z-kubevirt_update
new 442c255 Add changelog entry.
new 2cc87a0 Re-generate provider tables.
The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
CHANGES.rst | 6 +
docs/compute/_supported_methods_block_storage.rst | 2 +
.../_supported_methods_image_management.rst | 2 +
.../_supported_methods_key_pair_management.rst | 2 +
docs/compute/_supported_methods_main.rst | 2 +
docs/compute/_supported_providers.rst | 2 +
libcloud/compute/drivers/kubevirt.py | 324 ++++++++++++++++++---
.../compute/fixtures/kubevirt/get_services.json | 56 ++++
libcloud/test/compute/test_kubevirt.py | 44 ++-
9 files changed, 386 insertions(+), 54 deletions(-)
create mode 100644 libcloud/test/compute/fixtures/kubevirt/get_services.json
[libcloud] 02/04: Merge branch 'kubevirt_update' of
https://github.com/Eis-D-Z/libcloud into Eis-D-Z-kubevirt_update
Posted by to...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git
commit 65a52029d4f8a0a8114c3bee43a5e5e0253a55c8
Merge: e6c32e5 2337206
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Sun Aug 30 16:52:21 2020 +0200
Merge branch 'kubevirt_update' of https://github.com/Eis-D-Z/libcloud into Eis-D-Z-kubevirt_update
libcloud/compute/drivers/kubevirt.py | 324 ++++++++++++++++++---
.../compute/fixtures/kubevirt/get_services.json | 56 ++++
libcloud/test/compute/test_kubevirt.py | 44 ++-
3 files changed, 370 insertions(+), 54 deletions(-)
[libcloud] 04/04: Re-generate provider tables.
Posted by to...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git
commit 2cc87a088d3ffa224a3ec68b879c91683da198b3
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Sun Aug 30 17:03:42 2020 +0200
Re-generate provider tables.
---
docs/compute/_supported_methods_block_storage.rst | 2 ++
docs/compute/_supported_methods_image_management.rst | 2 ++
docs/compute/_supported_methods_key_pair_management.rst | 2 ++
docs/compute/_supported_methods_main.rst | 2 ++
docs/compute/_supported_providers.rst | 2 ++
5 files changed, 10 insertions(+)
diff --git a/docs/compute/_supported_methods_block_storage.rst b/docs/compute/_supported_methods_block_storage.rst
index a595a20..f7c796b 100644
--- a/docs/compute/_supported_methods_block_storage.rst
+++ b/docs/compute/_supported_methods_block_storage.rst
@@ -48,6 +48,7 @@ Provider list volumes create volume destroy volume
`1and1`_ no no no no no no no
`OpenNebula (v3.8)`_ yes yes yes yes yes no no
`OpenStack`_ yes yes yes yes yes no no
+`Outscale API`_ yes yes yes yes yes no yes
`Outscale INC`_ yes yes yes yes yes yes yes
`Outscale SAS`_ yes yes yes yes yes yes yes
`Ovh`_ yes yes yes yes yes yes yes
@@ -114,6 +115,7 @@ Provider list volumes create volume destroy volume
.. _`1and1`: http://www.1and1.com
.. _`OpenNebula (v3.8)`: http://opennebula.org/
.. _`OpenStack`: http://openstack.org/
+.. _`Outscale API`: http://www.outscale.com
.. _`Outscale INC`: http://www.outscale.com
.. _`Outscale SAS`: http://www.outscale.com
.. _`Ovh`: https://www.ovh.com/
diff --git a/docs/compute/_supported_methods_image_management.rst b/docs/compute/_supported_methods_image_management.rst
index 15c37b0..8c6749d 100644
--- a/docs/compute/_supported_methods_image_management.rst
+++ b/docs/compute/_supported_methods_image_management.rst
@@ -48,6 +48,7 @@ Provider list images get image create image delete
`1and1`_ yes yes no no no
`OpenNebula (v3.8)`_ yes no no no no
`OpenStack`_ yes yes no no no
+`Outscale API`_ yes yes yes yes no
`Outscale INC`_ yes yes yes yes yes
`Outscale SAS`_ yes yes yes yes yes
`Ovh`_ yes yes no no no
@@ -114,6 +115,7 @@ Provider list images get image create image delete
.. _`1and1`: http://www.1and1.com
.. _`OpenNebula (v3.8)`: http://opennebula.org/
.. _`OpenStack`: http://openstack.org/
+.. _`Outscale API`: http://www.outscale.com
.. _`Outscale INC`: http://www.outscale.com
.. _`Outscale SAS`: http://www.outscale.com
.. _`Ovh`: https://www.ovh.com/
diff --git a/docs/compute/_supported_methods_key_pair_management.rst b/docs/compute/_supported_methods_key_pair_management.rst
index 41d9822..f5e484c 100644
--- a/docs/compute/_supported_methods_key_pair_management.rst
+++ b/docs/compute/_supported_methods_key_pair_management.rst
@@ -48,6 +48,7 @@ Provider list key pairs get key pair create key pai
`1and1`_ no no no no no no
`OpenNebula (v3.8)`_ no no no no no no
`OpenStack`_ no no no no no no
+`Outscale API`_ yes yes yes no no yes
`Outscale INC`_ yes yes yes yes no yes
`Outscale SAS`_ yes yes yes yes no yes
`Ovh`_ yes yes no yes no yes
@@ -114,6 +115,7 @@ Provider list key pairs get key pair create key pai
.. _`1and1`: http://www.1and1.com
.. _`OpenNebula (v3.8)`: http://opennebula.org/
.. _`OpenStack`: http://openstack.org/
+.. _`Outscale API`: http://www.outscale.com
.. _`Outscale INC`: http://www.outscale.com
.. _`Outscale SAS`: http://www.outscale.com
.. _`Ovh`: https://www.ovh.com/
diff --git a/docs/compute/_supported_methods_main.rst b/docs/compute/_supported_methods_main.rst
index c0ea192..21961e5 100644
--- a/docs/compute/_supported_methods_main.rst
+++ b/docs/compute/_supported_methods_main.rst
@@ -48,6 +48,7 @@ Provider list nodes create node reboot node destroy
`1and1`_ yes yes yes yes no no yes yes no
`OpenNebula (v3.8)`_ yes yes yes yes no no yes yes no
`OpenStack`_ yes no yes yes yes yes yes yes no
+`Outscale API`_ yes yes yes yes no no yes no no
`Outscale INC`_ yes yes yes yes yes yes yes yes yes
`Outscale SAS`_ yes yes yes yes yes yes yes yes yes
`Ovh`_ yes yes no yes no no yes yes yes
@@ -114,6 +115,7 @@ Provider list nodes create node reboot node destroy
.. _`1and1`: http://www.1and1.com
.. _`OpenNebula (v3.8)`: http://opennebula.org/
.. _`OpenStack`: http://openstack.org/
+.. _`Outscale API`: http://www.outscale.com
.. _`Outscale INC`: http://www.outscale.com
.. _`Outscale SAS`: http://www.outscale.com
.. _`Ovh`: https://www.ovh.com/
diff --git a/docs/compute/_supported_providers.rst b/docs/compute/_supported_providers.rst
index 0c62d85..5ba491e 100644
--- a/docs/compute/_supported_providers.rst
+++ b/docs/compute/_supported_providers.rst
@@ -48,6 +48,7 @@ Provider Documentation
`1and1`_ :doc:`Click </compute/drivers/oneandone>` ONEANDONE single region driver :mod:`libcloud.compute.drivers.oneandone` :class:`OneAndOneNodeDriver`
`OpenNebula (v3.8)`_ OPENNEBULA single region driver :mod:`libcloud.compute.drivers.opennebula` :class:`OpenNebulaNodeDriver`
`OpenStack`_ :doc:`Click </compute/drivers/openstack>` OPENSTACK single region driver :mod:`libcloud.compute.drivers.openstack` :class:`OpenStackNodeDriver`
+`Outscale API`_ OUTSCALE single region driver :mod:`libcloud.compute.drivers.outscale` :class:`OutscaleNodeDriver`
`Outscale INC`_ :doc:`Click </compute/drivers/outscale_inc>` OUTSCALE_INC single region driver :mod:`libcloud.compute.drivers.ec2` :class:`OutscaleINCNodeDriver`
`Outscale SAS`_ :doc:`Click </compute/drivers/outscale_sas>` OUTSCALE_SAS single region driver :mod:`libcloud.compute.drivers.ec2` :class:`OutscaleSASNodeDriver`
`Ovh`_ :doc:`Click </compute/drivers/ovh>` OVH single region driver :mod:`libcloud.compute.drivers.ovh` :class:`OvhNodeDriver`
@@ -114,6 +115,7 @@ Provider Documentation
.. _`1and1`: http://www.1and1.com
.. _`OpenNebula (v3.8)`: http://opennebula.org/
.. _`OpenStack`: http://openstack.org/
+.. _`Outscale API`: http://www.outscale.com
.. _`Outscale INC`: http://www.outscale.com
.. _`Outscale SAS`: http://www.outscale.com
.. _`Ovh`: https://www.ovh.com/
[libcloud] 03/04: Add changelog entry.
Posted by to...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git
commit 442c2558e48c8f67271369e27289585e13736cbc
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Sun Aug 30 16:54:30 2020 +0200
Add changelog entry.
---
CHANGES.rst | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/CHANGES.rst b/CHANGES.rst
index fa583e0..6246608 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -110,6 +110,12 @@ Compute
(GITHUB-1476)
[Tio Gobin - @tgn-outscale]
+- [KubeVirt] Add new methods for managing services which allows users to expose
+ ports for the VMs (``ex_list_services``, ``ex_create_service``,
+ ``ex_delete_service``).
+ (GITHUB-1477)
+ [Eis D. Zaster - @Eis-D-Z]
+
Changes in Apache Libcloud 3.1.0
--------------------------------
[libcloud] 01/04: Add ex_delete_service per Tomas' comments,
beautify code
Posted by to...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git
commit 2337206aeb70dbf6033cea89c5307a3c9815f18e
Author: Eis <mo...@gmail.com>
AuthorDate: Mon Aug 24 14:05:18 2020 +0300
Add ex_delete_service per Tomas' comments, beautify code
---
libcloud/compute/drivers/kubevirt.py | 32 +++++++++++++----
.../compute/fixtures/kubevirt/get_services.json | 6 ++--
libcloud/test/compute/test_kubevirt.py | 40 +++++++++++++++++-----
3 files changed, 59 insertions(+), 19 deletions(-)
diff --git a/libcloud/compute/drivers/kubevirt.py b/libcloud/compute/drivers/kubevirt.py
index ea2463a..b150d24 100644
--- a/libcloud/compute/drivers/kubevirt.py
+++ b/libcloud/compute/drivers/kubevirt.py
@@ -168,9 +168,9 @@ class KubeVirtNodeDriver(KubernetesDriverMixin, NodeDriver):
# find and delete services for this VM only
services = self.ex_list_services(namespace=namespace, node_name=name)
for service in services:
- service_type = service['spec']['type']
- self.ex_create_service(node=node, ports=[],
- service_type=service_type)
+ service_name = service['metadata']['name']
+ self.ex_delete_service(namespace=namespace,
+ service_name=service_name)
# stop the vmi
self.stop_node(node)
try:
@@ -187,7 +187,7 @@ class KubeVirtNodeDriver(KubernetesDriverMixin, NodeDriver):
def create_node(self, name, image, location=None, ex_memory=128, ex_cpu=1,
ex_disks=None, ex_network=None,
ex_termination_grace_period=0,
- ports={}):
+ ports=None):
"""
Creating a VM with a containerDisk.
:param name: A name to give the VM. The VM will be identified by
@@ -429,6 +429,7 @@ class KubeVirtNodeDriver(KubernetesDriverMixin, NodeDriver):
network_type = "pod"
network_dict = {network_type: {}, 'name': network_name}
interface_dict = {interface: {}, 'name': network_name}
+ ports = ports or {}
if ports.get('ports_tcp'):
ports_to_expose = []
for port in ports['ports_tcp']:
@@ -1141,8 +1142,8 @@ class KubeVirtNodeDriver(KubernetesDriverMixin, NodeDriver):
type ports: `list` of `dict` where each `dict` has keys --> values:
'port' --> `int`
'target_port' --> `int`
- 'protocol' --> `str
- 'name' --> str
+ 'protocol' --> `str`
+ 'name' --> `str`
param service_type: Valid types are ClusterIP, NodePort, LoadBalancer
type service_type: `str`
@@ -1186,7 +1187,13 @@ class KubeVirtNodeDriver(KubernetesDriverMixin, NodeDriver):
data = None
if len(service_list) > 0:
if not ports:
- method = 'DELETE'
+ result = True
+ for service in service_list:
+ service_name = service['metadata']['name']
+ result = result and self.ex_delete_service(
+ namespace=namespace,
+ service_name=service_name)
+ return result
else:
method = 'PATCH'
spec = {'ports': ports_to_expose}
@@ -1236,3 +1243,14 @@ class KubeVirtNodeDriver(KubernetesDriverMixin, NodeDriver):
except Exception:
raise
return result.status in VALID_RESPONSE_CODES
+
+ def ex_delete_service(self, namespace, service_name):
+ req = "{}/namespaces/{}/services/{}".format(ROOT_URL, namespace,
+ service_name)
+ headers = {"Content-Type": "application/yaml"}
+ try:
+ result = self.connection.request(req, method="DELETE",
+ headers=headers)
+ except Exception:
+ raise
+ return result.status in VALID_RESPONSE_CODES
diff --git a/libcloud/test/compute/fixtures/kubevirt/get_services.json b/libcloud/test/compute/fixtures/kubevirt/get_services.json
index c795144..ab567e4 100644
--- a/libcloud/test/compute/fixtures/kubevirt/get_services.json
+++ b/libcloud/test/compute/fixtures/kubevirt/get_services.json
@@ -17,12 +17,12 @@
"spec": {"ports": [{"name": "webhooks", "protocol": "TCP", "port": 443, "targetPort": "webhooks"}],
"selector": {"kubevirt.io": "virt-operator"}, "clusterIP": "10.111.39.5", "type": "ClusterIP",
"sessionAffinity": "None"},
- "status": {"loadBalancer": {}}},
- {"metadata":
+ "status": {"loadBalancer": {}}},
+ {"metadata":
{"name": "kubevirt-prometheus-metrics", "namespace": "kubevirt",
"selfLink": "/api/v1/namespaces/kubevirt/services/kubevirt-prometheus-metrics",
"uid": "cd5e6e0d-45c7-46b5-9545-043aabb75b4e", "resourceVersion": "34388129",
- "creationTimestamp": "2020-07-22T15:48:27Z",
+ "creationTimestamp": "2020-07-22T15:48:27Z",
"labels":
{"app.kubernetes.io/managed-by": "kubevirt-operator", "kubevirt.io": "", "prometheus.kubevirt.io": ""},
"annotations":
diff --git a/libcloud/test/compute/test_kubevirt.py b/libcloud/test/compute/test_kubevirt.py
index 13eb9be..61f252e 100644
--- a/libcloud/test/compute/test_kubevirt.py
+++ b/libcloud/test/compute/test_kubevirt.py
@@ -101,7 +101,10 @@ class KubeVirtMockHttp(MockHttp):
return (httplib.OK, body, {}, httplib.responses[httplib.OK])
def _apis_kubevirt_io_v1alpha3_namespaces_default_virtualmachines(self,
- method, url, body, headers):
+ method,
+ url,
+ body,
+ headers):
if method == "GET":
body = self.fixtures.load('get_default_vms.json')
resp = httplib.OK
@@ -113,7 +116,10 @@ class KubeVirtMockHttp(MockHttp):
return (resp, body, {}, httplib.responses[httplib.OK])
def _apis_kubevirt_io_v1alpha3_namespaces_kube_node_lease_virtualmachines(self,
- method, url, body, headers):
+ method,
+ url,
+ body,
+ headers):
if method == "GET":
body = self.fixtures.load('get_kube_node_lease_vms.json')
elif method == "POST":
@@ -123,7 +129,9 @@ class KubeVirtMockHttp(MockHttp):
return (httplib.OK, body, {}, httplib.responses[httplib.OK])
def _apis_kubevirt_io_v1alpha3_namespaces_kube_public_virtualmachines(self,
- method, url, body, headers):
+ method,
+ url, body,
+ headers):
if method == "GET":
body = self.fixtures.load('get_kube_public_vms.json')
elif method == "POST":
@@ -131,8 +139,11 @@ class KubeVirtMockHttp(MockHttp):
else:
AssertionError('Unsupported method')
return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
def _apis_kubevirt_io_v1alpha3_namespaces_kube_system_virtualmachines(self,
- method, url, body, headers):
+ method,
+ url, body,
+ headers):
if method == "GET":
body = self.fixtures.load('get_kube_system_vms.json')
elif method == "POST":
@@ -142,7 +153,9 @@ class KubeVirtMockHttp(MockHttp):
return (httplib.OK, body, {}, httplib.responses[httplib.OK])
def _apis_kubevirt_io_v1alpha3_namespaces_kubevirt_virtualmachines(self,
- method, url, body, headers):
+ method,
+ url, body,
+ headers):
if method == "GET":
body = self.fixtures.load('get_kube_public_vms.json')
elif method == "POST":
@@ -150,8 +163,11 @@ class KubeVirtMockHttp(MockHttp):
else:
AssertionError('Unsupported method')
return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
def _apis_kubevirt_io_v1alpha3_namespaces_default_virtualmachines_testvm(self,
- method, url, body, headers):
+ method,
+ url, body,
+ headers):
header = "application/merge-patch+json"
data_stop = {"spec": {"running": False}}
data_start = {"spec": {"running": True}}
@@ -168,7 +184,10 @@ class KubeVirtMockHttp(MockHttp):
return (httplib.OK, body, {}, httplib.responses[httplib.OK])
def _apis_kubevirt_io_v1alpha3_namespaces_default_virtualmachines_vm_cirros(self,
- method, url, body, headers):
+ method,
+ url,
+ body,
+ headers):
header = "application/merge-patch+json"
data_stop = {"spec": {"running": False}}
data_start = {"spec": {"running": True}}
@@ -185,7 +204,10 @@ class KubeVirtMockHttp(MockHttp):
return (httplib.OK, body, {}, httplib.responses[httplib.OK])
def _apis_kubevirt_io_v1alpha3_namespaces_default_virtualmachineinstances_testvm(self,
- method, url, body, headers):
+ method,
+ url,
+ body,
+ headers):
if method == "DELETE":
body = self.fixtures.load('delete_vmi_testvm.json')
else:
@@ -201,7 +223,7 @@ class KubeVirtMockHttp(MockHttp):
AssertionError('Unsupported method')
return (httplib.OK, body, {}, httplib.responses[httplib.OK])
-
+
def _api_v1_namespaces_default_services(self, method, url, body, headers):
if method == "GET":
body = self.fixtures.load('get_services.json')