29 Commits

Author SHA1 Message Date
Roman Dobosz
a63bf23976 Remove dead networks in current cluster.
There was already introduced port cleanup function, so in this patch
there is new function introduced for cleaning up unused networks and
subnets for whole deployment, by using identifier from description.

Change-Id: Ia11e8953fab3f9cd8f6598f9da94daae324b1bf8
2022-06-10 15:46:04 +02:00
Roman Dobosz
bc8ba2bc17 Add periodic task for cleaning up dead ports.
Sometimes it happen, that during ports creation, there could be quota
violations, so that port could be created without tags, and would just
hanging there. This periodic task would remove all the dead ports.

Change-Id: If646cb3bf00aca387c769fafe2f73a8194642f69
2022-05-05 07:06:02 +02:00
Maysa Macedo
935d917d48 Export Prometheus metrics
This commit export kuryr_cni_requests_duration, kuryr_quota_free_count,
kuryr_port_quota_per_subnet, kuryr_pod_creation_latency metrics to
Prometheus.

Depends-On: https://review.opendev.org/c/openstack/kuryr-kubernetes/+/811557

Change-Id: I8c8c98153eaf6dd2418efe124c875c1ff9c66205
2021-10-04 09:26:31 +00:00
Sunday Mgbogu
f23419d0ee Update the LoadBalancers Reconciliation Loop
The patch handles the KuryrLoadBalancers reconcilation
using periodic task as event scheduler instead of eventlet

Implements: blueprint reconcile-openstack-resources-with-k8s
Change-Id: I85d2d1cf00b2543f41a875b32ae64fbbe885652c
2021-08-27 19:56:21 +00:00
Michał Dulko
9553f78f9a Disable urllib3 warnings
We don't really need them in any logs, it's just garbage.

Change-Id: I3acbda7c69cad6ebfee8b62c93cfba81bd812974
2020-04-08 12:59:54 +02: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
Maysa Macedo
0814ccaac6 Remove openshift routes(Ingress) support
Route pods from openshift can be used instead and the code
is not being used/maintained.

Change-Id: I76448752ba07f4b30dbfa783c2ae99d46e730eaf
2020-02-01 16:09:28 +00:00
zhufl
75a91cfbef Add missing parameter Controller in the log message
This is to add missing parameter Controller in the log message.

Change-Id: I02cb100d40fd38bbc0151792b1e81372106da076
2020-01-03 16:21:13 +08:00
Michał Dulko
94bb9f8804 Remove exit_on_stop from Watcher
We don't need exit_on_stop option now as we always set it to True. This
commit removes it to simplify the code.

Change-Id: I258709095727d87ede66ad6846c6e56ebdabec91
2019-09-04 10:26:56 +02:00
Yash Gupta
721932dc4b Refactor DriverBase.get_instance()
scope param is added to allow getting multiple independent instances
of a driver. This is particularly useful for using same VIFPoolDriver
implementation for multiple PodVIFDrivers (eg. NoopVIFPool may be
used for multiple PodVIFDriver types)

Also renames driver_alias to specific_driver to better indicate its
function.

Related-Bug: 1747406
Change-Id: Iea3b65b91f362a18cca6bf9d44d938063a56118b
Signed-off-by: Yash Gupta <y.gupta@samsung.com>
2018-09-12 10:27:11 +09:00
Luis Tomas Bolivar
860896601e Ensure ports pool are not duplicated with kuryr-controller HA
Due to ports pool being on kuryr-controller memory, there is a need
for sync-ing the pools when a kuryr-controller becomes the active
controller, otherwise pools created by the previous active controller
will not be used and new ports will be created. This patch ensures
the kuryr-controller triggers a ports pool recovery action when
transitioning to the active controller

Closes-Bug: 1787595
Change-Id: I8ee48f8cf4afad2338ae7a3b55b99ce46910ad70
2018-09-05 13:29:48 +02:00
Antoni Segura Puimedon
372b835ebb process to gracefully exit when last watcher exits
In case all the watchers (in the CNI case the pod watcher only) have
gracefully exited, continuing the process only serves to give a false
appearance of things working. At the same time, it prevents the
containerized deployment orchestrator from realizing that the Kuryr pod
is not functional so it does not restart it.

This fix allows non health proves environments where all watchers have
gracefully exited to be restarted by k8s/ocp and eventually work again
should the issue that made the graceful exits happen be solved.

Change-Id: Id70978e06d980bc0ffa08bcee02d78bef9dcbeb8
Closes-Bug: #1776676
Signed-off-by: Antoni Segura Puimedon <antonisp@celebdor.com>
2018-07-12 16:22:01 +02:00
Yossi Boaron
4ab102afa8 OCP-Router: Ingress controller support
This is the second patch of the Ingress Controller capability.

In order for the K8S Ingress and OpenShift Route resources to work,
the cluster must have an Ingress Controller running.

This patch extends LBaaS driver to support L7 load balancing and
verifies, retrieves and stores the L7 router LB (pre-created by admin or
Devstack) details.
The OCP-route and K8S-endpoint handlers (implemented in next patch) will
query the ingress controller for the L7 router details.

Partially Implements: blueprint openshift-router-support

Change-Id: Id55169f6c9c1c607b2aa54c92711dfbd04a9e39d
2018-06-15 14:34:57 +00:00
Michał Dulko
e416b2492a kuryr-controller A/P HA
This commit implements initial version of high availability support in
kuryr-controller - Active/Passive mode. In this mode only one instance
of controller is processing the resources while other ones are in
standby mode. If current leader dies, one of standbys is taking the
leader role and starts processing resources.

Please note that as leader election is based on Kubernetes mechanisms,
this is only supported when kuryr-controller is run as Pod on Kubernetes
cluster.

Implements: bp high-availability

Change-Id: I2c6c9315612d64158fb9f8284e0abb065aca7208
2018-06-14 10:25:34 +02:00
Antoni Segura Puimedon
d3a6cdcf99 Kuryr-Controller: make handlers pluggable
This patch introduces a new way for configuring which handlers the
Kuryr controller should be using. This will allow people to use
externally provided handlers as long as they are installed as
entrypoints of the right namespace.

Implements: blueprint kuryr-pluggable-handlers

Change-Id: I52ce0ef00771c8587d7f7113cc5eb4839d1309a5
Signed-off-by: Antoni Segura Puimedon <antonisp@celebdor.com>
2018-04-17 17:02:00 +03:00
Maysa Macedo
c00897c02e Add liveness checks to Kuryr Controller
This patch adds liveness checks for watcher and handlers, without passing the
manager's reference to modules that probably should not be aware of it.

Related-Bug: #1705429
Change-Id: I0192756c556b13f98302a57acedce269c278e260
2018-01-31 14:25:48 +00:00
Maysa Macedo
ed2536dbcc Add readiness checks for Kuryr Controller
This patch checks the health of k8s, Keystone and Neutron,
by using a server that combines all the verifications. Also, checks
if ports are loaded into the pools when required.

Partially Implements: blueprint controller-readiness-liveness-probes
Change-Id: I09121a61d23fb64b326dae3947d5d24b1329cde3
2018-01-08 12:13:11 +00:00
Ilya Chukhnakov
e3209864dc K8s Services support: LoadBalancerHandler
This patch implements LoadBalancerHandler that handles K8s Endpoints
events and tracks changes in LBaaSServiceSpec to update Neutron LBaaS
accordingly and to reflect its' actual state in LBaaSState.

Change-Id: I718daf6d3def981c1bde5ca9831f955766935fbd
Partially-Implements: blueprint kuryr-k8s-integration
2017-04-10 17:07:16 +00:00
shihanzhang
1d35146a46 Remove log translations
Log messages are no longer being translated. This removes all use of
the _LE, _LI, and _LW translation markers to simplify logging and to
avoid confusion with new contributions.

See:
http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html
http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html

Change-Id: If4735fc3ac1803585efd90657539e540d157a59a
2017-03-28 15:13:49 +08:00
Ilya Chukhnakov
a715f9edb9 K8s Services support: LBaaSSpecHandler
This patch introduces LBaaSSpecHandler that handles K8s Service
events and updates related Endpoints with LBaaSServiceSpec when
necessary.

Change-Id: I09a0235842edd06827437f37aeac7ca5daeb1774
Partially-Implements: blueprint kuryr-k8s-integration
2017-02-03 15:05:45 +03:00
vikaschoudhary16
dc65eb1cbd Add support for nested pods with Vlan trunk port
Enable support for pods running in Nova vms.

I will be pushing a patch with devstack plugin changes.

Reference: https://review.openstack.org/#/c/411116/1/doc/source/devref/howto_binding_drivers.rst
Change-Id: Ib2aed7a0d1fa705f17a62d0fa4e272f19212e39e
Partially-Implements: blueprint binding-drivers-porting
2017-01-18 16:57:32 +05:30
Ilya Chukhnakov
4c78d6e51a Controller side of pods' port/VIF binding
This patch introduces VIFHandler that is used by Kuryr-Kubernetes
controller to manage VIF annotation and related Neutron resources
which are used by CNI driver to enable pod networking.

Change-Id: I1acfa052a530f06def4f7179945fac1687e1951a
Partially-Implements: blueprint kuryr-k8s-integration
2016-11-23 09:52:51 +03:00
Ilya Chukhnakov
9e078d4a5c Default pod subnet driver and os-vif utils
This patch adds a new driver type used to determine Neutron subnet
that should be used for Kubernetes pods' ports. This patch also
provides a default subnet driver implementation that uses a
subnet set in configuration file.

This patch also introduces the 'os_vif_util' module that contains
functions to translate data structures returned by Neutron client to
os-vif objects. Only the subnet-related functions are added in this
patch.

Change-Id: I643b22858239ce7f64e6ba81822b31e788fc9990
Partially-Implements: blueprint kuryr-k8s-integration
2016-11-20 12:55:16 +00:00
Ilya Chukhnakov
f0e1c206a9 Controller event handling pipeline
This patch introduces ControllerPipeline which is an entry point
handler for the Kuryr-Kubernetes controller. ControllerPipeline
allows registering ResourceEventHandlers and ensures the proper
handler is called for each event that is passed to the
ControllerPipeline. Also it ensures the following behavior:

- multiple ResourceEventHandlers can be registered for the same
  resource type (OBJECT_KIND)

- failing handlers (i.e. ones that raise Exceptions) are retried
  until either the handler succeeds or a finite amount of time
  passes, in which case the most recent exception is logged

- in case there are multiple handlers registered for the same
  resource type, all such handlers are considered independent (i.e.
  if one handler fails, other handlers will still be called
  regardless; and the order in which such handlers are called is not
  determined)

- events for different Kubernetes objects can be handled concurrently

- events for the same Kubernetes object are handled sequentially in
  the order of arrival

Change-Id: Ib17e0c7a2790cdbc31be4f59d50972b43c272480
Partially-Implements: blueprint kuryr-k8s-integration
2016-11-03 13:08:29 +00:00
Ilya Chukhnakov
11fde58e09 Asynchronous handler
This patch adds the Async handler that can be used as part of the
event handling pipeline to run handlers asynchronously.

Change-Id: I094b54dc59b4b533b67b2ed329d38d69348305af
Partially-Implements: blueprint kuryr-k8s-integration
2016-10-31 14:31:50 +03:00
Ilya Chukhnakov
5f6c9a574e Retry handler
This patch adds the Retry handler that can be used as part of the
event handling pipeline to retry failed handlers.

Change-Id: Ia86790de8efa6a3ef5b677a70ffbd2d8201f9d95
Partially-Implements: blueprint kuryr-k8s-integration
2016-10-31 10:53:07 +00:00
Ilya Chukhnakov
a3790b1555 Basic event handling pipeline components
This patch provides basic event handling pipeline components.
The EventPipeline class provided by this patch will serve as a base
class for ControllerEventPipeline and CNIEventPipeline classes that
are to be implemented by future patches.

Change-Id: I8c68941cbe323f80cd67341fe05656efd57bcdc5
Partially-Implements: blueprint kuryr-k8s-integration
2016-10-31 10:52:46 +00:00
Ilya Chukhnakov
6666459912 Watcher implementation
Adds Watcher implementation

Change-Id: I9230d6f8cc2ee9346ef29e47bd6fd4f64bd9425e
Partially-Implements: blueprint kuryr-k8s-integration
2016-10-26 06:15:31 +03:00
Ilya Chukhnakov
378e571dd4 Controller service base
This patch introduces an eventlet-based Kuryr-Kubernetes controller service
base (based on oslo.service) and command-line launcher.

Change-Id: Idfd5efd71d9dd7cb184905dd487eea4ba33b029e
Partially-Implements: blueprint kuryr-k8s-integration
2016-10-04 21:56:50 +03:00