Commit Graph

37 Commits

Author SHA1 Message Date
Michal Nasiadka bc79012f46 Drop Swarm support
Label validator function has been left behind, although it's not
checking for anything right now - might be useful in future.

Change-Id: I74c744dc957d73aef7556aff00837611dadbada7
2024-01-24 13:20:21 +13:00
guilhermesteinmuller d3d28594b3 Drop mesos driver
The coe mesos has not been maitenaned for quite some
time and hasn't got much attetion from the community
in general. As discussed in the mailing list [1] we
are dropping for now.

In this patch, we start by removing the mesos driver
and its test cases. This part of the code has no impact
for other drivers. Then we can clean up mesos references
that affect the API.

[1] http://lists.openstack.org/pipermail/openstack-discuss/2021-December/026230.html

Conflicts:
	lower-constraints.txt
	tox.ini

Change-Id: Ied76095f1f1c57c6af93d1a6094baa6c7cc31c9b
2022-11-11 23:01:43 +11:00
Zuul 1bd6bad1d7 Merge "Remove duplicated keys in dict" 2022-11-09 12:58:31 +00:00
Jake Yip cb40fb3685 Add back pep8 test
In Change I523a4a85867f82d234ba1f3e6fad8b8cd2291182, the pep8 test was
accidentally dropped.

Fix up code so that pep8 passes.

In addition to that following change has been added here to unbreak CI:

Add WebTest as an indirect test dependency

Pecan has made webtest an optional dependency for testing only [1].
Since it is still used for testing we need to add it to our
test-requirements.txt.

[1]: https://github.com/pecan/pecan/pull/140

Change-Id: I2f85adb4ef29a43389897c201e6152fd4c7be9d6
2022-07-19 12:35:14 +00:00
Mohammed Naser 6eb907cc89 Drop Kubernetes Python client dependency
We depend on the Kubernetes Python client for several things such as
health checks & metrics polling.  Those are both run inside periodic
jobs which spawn in greenthreads.

The Kubernetes API uses it's own thread pools which seem to use
native pools and cause several different deadlocks when it comes to
logging.  Since we don't make extensive use of the Kubernetes API
and we want something that doesn't use any threadpools, we can
simply use a simple wrapper using Requests.

This patch takes care of dropping the dependency and refactoring
all the code to use this simple mechansim instead, which should
reduce the overall dependency list as well as avoid any deadlock
issues which are present in the upstream client.

Change-Id: If0b7c96cb77bba0c79a678c9885622f1fe0f7ebc
2022-01-20 16:02:21 +00:00
zhufl 826a31f8bc Remove duplicated keys in dict
This is to remove duplicated keys in dict.

Change-Id: I58b1e3280d2fbcbe354136170c22acf78642a0b1
2021-01-29 14:56:06 +00:00
Feilong Wang 946c1d67c7 Add master_lb_enabled to cluster
Adding the master_lb_enabled option when creating a cluster,
which will benefit both the cloud provider side and the end
user side. For cloud prodiver, they don't have to maintain
separate cluster templates with or w/o master_lb_enabled enabled.
For end user, they can easily use one single template to create
different clusters with different configs.

Task: 39680
Story: 2007634

Change-Id: I0b586f05168ece84fd340ef7493a56688191053d
2020-07-21 11:07:33 +12:00
Sean McGinnis 45fd25c572 Use unittest.mock instead of third party mock
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.

Change-Id: I6245a207ec65df0ef11a798b4cffe3157abccb73
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
Co-Authored-By: Spyros Trigazis <spyridon.trigazis@cern.ch>
2020-04-29 17:10:23 +03:00
Feilong Wang 63e80c3108 [k8s] Support updating k8s cluster health status
The original design of k8s cluster health status is allowing
the health status being updated by Magnum control plane. However,
it doesn't work when the cluster is private. This patch supports
updating the k8s cluster health status via the Magnum cluster
update API by a 3rd party service so that a controller (e.g.
magnum-auto-healer) running inside the k8s cluster can call
the Magnum update API to update the cluster health status.

Task: 38583
Story: 2007242

Change-Id: Ie7189d328c4038403576b0324e7b0e8a9b305a5e
2020-04-09 16:59:26 +12:00
Bharat Kunwar fbaba6e001 k8s: Fix logic of when a cluster API is accessible
At present, if floating_ip_enabled is true and master_lb_enabled is also
true but master_lb_fip_enabled is false, a cluster still resolves to
being accessible therefore resolves to an UNHEALTHY status when it
should be UNKNOWN. This patch fixes this edge case and also adds a unit
test to capture this issue.

Story: 2007242
Task: 39140

Change-Id: I74f7455e3caa920032080747a315470878ba5500
2020-03-25 11:39:08 +13:00
Feilong Wang d224999cb0 Improve log of k8s health status check
When the k8s cluster is created in a private network without
FIP and without a LB FIP, the cluster is not reachable by Magnum
control plane. For this case, the cluster health status is unknown
for Magnum and Magnum should not connect the cluster to avoid
unnecessary logs.

Task: 36187
Story: 2006383

Change-Id: Ibb589ec51f91f05a334c907560ef5fe57cbfbffb
2019-10-01 18:29:16 +00:00
Theodoros Tsioutsias 3f80cbab06 ng-4: Adapt cluster object
This commit removes the fields node_addresses, master_addresses,
node_count and master_count from the cluster object since this info
will be stored in the nodegroups. At the same time, provides the way
to adapt existing clusters to the new schema.

story: 2005266

Change-Id: Iaf2cef3cc50b956c9b6d7bae13dbb716ae54eaf7
2019-03-29 10:31:48 +00:00
Theodoros Tsioutsias 18c77a288d ng-2: Adapt existing cluster APIs and conductor
This changes the existing cluster APIs and the cluster conductor to
take into consideration nodegroups:

* create: now creates the default nodegroups for the cluster
* update: updates the default nodegroups of the cluster
* delete: deletes also the nodegroups that belong to the cluster
* cluster_resize: takes into account the nodegroup provided by the API

story: 2005266

Change-Id: I5478c83ca316f8f09625607d5ae9d9f3c02eb65a
2019-03-28 10:31:01 +00:00
Feilong Wang c38edc6929 [k8s] Update cluster health status by native API
Calling Kubernetes native API to update the cluster health status
so that it can used for cluster auto healing.

Task: 24593
Story: 2002742

Change-Id: Ia76eeeb2f1734dff38d9660c804d7d2d0f65b9fb
2019-02-18 11:03:10 +13:00
Bharat Kunwar b7bfee5d27 Support disabling floating IPs in swarm mode
We use the same technique that is used for kubernetes clusters, with a
custom heat resource that provides either a floating IP, or
OS::Heat::None when disabled. We also add coverage tests for swarm-mode.

Change-Id: I3b5877bcd89fc2436776f49e479ffadf72c00ea3
Story: 1772433
Task: 21662
Task: 22102
Co-authored-by: Mark Goddard <mark@stackhpc.com>
2018-07-10 09:27:07 +00:00
Davanum Srinivas e634b55637 Switch to kubernetes upstream python client
For a really long time, we generated and maintained our very own python
client generated from kubernetes swagger json files. Now in Kubernetes
Community there is a concerted effort to organize an official python
client (also generated from swagger) for everyone to use. So let us
please switch over from our python-k8sclient and use the community
driven python client. I have ported all of our end-to-end tests and got
them working in kubernetes client-python project upstream so we should
be protected from regressions.

Implements: blueprint replace-k8sclient-with-upstream-kubernetes-client

Depends-On: I72359f2b811392008eb5267812bf343797b1553a
Change-Id: Ib81a69cfdc25198e259e3b3d4081c92c01fd1bc5
2017-02-13 14:48:08 -05:00
Spyros Trigazis 52be59345b Fix getting capacity in k8s_monitor
Remove parsing literal for capacity. K8s client returns an object
now.

Change-Id: I26b3e529ee69ea9e48e0bedfbf95dd77d2b78593
Depends-On: Ia55d01a7cfd6e11448272e5859dd84e40147b618
Closes-Bug: #1595373
2017-01-24 11:28:23 +01:00
Spyros Trigazis f997a332da Move monitors at driver level
Following changes for cluster-drivers, move coe specific monitors
at driver level. This change is needed to add the driver field
properly.

Change-Id: Id4658b8f7400bf3c86c8ff81756fb33d1211a0b3
Implements: blueprint bay-drivers
2017-01-23 13:33:37 +01:00
Jaycen Grant 729c2d0ab4 Rename Bay DB, Object, and internal usage to Cluster
This is patch 3 of 3 to change the internal usage of the terms
Bay and BayModel.  This patch updates Bay to Cluster in DB and
Object as well as all the usages.  No functionality should be
changed by this patch, just naming and db updates.

Change-Id: Ife04b0f944ded03ca932d70e09e6766d09cf5d9f
Implements: blueprint rename-bay-to-cluster
2016-09-08 13:01:12 -07:00
Jaycen Grant 0b7c6401dd Rename BayModel DB, Object, and internal usage to ClusterTemplate
This patch is the first of 3 patches to change the internal
usage of the terms Bay and BayModel. This patch updates
BayModel to ClusterTemplate. No functionality should be
changed by this patch, just naming and db updates.

Change-Id: I0803e81be6482962be2878a8ea2c7480f89111ac
Implements: blueprint rename-bay-to-cluster
2016-09-01 14:47:39 -07:00
yatin 272903ff9e Revert "Update mesos slave to mesos agent"
This reverts commit 15162ce33a.

Mesos services were not working, so reverted the patch
which renamed slave to agent.

Change-Id: I94a9a36e649f48f8e31386226226261ef459ce25
Closes-Bug: #1617407
2016-08-30 08:49:45 +05:30
Rajiv Kumar 15162ce33a Update mesos slave to mesos agent
Mesos community has renamed slave to agent. This change reflect
this renaming in the code.

Change-Id: Ic97a827345b62f812ed63180cd1f5820e2200682
Closes-Bug: #1516188
2016-07-18 08:51:17 +05:30
Jenkins 79da93804a Merge "Add cpu util to K8sMonitor" 2016-04-05 16:44:16 +00:00
Eli Qiao 11307f6ce1 Add cpu util to K8sMonitor
Cpu metric is important to a cluster, add cpu util to notification bus.

After this patch get applied, we will get following metrics:

{'metrics': [{'unit': '%', 'name': 'cpu_util', 'value': 30.0}, {'unit':
        '%', 'name': 'memory_util', 'value': 4.795204795204795}]

Change-Id: I450c8b5afe766be4da4fb42c2ecb47db52b245f3
2016-04-05 09:49:13 +08:00
Eli Qiao 196eae1361 Add cpu util to MesosMonitor
Cpu metric is important to a clutser, add cpu util to notification bus.

After this patch get applied, we will get following metrics:

{'metrics': [{'unit': '%', 'name': 'cpu_util', 'value': 30.0}, {'unit':
    '%', 'name': 'memory_util', 'value': 4.795204795204795}]

Change-Id: I44cc2edf2a33ff2991ba0b006d802dc3efee42b6
2016-03-31 03:20:36 +00:00
Dinesh Bhor e7be462a24 Fix invalid import order
Updated import order as per the OpenStack import standards [1].
Modules under magnum/common/pythonk8sclient are not covered in
this patch because this code is generated via a third party
tool "swagger-codegen" which does not follows openstack
standards yet.

[1] http://docs.openstack.org/developer/hacking/#import-order-template

Change-Id: Ia87f3e797ee627bf3c04d2bae9639fd305b41b0d
2016-02-07 22:54:41 -08:00
Eli Qiao da89eae7e6 Clean up baymodel query of usage from a bay
For baymodel reference of a bay, we can use bay.baymodel instead of using
bay.baymodel_id to get baymodel object, this patch does a cleanup.

Implemented: blueprint add-baymodel-object-to-bay
Change-Id: I568cc090d37d6666d8d02e87788aa5fff79e46e8
2015-12-21 18:10:31 +08:00
Hongbin Lu d95f400c63 Fix mesos monitor for handling multiple masters
Magnum is going to enable HA mode for mesos bay, in which there
could be more than one master nodes. One of the master node (leader)
is active and the rest of them is not active. Mesos monitor needs to
identify the leader and pull metrics from the leader only.

Change-Id: Ic7d6cb64964db2758163bd231dec4190302155b2
Partial-Implements: blueprint mesos-multi-master-node
2015-12-08 15:27:31 +00:00
Bharath Thiruveedula 1cfc3d067c Monitor driver for mesos bay type
Add support for computing memory utilization of memory bay

Change-Id: Iadb710f030fca62f4edb42a02209de81e369ce88
Closes-Bug: #1500300
2015-11-13 22:55:28 +05:30
Eli Qiao e36911f429 Swarm: Map master address to api_address based on TLS
api_address is a API address instead of master node's IP address.
This patch fix it by adding a new OutputMapping, it will help to handle
the mapping from master address to api_address.

Also test cases added.

Closes-Bug: #1514311
Change-Id: I47baf92dd466150adbd75746d0cb804d108f7d5f
2015-11-10 11:53:49 +08:00
Bharath Thiruveedula 61c9017335 Monitor driver for k8s bay type
Add support for computing memory utilization of k8s bay

Change-Id: I3eecd5e9ceab77bb1877dff2229ba2eb18a5dd76
Closes-Bug: #1500299
2015-11-05 23:30:00 +05:30
wangqun 87d6056846 Use assertIsInstance instead of assertTrue(isinstance(a, b))
Developer should use assertIsInstance to replace the
assertTrue(isinstance(a, b)).

Closes-Bug: #1510384
Change-Id: I70f68a5810a6797c7b7e112b46ef2463907bba3e
2015-11-02 04:09:47 +00:00
Jenkins 9eb3a79e6c Merge "Fix swarm monitor exception" 2015-10-14 01:27:25 +00:00
Eli Qiao c818df26c0 Fix swarm monitor exception
In docker 1.8 (atomic-6) image, docker inspect returns Memory information
in 'HostConfig section', this patch will adopt that changes.

Depend on: I009d8034335f54063a51b8d1395ddc6891a12346
Change-Id: I63ee2393c106d59286f49f88c85c6cba0a57ae15
Closes-Bug: #1504715
2015-10-13 19:44:58 +00:00
lei-zhang-99cloud 7fda571402 Fix order of arguments in assertEqual
Some tests used incorrect order assertEqual(observed, expected).
The correct order expected by testtools is
assertEqual(expected, observed).
This patch fix the issue in the module magnum/tests/unit/conductor/.

Change-Id: Ib8ead5a00b8095892341e08b1662b053ac1ec36b
Partial-Bug: #1259292
2015-10-10 17:43:43 +08:00
Hongbin Lu 30eacb52c9 Pull metrics by using TLS enabled client
Magnum introduced TLS support in swarm bay, so swarm monitor needs
to use TLS enabled client to pull data.

In addition, this commit eliminates data pulling from the docker
daemon of individual bay nodes, since they are not secured by TLS.
Instead, we always pull from swarm. Due to that, additional text
parsing is needed, since the output of docker.info from swarm is
not well formed.

Change-Id: I121bfa98622c240d5c777901794a35c0d8990345
Closes-Bug: #1503460
2015-10-08 10:45:37 -04:00
Hongbin Lu b88085c93c Implement bay monitoring and notifications
* Implement a bay monitoring framework that provides APIs to pull data from
  bay, and compute metrics based on the data.
* Add support for computing memory utilization of a swarm bay.
* Add a periodic task that sends metrics to ceilometer.

Change-Id: I32730e116c59a4e5f9d1ccb466d464c2fc1f6193
Partially-Implements: blueprint autoscale-bay
Partially-Implements: blueprint magnum-notifications
2015-09-29 14:38:03 -04:00