11 Commits

Author SHA1 Message Date
Michał Dulko
abc39b0e68 Introduce NodesSubnetsDriver
In order to have more control over the nodes subnets we expect instead
of relying on static configuration option it's better to have
flexibility. This commit introduces NodesSubnetsDriver model that will
allow writing more complicated drivers providing the
worker_nodes_subnets setting.

A use case in mind is to use OpenShift Machine Custom Resources in order
to discover subnets the nodes are using.

Change-Id: I0eb5d9ad50895151967c23d3ad6d1237cc4d9667
2021-01-22 13:41:39 +01:00
Michał Dulko
b3814a33d6 Multiple nodes subnets support
This commit deprecates `[pod_vif_nested]worker_nodes_subnet` in favor of
`[pod_vif_nested]worker_nodes_subnets` that will accept a list instead.
All the code using the deprecated options is updated to expect a list
and iterate over possible nodes subnets.

Change-Id: I7671fb06863d58b58905bec43555d8f21626f640
2021-01-22 13:41:39 +01:00
Roman Dobosz
ded6b6debc Removing six library.
Since we already migrated fully to Python3, it's time to also remove
bits needed for Python2. One of those libs is six.

Change-Id: Ib984d7b4b3c1048ed091c78986c634689a8ace8c
2020-02-28 14:45:46 +01:00
Roman Dobosz
c6ddf4f521 Update nested_vif driver to use OpenStackSDK.
Implements: blueprint switch-to-openstacksdk
Change-Id: I9dc5fa90b0ab5d0a1f9910aebd47c2628007bb76
2020-01-20 09:58:27 +01:00
Roman Dobosz
705bc44094 Stop passing around neutron client object.
In couple of drivers, in some methods, neutron client object is passing
down to through the series of methods call, just to eventually be
called with some object.

Since we already make the client a singleton, calling
clients.get_neutron_client method will immediately return instance,
which is possibly is already created. There is no need to pass this
down, while it can be easily reached by destination method.

Implements: blueprint switch-to-openstacksdk
Change-Id: I0a08f4740e94f9d7ae5ee003aa8b0a2e0a9b6fac
2020-01-20 09:58:27 +01:00
Michał Dulko
a63abbca90 Avoid doing raise ex when only logging
When reraising the exception with something like:

 try:
     (...)
 except Exception as ex:
     LOG.error("Error happened: %s", ex)
     raise ex

we lose the initial traceback information. This makes debugging
significantly harder. This commit removes such occurrences and converts
most cases to something like:

 try:
     (...)
 except Exception:
     LOG.exception("Error happened")
     raise

This way preserves the initial traceback.

Change-Id: I6506ff689697520faa64325c127d7e9d49cff9fa
Closes-Bug: 1813186
2019-01-24 17:41:41 +01:00
Luis Tomas Bolivar
66fb9d18df Add namespace isolation for services
This patch ensures pods from namespace X cannot access services
pointing to pods on namespace Y, and vice versa.

The exceptions are:
- Pods on default namespace can access all the services
- Services on default namespace can be accessed by all the pods

Depends-On: I37025bf65b67fe04f2a6d9b14bbe1b7bc387e370
Implements: blueprint openshift-project-isolation-support
Change-Id: I7b78e12cdf2bce5d0780e582814ef51ef0c459a7
2018-08-06 19:33:55 +02:00
Kirill Zaitsev
fcb5cf9840 Enforce E128 pep8 check
This commit removes the last pep8 check that was excluded
(E128 continuation line under-indented for visual indent),
and cleans up code to match pep8.

Change-Id: Ia1a6d672df521c35bbd1579971d27d546f4f5481
2017-06-13 14:22:51 +03:00
Luis Tomas Bolivar
3a776d5ed7 Nested vif driver extension to enable ports reuse
In order to speed up containers creation/deletion a new nested
vif pool driver is proposed to ensure subports already created
and attached to the VM trunk port can be reused in the future.

Note this remove the neutron.create_port and the
neutron.attach_subport (if a port is reused) from the container
creation process.

As measured in the performance evaluation performed in [0], just
the API time for create_port is, on average, around 2 seconds.
On top of that, as the attached subports are already in ACTIVE
status, there is no need for waiting for the status to become
ACTIVE, which is where most of the time is spend now.

[0] https://blog.russellbryant.net/2016/12/19/comparing-openstack-neutron-ml2ovs-and-ovn-control-plane/

Partially Implements blueprint ports-pool

Change-Id: Ibae054ef38d7aa7ea3b2829642f9544d61e76798
2017-06-11 14:53:46 +02:00
Kirill Zaitsev
6d9e564251 Cleanup and enforce pep8 checks
tox.ini contains a bunch of excludes, that are unnecessary. Some are
leftovers from neutron. Some are already fixed and there is no point in
excluding them and some are easy to fix.
This commit does not fix E128 as it is the only serious exclusion with
(currently 166 lines to be changed)

Change-Id: I48cb6cd2258b2d8ed5b8dfdd3ceac7d8d573be81
2017-06-08 15:36:44 +03:00
Marco Chiappero
d458322e4b Refactor the class hierarchy of controller drivers
In order to better organize nested drivers (VLAN and MACVLAN),
refactor the class hierachy of VIF drivers, providing better locations
for shared code. In particular:

- add an additional abstract class named NestedPodVIFDriver for nested
drivers to share common code, to accomodate the upcoming MACVLAN
driver
- rename GenericPodVIFDriver to NeutronPodVIFDriver (all the drivers are
Neutron specific)

This change is part of the MACVLAN based pod-in-VM spec and should be
applied before any following MACVLAN related patches.

Implements: blueprint
https://blueprints.launchpad.net/kuryr-kubernetes/+spec/macvlan-pod-in-vm

Change-Id: Ib71204d2d14d3d4f15beada701094e37d89d7801
Signed-off-by: Marco Chiappero <marco.chiappero@intel.com>
2017-06-05 17:33:11 +01:00