5 Commits

Author SHA1 Message Date
Roman Dobosz
ba4cc2b8f0 Use either subnet name or id for Machines.
Currently, we support only subnet id for primarySubnet field for
OpenShift Machines. Even though it's possible to create objects in
OpenStack with the same name, it is more natural to use names instead of
id especially in OpenShift world. In this patch we introduce support
for using names as well.

Change-Id: Ib21646b4b7cf0e3c07ddef15b3569a0fb4539e8a
2022-12-19 07:57:32 +00:00
Roman Dobosz
817b8e035e Support for ports and primarySubnet fields in machine.
For now, by default, pod network was taken from OpenShift Machine spec,
by looking for "networks" field and get the first item out of it to
figure out right subnet. Currently there is another field, where
networks can be defined - under "ports" field, where subnet for fixed
IPs can be found. Additionally, to avoid confusion, there is another
field, which defines primary subnet for the pods - "primarySubnet".

Implementation has been adapted to reflect that change:

1. primarySubnet will be examined, to get the subnet id
2. if primarySubnet does not exists, networks field will be examined
3. if there is no networks field (or it doesn't contain subnets), ports
   field will be examined for subnet id

Change-Id: I35b6f2e6288cbe3fd80b74a5da03639d7bd0a765
2021-10-07 11:55:17 +02:00
Michał Dulko
93c10fcc0a OpenShift: Add configured subnets to the detected
Turns out there's an OpenShift mode where it's required to actually
hardcode a worker_nodes_subnet as some nodes does not have the Machine
objects. This commit solves that by making sure that
[pod_vif_nested]worker_nodes_subnets are also added to whatever the
OpenShiftNodesSubnets driver detects.

Change-Id: I7e08062473efeaba67a38ab0b2451626df77def8
2021-02-12 16:46:46 +01:00
Michał Dulko
e95ed536d6 Add OpenShiftNodesSubnets driver and MachineHandler
In order to support OpenShift's ability to run its nodes in various
OpenStack subnets in a dynamic way, this commit introduces the
OpenShiftNodesSubnets and MachineHandler. The idea is that
MachineHandler is responsible for watching the OpenShift Machine objects
and calling the driver. The driver will then save and serve a list of
current worker nodes subnets.

Change-Id: Iae3a5d011abaeab4aa97d6aa7153227c6f85b93c
2021-01-22 13:41:39 +01:00
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