Commit Graph

30 Commits (06659759f1213df23f1d456503b1dd2ea8e90963)

Author SHA1 Message Date
Jake Yip d866fb6184 Fix async reserved word in python3.7
kubernetes-client has patched this [1]. To retain backwards
compatibility, we can use **kwargs to handle async/async_req arguments

[1]: b10c7b6a17

Change-Id: I8e738b4f99091786dd76e081bffa36ef5ab70085
4 years ago
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
4 years ago
yatin 553316e40f Fix: functional CI Jobs
After [1] jobs are return false(SUCCESS) status due
to wrong EXIT_CODE.
After [2] kubernetes client is updated to v4.0.0 and
no longer contains ConfiugrationObject so we need create
instance of Configuration class.

Also don't use local to create variable as local
 can only be used in a function.

[1] https://review.openstack.org/#/c/526618/
[2] https://review.openstack.org/#/c/528406

Change-Id: Ida5aac40b234a358b2a13b2e51a41d0242031ebb
5 years ago
coldmoment ba8ad5e37f Add a hacking rule for string interpolation at logging
String interpolation should be delayed to be handled
by the logging code, rather than being done at the point
of the logging call.
See the oslo i18n guideline
* https://docs.openstack.org/oslo.i18n/latest/user/guidelines.html#adding-variables-to-log-messages
and
* https://github.com/openstack-dev/hacking/blob/master/hacking/checks/other.py#L39

Change-Id: I8a4f5f896865aebbff88ee894f0081e58cfce9ef
6 years ago
yuanpeng 71d25456d2 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: If1f4bd2f6be967368f52fb367c5a428d3eb58a9d
Closes-Bug:#1674551
6 years ago
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
6 years ago
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
7 years ago
Cao Xuan Hoang 33bd24252f Clean imports in code
This patch set modifies lines which are importing objects
instead of modules. As per openstack import guide lines, user should
import modules in a file not objects.

http://docs.openstack.org/developer/hacking/#imports

Closes-Bug: #1620161

Change-Id: I7ec9022a6b1cec36c678a2cec2a1856e70a51c68
7 years ago
yatin karel fb0057c105 Add i18n translation for Log messages
Added i18n translation to all log messages. Also added
hacking check for this to ensure in future all log
messages are translated.

Change-Id: I77fbb18ffe47b12232125cc1fa7aae97ea9b1214
Closes-Bug: #1603759
7 years ago
yuyafei 85a2fdd70b Correct reraising of exception
When an exception was caught and rethrown, it should call 'raise'
without any arguments because it shows the place where an exception
occured initially instead of place where the exception re-raised.

Change-Id: If180215bda5592c0cba92cb2c9b3a61c13d62ccf
7 years ago
Madhuri Kumari 5f193f2e0e Add x509keypair_cert_manager to store certs in DB
x509keypair_cert_manager stores certs in Magnum DB.

Change-Id: Id8106d7bd5c270679bc189fc0dc17bcbde367d73
Implements: blueprint  blueprint barbican-alternative-store
7 years ago
Madhuri Kumari e280b0339a Code refactoring in conductor/k8s_api.py
This patch removes redundant method create_certificate_files defined in
magnum/conductor/k8s_api.py and uses the one defined in
magnum/conductor/handlers/common/cert_manager.py

Change-Id: I509fd24b3a6febd1b621321c380f38afdfaccec2
Closes-bug: #1505085
7 years ago
Davanum Srinivas a6650650f0 Use k8sclient library
In Ia400b5b6919753d6241233a6666a2c30c7618bc9, we are
adding a new library to global requirements. This
python-k8sclient library essentially has the same
code that was in Magnum so it's a straight replace.

Change-Id: Ib85bcf532e4163d5c1ac95ef701a1ec3133b69eb
7 years ago
Eli Qiao b0ce382cf1 Use bay to init K8sAPI instead of bay_uuid
This patch aimed to reduce db call count when we invode k8sAPI.

For those user using bay name to do pod/rc/service operations, we
can saving a db call.

Change-Id: I1488d0526e1d444cb681b408f8a13ce25b4aee6f
7 years ago
ting.wang b9aa042293 Replace string format arguments with function parameters
There are files containing string format arguments inside logging
messages. Using logging function parameters should be preferred.

Change-Id: Id558f66de13146f6ae76a7a69f49721b6c3d6257
Closes-Bug: #1321274
7 years ago
Vilobh Meshram fee4b609c0 Make kubernetes API client generic
Make kubernetes API client generic. Right now each k8s object has
a way to create k8s API client. This was needed to make sure the
tests passed. Now since all the objects-from-bay patches are merged
in its better to make the client creation logic generic.

Change-Id: Ic2a9b16bbd4c13794c7ef95309bd260366ec872e
Closes-Bug: #1502367
8 years ago
OTSUKA, Yuanying d92812bdc0 Avoid to use common.cert_manager directly
Conductor has a utility to manage bay specific certificates.
This patch changes to use it.
And also this patch fixes temporary place holder classes related
to bp:objects-from-bay.

Change-Id: I55d7fe33d7a910b9ba76bcbb4c39353fe7fac2f4
Closes-Bug: #1523843
8 years ago
Vilobh Meshram 44122d08f8 Objects from Bay - Pods
Currently k8s objects (pod/rc/service) are read from the
database. In order for native clients to work, they must
be read from the ReST bay endpoint. To execute native
clients, we must have one truth of the state of the
system, not two as we do now. This patch proposes the
change to the Pod object.

Also, please refer to the related-bug as to the temporary changes
done to make the test work for other objects namely rc,
service. These changes will be removed when the object from bay
patches for all the k8s objects are merged as part of a seperate
patch.

Partially-Implements: bp objects-from-bay
Related-Bug: #1502367
Related-Bug: #1504379

Change-Id: Id5be7fba2eb8622fcfeb48068728e440a0af3f5e
8 years ago
Vilobh Meshram 067b38391c Objects from Bay - Services
Currently k8s objects (pod/rc/service) are read from the
database. In order for native clients to work, they must
be read from the ReST bay endpoint. To execute native
clients, we must have one truth of the state of the
system, not two as we do now. This patch proposes the
change to the Service object.

Also, please refer to the related-bug as to the temporary changes
done to make the test work for other objects namely pod, rc. These
changes will be removed when the object from bay patches for
all the k8s objects are merged as part of a seperate patch.

Partially-Implements: bp objects-from-bay
Related-Bug: #1502367
Related-Bug: #1504379

Change-Id: I05177944a693710c70a22cae57f521b0fe738e9e
8 years ago
Vilobh Meshram 3b1c0b28cb Objects from Bay - Replication Controller
Currently objects (pod/rc/service) are read from the
database. In order for native clients to work, they
must be read from the ReST bay endpoint. To execute
native clients, we must have one truth of the state
of the system, not two as we do now. This patch adds
changes for Replication Controller.

Also, please refer to the related-bug as to the temporary changes
done to make the test work for other objects namely pod,
service. These changes will be removed when the object from bay
patches for all the k8s objects are merged as part of a seperate
patch.

Partially-Implements: bp objects-from-bay
Related-Bug: #1502367
Related-Bug: #1504379

Change-Id: I7905af9e22f47b16d92043cc1fdcb1cdf72ebc48
8 years ago
Vilobh Meshram f231a60942 Fix the failure to scale-down k8s cluster
Fix the failure to scale-down k8s cluster. We were getting this
failure because as part of scaling, Bay needs to be retrieved for
the respective k8s obj. But if the object passed is a Bay itself
we need not retrieve the Bay. At present even for Bay object the
code proceeds ahead to retrieve bay and cannot find bay_uuid
attribute. This patch fixes this problem.

We might need to backport this fix to stable/liberty as well.

Change-Id: I7ed03af8bdbb8647851751bb550d9529d96b5cb4
Closes-Bug: #1509439
8 years ago
Hongbin Lu 18b61bce51 Fix incorrect usage of CertManager in k8s_api
This should fix a 400 error on getting certificates from Barbican.

Change-Id: I5cd934ba0df41fe34e74ae7c90febeccc821f758
Closes-Bug: #1506906
8 years ago
Surojit Pathak ec2cd88a05 Make Kubernetes API call secure
This patch makes API call to Kubernetes secure using the certificate
and key.

Co-Authored-By: Madhuri Kumari<madhuri.kumari@intel.com>
Co-Authored-By: OTSUKA, Yuanying<yuanying@fraction.jp>
Depends-On: I76b0f91f0c44f9880980e35c6b8856ea48ed3ce1
Change-Id: Id4dceb83f67b80f5b39e3047011f9e34e840359d
Partially-Implements: blueprint secure-kubernetes
8 years ago
OTSUKA, Yuanying 30b3d99d5c Add TLS support in heat kubernetes
This patch modifies template to generate certificates and configure TLS
settings for kube-apiserver/kubelet/kube-proxy.

Co-Authored-By: Andrew Melton <andrew.melton@rackspace.com>
Partially-Implements: bp secure-kubernetes
Change-Id: I76b0f91f0c44f9880980e35c6b8856ea48ed3ce1
8 years ago
wenchma a3a43ef225 Sync the description with Kubernetes Release 1 version
Closes-bug: #1498385

Change-Id: Iafe5529a8c060d0ea704eea738e696427c09c25c
8 years ago
Ton Ngo 4bfed61fe3 Migrate to Kubernetes Release 1
Kubernetes Release 1.0 was announced at OSCON

A new Fedora Atomic image has been built with version 1.0.4 and
this series of patches will update the templates, scripts, documents
to work with the new image.

The api has also been changed from v1beta3 to v1 and the beta
api is no longer available, so the interface between Magnum and
Kubernetes master are updated as well in this series of patches.

This particular patch will bring up a V1 cluster with the
bay-create command.  Because the switch to the V1 API requires
all the code changes to be applied at once, this patch pulls
in portion of 3 patches together.  The changes include:

1. devstack plugin downloads the new image.

2. k8s conductor and other code calls the new V1 client and
k8s methods.

3. Configuration for k8s services and docker updated with
new parameters.

4. Minion registration and example code updated to V1.

5. Functional tests updated to V1.

6. Gate test setup points to the new image.

Co-Authored-By: Hongbin Lu <hongbin.lu@huawei.com>

Change-Id: I046931ad491e8b7ee45943852901eac5c3df913e
Partially-Implements: blueprint kubernetes-v1
8 years ago
lei-zhang-99cloud d14382d997 Add port type on port option
According to http://docs.openstack.org/developer/oslo.config/cfg.html
oslo.config can use portType to support the ability to set valid range
on port option values

Closes-Bug: #1488861

Change-Id: Ic4310532f4155ade1706f0bca8df9466665aea97
8 years ago
Hongbin Lu bccd681de7 Make k8sclient use the load balancer address
Currently, our python k8sclient uses the IP address of the master node
as the API endpoint. As we are going to have multiple master nodes,
we need to use IP address of the load balancer instead.

Change-Id: I4da0a80f489f634afc154e8b3626b8c12cc50e86
Partially-Implements: blueprint make-master-ha
8 years ago
Lin Yang 03450e5907 Rename "k8s_master_url" to a better name
As k8s ha masters have been refined in [1], rename "k8s_master_url" to
a better name "k8s_api_endpoint".

[1]: https://review.openstack.org/#/c/204261

Change-Id: Iecdfda410b6c82a5ae4fa575eeb222f91f21ef5a
Closes-Bug: #1477301
8 years ago
Hongbin Lu 8d9649bc1f Move conductor common implementations into module
This allows common implementations to be reused later. Below is
the list of methods that were moved and renamed:
* handlers.k8s_conductor._retrieve_bay -> utils.retrieve_bay
* handlers.bay_conductor._get_baymodel -> utils.retrieve_bay
* handlers.k8s_conductor._retrieve_baymodel -> utils.retrieve_baymodel
* handlers.k8s_conductor._object_has_stack -> utils.object_has_stack
* handlers.k8s_conductor._retrieve_k8s_master_url ->
                                      k8s_api._retrieve_k8s_master_url
* handlers.k8s_conductor.Handler.k8s_api -> k8s_api.create_k8s_api

Change-Id: Ia10625f35667fd9309dc3627e2f2d31455dd19be
Partially-Implements: blueprint magnum-smart-bay-scale-down
8 years ago