David Garcia [Wed, 18 Aug 2021 12:52:52 +0000 (14:52 +0200)]
Fix bug 1529: Give warning when removing unexisting chart
Change-Id: I4620fe7b2aac1e9c9109ad1e87e5b0b5d585cde6
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Tue, 27 Jul 2021 13:07:42 +0000 (15:07 +0200)]
Give a warning when removing a cloud that does not exist
Fixes bug 1608
Change-Id: Ide9040f5e97ba07952062f23c9217e227af375d0
Signed-off-by: David Garcia <david.garcia@canonical.com>
aktas [Thu, 24 Jun 2021 08:37:11 +0000 (11:37 +0300)]
Fix Bug 1575
This fixes the race condtion when k8s cluster responding too fast
Change-Id: I3f9e18c7bba942689e4b056ead60349fdb72c795
Signed-off-by: aktas <emin.aktas@ulakhaberlesme.com.tr>
beierlm [Fri, 4 Jun 2021 01:28:17 +0000 (21:28 -0400)]
Pip standardization
Typo in protobuf version, typing-extensions
Corrected to match LCM
Change-Id: I0e7a1e1e0f032eecb38344fc7132cb2c5a51d01e
Signed-off-by: beierlm <mark.beierl@canonical.com>
David Garcia [Fri, 12 Feb 2021 16:19:13 +0000 (17:19 +0100)]
Feature 10296 Pip Standardization
Creates standard template for tox.ini
Introduces 'safety' for listing upstream CVEs
Pins all versions of all upstream modules
Removes Makefile step and places all build logic into tox.ini
Change-Id: Ic14321bd5bddb322db08ac3e25202cc64cac2dff
Signed-off-by: David Garcia <david.garcia@canonical.com>
garciadeblas [Fri, 28 May 2021 12:10:59 +0000 (14:10 +0200)]
Fix bug 1542 to allow juju to add Azure AKS
Storage classes in Azure might have no metadata annotations. This
change takes into account that situation.
Change-Id: I4f7151d2481b41fd8434e0d95ea5d1a156b68309
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
(cherry picked from commit
e77a91e534731b45c8f9648fc99e3f2d25313fa7)
David Garcia [Fri, 28 May 2021 10:23:44 +0000 (12:23 +0200)]
Fix bug 1533: use bionic as default series in proxy charms
Xenial is 2 LTS behind the current one. This patch will force bionic
rather than Xenial from now on. The current charms do not properly work
in Xenial.
The best solution will be to fix this bug:
https://osm.etsi.org/bugzilla/show_bug.cgi?id=1551
Change-Id: I1a0c466b6151b19a1eaf5d97f0373ab271601f89
Signed-off-by: David Garcia <david.garcia@canonical.com>
(cherry picked from commit
f643c1359c1edbe8bb851ce935416e534b234e74)
David Garcia [Wed, 26 May 2021 11:16:51 +0000 (13:16 +0200)]
Wait for cloud-init to finish before provisioning
Before provisioning a native charm, a script is executed to wait until
cloud-init finishes. This will avoid some racing conditions.
Fixes bug 1184
Change-Id: Icc87f90f5941cf7b13bdd7dd01e5544122fb769e
Signed-off-by: David Garcia <david.garcia@canonical.com>
(cherry picked from commit
9074b05b797b591eeb9b86b54c5a699b30454906)
David Garcia [Mon, 1 Feb 2021 09:37:23 +0000 (10:37 +0100)]
Clean up commented or unused code
Change-Id: Ib116128c15d727b9124e51d2475556045b79ac0d
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Mon, 26 Apr 2021 13:36:24 +0000 (15:36 +0200)]
Add kwargs in N2VCConnector constructor
Change-Id: I05c3df80dc8390fd6016ddc19636d97c18583bb8
Signed-off-by: David Garcia <david.garcia@canonical.com>
aktas [Fri, 26 Feb 2021 12:32:39 +0000 (15:32 +0300)]
Fix 1462
Wait until Juju application is destroyed in
n2vc.libjuju.Libjuju.destroy_application()
Change-Id: Ie7992f229872ffffbea87ca3e8e20825bfec7b6d
Signed-off-by: aktas <emin.aktas@ulakhaberlesme.com.tr>
David Garcia [Thu, 15 Apr 2021 08:15:29 +0000 (10:15 +0200)]
Fix bug 1505
Delete ssh-key generation in N2VCConnector initialization
Change-Id: I5f33adf683ffeef34de270bf9b458a172dd4059d
Signed-off-by: David Garcia <david.garcia@canonical.com>
beierlm [Tue, 16 Mar 2021 15:28:00 +0000 (11:28 -0400)]
Pin chardet to 3.0.4
Chardet 3.0.4 was last modified in 2017, and the next release of chardet 4.0.0
was released only recently (Dec 2020). As many other pip packages still depend
on 3.0.4 we need to explicitly pin that here to avoid conflicts later at LCM
docker build time.
Change-Id: I2a1ee0d61e641c0dc3f240345ce47f0d13d8fb22
Signed-off-by: beierlm <mark.beierl@canonical.com>
endika [Wed, 16 Sep 2020 13:41:18 +0000 (15:41 +0200)]
fix 1208: add native charm support for rhel and fix centos support
The commit adds SO discovery support for rhel and adds a script to
add a DNAT rule to rhel and centos images.
There are some things that needs to be taken in acount.
- It uses firewalld, wich is the default firewall for centos and rhel,
instead of iptables. This may break some thinghs if the image uses
iptables.
- If firewalld is not actibe it assumes that the VM is not using it,
so it creates a input rule to accept all incoming conections
(by default rejects all). If the firewall was not enabled, with
accept all it should have the same behavior.
Change-Id: I29c9781d354c4e8268e19f64dcc9568d725a0de3
Signed-off-by: endika <endika.aldecoa@ehu.eus>
(cherry picked from commit
f97b231c021d082f5f56ac88804af3d73be2caa9)
endika [Wed, 14 Apr 2021 10:21:42 +0000 (12:21 +0200)]
set osm-common to v9.0
Change-Id: I2ecf4ea0ea5502193338834f6ecd4775da529597
Signed-off-by: endika <endika.aldecoa@ehu.eus>
David Garcia [Wed, 10 Mar 2021 19:00:53 +0000 (20:00 +0100)]
Add ModelConfig
This class maps the model-config from the vca_config. That config will
be passed every time a model is added.
Change-Id: I0a1e47ba7d708f3514c64a6f20d410a21fe8ea1d
Signed-off-by: David Garcia <david.garcia@canonical.com>
(cherry picked from commit
a71d4a04c1e8ad3ffe1a129024e6dbc14d6d3bd5)
David Garcia [Wed, 10 Mar 2021 10:50:38 +0000 (11:50 +0100)]
Fix bug 1448: minor fix in JujuModelWatcher.wait_for_model
Add an `application_ready` function in the Juju Watcher to check if all the
applications of the model are ready. This function checks that not only
the application is ready, but also all the units of the application.
Additionally, I have added a stability check. After considering a model
as ready, we will wait for 10 seconds, and check again.
Change-Id: Icd8d88613416b75cfd241e7044dbeffa6cbc6a8e
Signed-off-by: David Garcia <david.garcia@canonical.com>
(cherry picked from commit
c344117335d4ffbd06ef90ae8dce9cb3910165fb)
David Garcia [Mon, 15 Mar 2021 17:41:34 +0000 (18:41 +0100)]
Fix bug 1467
Do not raise exceptions in n2vc.libjuju.add_model() or n2vc.libjuju.destroy_model() functions
In general, functions should be as idempotent as possible. In this
particular case, executing the add_model() function several times with
the same arguments should just work. Same thing for destroy_model(). If
the model has already been destroyed, it should return and not give any
errors saying that the model doesn't exist.
Change-Id: I87e11ea0fe1b4063b2f89900fcc2bbf1f915b953
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Wed, 10 Mar 2021 16:09:44 +0000 (17:09 +0100)]
Minor improvements to libjuju.py
- Increase default timeout to connect to the controller
- Minor fix in destroy_model function
- Fix unit tests. Now they run faster :-)
Change-Id: Ia2cbcb3e052fe91f4e712ea572ecf444b1d5894f
Signed-off-by: David Garcia <david.garcia@canonical.com>
(cherry picked from commit
435b86410c96c0e034a892ac5df9ebc9547e3b7d)
David Garcia [Thu, 4 Mar 2021 12:03:06 +0000 (13:03 +0100)]
Minor fix in generate_kdu_instance_name
Change-Id: I9d545eef82cb76cdd8a2effd22121904f40e4262
Signed-off-by: David Garcia <david.garcia@canonical.com>
aktas [Sun, 21 Feb 2021 16:36:20 +0000 (19:36 +0300)]
Fixes for scaling proxy and native charm
With changes in here, it can remove application while scaling in
and it can add application existed k8s proxy charm model.
Change-Id: If4fd378fdafd925fa1750ce4769506b44adc233c
Signed-off-by: aktas <emin.aktas@ulakhaberlesme.com.tr>
(cherry picked from commit
d1d5541e1fd65d04675edae6e82f3d8a9035592c)
David Garcia [Fri, 12 Feb 2021 16:18:39 +0000 (17:18 +0100)]
Fix flake8 minor issues
Change-Id: I1348e9807b8071a1cbf50b97144069a5b6709def
Signed-off-by: David Garcia <david.garcia@canonical.com>
(cherry picked from commit
5ab1064304b993ea6364b5d932c5c0cb7434cfb7)
David Garcia [Tue, 23 Feb 2021 10:47:29 +0000 (11:47 +0100)]
Add generate_kdu_instance_name method in K8sConn
The reason for adding this method is for LCM to call it before calling
K8sConn.install(). That way, LCM can record it in the DB before
finishing the instantiation of the KDU.
This will help fixing bug 1412.
Change-Id: Iacf71c4d2040dbdc966cff2bddd697c4ea1c9a06
Signed-off-by: David Garcia <david.garcia@canonical.com>
lloretgalleg [Fri, 15 Jan 2021 11:33:00 +0000 (11:33 +0000)]
Bug 1400: Updated url for client-only helm init
Change-Id: Id80f1d175c0943527437851cc8c430da2f4af4c4
Signed-off-by: lloretgalleg <illoret@indra.es>
lloretgalleg [Thu, 17 Dec 2020 12:42:11 +0000 (12:42 +0000)]
Fix bug 1400: Change repo stable for helm2
Change-Id: Idc4c6454e539b0935d57b5b0cdcc0895b5d00895
Signed-off-by: lloretgalleg <illoret@indra.es>
lloretgalleg [Thu, 17 Dec 2020 09:19:30 +0000 (09:19 +0000)]
Changed url stable repository for helm3
Change-Id: I28c45df018e32a7bc984645a8f058baaa1f7b6c7
Signed-off-by: lloretgalleg <illoret@indra.es>
beierlm [Wed, 16 Dec 2020 12:07:10 +0000 (07:07 -0500)]
Pin pylint version
Pins the version of pylint to 2.6.0, which corrects the upstream
dependency on SortImports.
Change-Id: I6d3a08ab34e62c03e119f84f66452ec4934c19c4
Signed-off-by: beierlm <mark.beierl@canonical.com>
lloretgalleg [Fri, 20 Nov 2020 11:28:08 +0000 (11:28 +0000)]
Corrected bugs on support for helm v3
Change-Id: I064a8d45490989c75a31384cf16e7ab8755542c3
Signed-off-by: lloretgalleg <illoret@indra.es>
David Garcia [Fri, 27 Nov 2020 14:32:02 +0000 (15:32 +0100)]
Fix bug 1298
This bug was caused because a bad parsing of the kubeconfig.
The token should be the secret from k8s for the created service
account.
When adding a k8s cluster, a clusterrole, clusterrolebinding, and
serviceaccounts are created.
Tests are needed for oauth2 and userpass kubeconfigs.
Change-Id: I6a4a2834bd6477f255e8ca48e7f53cd3a0d3fddf
Signed-off-by: David Garcia <david.garcia@canonical.com>
lloretgalleg [Thu, 22 Oct 2020 09:12:35 +0000 (09:12 +0000)]
Support for helm v3
Added support for helm3 and included unit tests for helm and helm v3
Change-Id: I1a4a14be2e0a5c82445b97a9d263fd67139fd25b
Signed-off-by: lloretgalleg <illoret@indra.es>
lloretgalleg [Wed, 2 Sep 2020 09:40:38 +0000 (09:40 +0000)]
Syncronize with fs before action and reverse sync after action to allow high availability with mongofs
Change-Id: I4b8b2411d605de8e1743d835aff994ad788ae997
Signed-off-by: lloretgalleg <illoret@indra.es>
David Garcia [Wed, 11 Nov 2020 15:56:06 +0000 (16:56 +0100)]
Fix minor bug in configure application
Variable model was unassigned if the connection to the controller was
failing
Change-Id: I14764079f505c46ff7c9af7adec8079b43eca14e
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Tue, 3 Nov 2020 19:37:06 +0000 (20:37 +0100)]
Feature 9952: Distributed Proxy Charms
Add cloud_name and cloud_credential arguments in these functions to
allow allocating proxy charms in different clouds:
- create_execution_environment
- register_execution_environment
- install_k8s_proxy_charm
Change-Id: I3e57c6e5b9e25f9abfb7a579a188cf98d457e2b2
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Tue, 22 Sep 2020 12:52:32 +0000 (14:52 +0200)]
Feature 9751: Centralized VCA for KNFs
- Use libjuju.py for the communication with VCA
- Add the k8s_cloud as an external cloud to the VCA
- Add unit tests
Change-Id: Id55bfada3957f35e13cef7b4bfcc7acb72452df0
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Thu, 22 Oct 2020 08:50:56 +0000 (10:50 +0200)]
Fix bug 1263
Update database endpoints when a new VCA_HOST_IP is provided
Before, we were not considering the that the VCA_HOST_IP could be
updated, in that case, the old ips stored in the database should be
replace by the new one. Of course, this won't do any model migration
from the previous VCA to the new one. It will only start pointing to
the new VCA provided.
Change-Id: I5e259f773f90e4f440d87c4b6342cd82425c0e0c
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Wed, 21 Oct 2020 12:19:45 +0000 (14:19 +0200)]
Fix bug 1267: Destroy machines that are pending
When osm destroys a NS, and a native charm hasn't been able
to finish the provisioning of a machine, it will be in a pending state.
As it was seen in the bug 1267, when a model is destroyed and machines
are pending, the deletion of the model will get stuck.
This patch solves that by checking (before deleting the model) if there
are any manually provisioned machines in the juju model (native charms)
in a pending state. If there are, it will destroy them so that the deletion
of the model won't get stuck.
Change-Id: Ia3f6ae7390ccc2bb5d4874d7d08fd446019b0901
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Tue, 29 Sep 2020 17:48:13 +0000 (19:48 +0200)]
Fix bug 1216: Force model deletion
Change-Id: I3f41eead305349eba5d404f5f3d61d33f0536aca
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Thu, 15 Oct 2020 11:16:45 +0000 (13:16 +0200)]
Fix bug 1236: Retry if leader unit is not obtained
There a racing condition when N2VC tries to get the leader unit, but there
leader-elected hook has not been triggered. In that case, day-1 action might fail.
This commit solved this issue by retrying a couple of times.
Change-Id: If79cd243aa9ebdf8ed0e6235481eeb9fd2640612
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Fri, 16 Oct 2020 13:38:13 +0000 (15:38 +0200)]
Add credential_name option for add_k8s() and add_cloud()
Change-Id: I4adf740231e4c0d8785768631a8f2daedc198947
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Fri, 16 Oct 2020 12:37:37 +0000 (14:37 +0200)]
Add credential_name in Libjuju.add_model() function
Change-Id: Ic3ca0fce931de4b9f7d200e99feb604f21c1ab83
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Fri, 16 Oct 2020 11:00:18 +0000 (13:00 +0200)]
Add loop and vca_config options to K8sJujuConnector constructor
Change-Id: I65edb055af2a67d85f495812118721f1eefa53a5
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Mon, 21 Sep 2020 14:19:15 +0000 (16:19 +0200)]
Add new kubectl.py functions, modify some libjuju.py functions, add unit tests
- Kubectl.py: two new functions added (get_configuration and get_default_storage_class)
- get_configuration(): Returns a kubernetes Configuration object.
It can be used to properly parse the kubeconfig.
- get_default_storage_class(): Searches for the default storage class of a k8s cluster.
- Libjuju.py: modified add_k8s function and get_k8s_cloud_credential function was added.
- add_k8s(): Improves the way of generation Cloud and CloudCredential objects for the K8s Cloud
- get_k8s_cloud_credential(): It parses the kubeconfig to properly determine the authentication
method type that should be used for that k8s cluster.
- Unit tests: Added unit tests for all the new functions added.
- Exceptions: Make all Juju Exceptions to inherit from N2VC Exception.
Now Juju exceptions have the message attribute, that is useful for unit testing, to not only check that
an exception raised, but to check the message too.
- Move get_k8s_cloud_credential() function to n2vc/utils in order to share that code between different connectors.
Change-Id: Ife9027d80663fe95f1f3ad883cb9a3376b047d0b
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Mon, 21 Sep 2020 17:51:23 +0000 (19:51 +0200)]
Add get_metrics command to n2vc_juju_conn and libjuju
Change-Id: I6cde1528579c8ca7aa72d935c5e570004468bb1a
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Thu, 17 Sep 2020 14:01:48 +0000 (16:01 +0200)]
Add add_k8s, add_cloud, and remove_cloud commands to libjuju.py and unit tests
- add_k8s: Generates Cloud and CloudCredential objects for adding a Kubernetes cloud to the VCA
- add_cloud: Takes Cloud and CloudCredential as arguments for adding the cloud to the VCA
- remove_cloud: Remove cloud from VCA
Change-Id: Ia6b4c0cbd06f38df6fe4c52414f5bcb8ffb9a5a8
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Wed, 16 Sep 2020 11:31:33 +0000 (13:31 +0200)]
Remove EntityType from juju watcher and workaround juju bug for retrieving the status
- The juju watcher was doing an unnecessary translation with the entity types. The entity already provides an attribute .entity_type
- Juju has a bug in version 2.8.2 that returns a wrong status. Therefore, charms were getting stuck in waiting for ever.
Change-Id: I44709190acc41601e8a67f4c52074fda00c3d495
Signed-off-by: David Garcia <david.garcia@canonical.com>
almagia [Wed, 16 Sep 2020 07:44:40 +0000 (09:44 +0200)]
Revert "Revert ""Remove unused lines of code"""
This reverts commit
8bfcc14713a71f43f155e3cddec168380134d344.
approved by TSC on 15/09/20
Change-Id: I176b1b625cbc2d94013921401b2e6048aed675f8
David Garcia [Mon, 14 Sep 2020 13:10:04 +0000 (15:10 +0200)]
Revert ""Remove unused lines of code""
This reverts commit
e8102d9e28e5c502fc66ca842d14e1ad29efbfda.
Change-Id: Ic22f292f601f45451d3fdd56ab98bfa4ea9161eb
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Tue, 7 Jul 2020 08:34:33 +0000 (10:34 +0200)]
"Remove unused lines of code"
Change-Id: I02be0efe4918083d95a4017c898bfabaf269e779
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Fri, 11 Sep 2020 13:05:00 +0000 (15:05 +0200)]
Add consume to libjuju.py
This function allows to consume an offered endpoint in another model
Change-Id: I320978aac654fbb8199fdfbf4e928b0e2ba5458b
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Tue, 25 Aug 2020 14:10:07 +0000 (16:10 +0200)]
Change add_relation function in libjuju.py to accept saas
Before, app_1, endpoint1, app_2, endpoint2 parameters were needed.
Now we directly pass the endpoint names of the relation with the right format.
If "app:endpoint", it is understood that the endpoint it of a charm in the current model.
If "name", it is understood that the endpoint is a consumed endpoint from another model.
This function allows to cross-model-relate charms to external models
Change-Id: I84ab45ba735a1960ab742d9ec731c357ec1042c6
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Tue, 25 Aug 2020 13:22:30 +0000 (15:22 +0200)]
Add list_offers function to libjuju.py
This function return the list of offers available in a model
Change-Id: Iebc9f55c79f27caab5b2f5a2874e1d2d93dc9bc4
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Tue, 25 Aug 2020 13:03:01 +0000 (15:03 +0200)]
Add models_exist function to libjuju.py
This function checks if a gives list of model names exist in the controller.
Additionally, it returns the list of unexisting models from the given list.
Change-Id: I2a9290ef1a4ee1308626f3a31dba0a83127fdd8c
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Tue, 25 Aug 2020 12:38:59 +0000 (14:38 +0200)]
Add entries in .gitignore to ignore the files created by venv
Change-Id: I303847624dfb3f8f3a7ce37621f9f72b9344c0a2
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Thu, 23 Jul 2020 13:04:19 +0000 (15:04 +0200)]
Store k8s controller information in Mongo, and remove controller attribute from K8sJujuConnector
- Storing the k8s controller information in Mongo let us connect to that controller from different LCM units
- The cacert and secret keys are encrypted
- The controller attribute in K8sJujuConnector was preventing to have more than 1 connection to different controllers at the same time
Change-Id: Icf96e1eedf84e283dd6b0016cae3695a074b7d24
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Wed, 22 Jul 2020 15:56:12 +0000 (17:56 +0200)]
Get the kubeconfig credentials from MongoDB
This the previous approach, the kubeconfig was gotten from the filesystem,
which has issues scaling the LCM, because the kubeconfig was only present
in the pod that had initialized the environment.
The kubeconfig is stored in Mongo, and this commit basically gets the config from there, so it doesn't matter which LCM needs access to it.
Change-Id: I80458db5124122a4b7b3eb3a9b00cb4a4add11ff
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Wed, 22 Jul 2020 11:17:56 +0000 (13:17 +0200)]
Fix bug 1167
Change-Id: Id0ea5f19d57d2214219eec8f59f13a378d61c870
Signed-off-by: David Garcia <david.garcia@canonical.com>
tierno [Fri, 17 Jul 2020 11:47:32 +0000 (11:47 +0000)]
1156 fix path obtained for k8s_helm_conn cluster
minor change at /k8s_juju_conn.py
Change-Id: I1e7f4910bc726d5a693ce50f45798a2fc8363a96
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
David Garcia [Thu, 16 Jul 2020 15:53:20 +0000 (17:53 +0200)]
Fix an issue with the service ports in Kubectl.py
The ports were retrieved as V1ServicePort classes, and LCM cannot store that in the database
Change-Id: I451ab65478f36c5cb7f33594b4454bd315c22878
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Thu, 16 Jul 2020 10:37:13 +0000 (12:37 +0200)]
Make API Proxy optional and avoid replacing existing SSH Keys in the provisioner
- Fixes bug 1154
- Fixes bug 1083
Change-Id: I0ee5e092f5ff205089c2b80ece9f4262572d58d2
Signed-off-by: David Garcia <david.garcia@canonical.com>
Dominik Fleischmann [Wed, 15 Jul 2020 12:44:45 +0000 (14:44 +0200)]
Add unit tests for K8s Proxy Charm Feature
This commit also makes an initial template for
future test in n2vc_juju_conn.py
Change-Id: I34cb0f52bc2e6ce6b514ea4f99658f109e21875f
Signed-off-by: Dominik Fleischmann <dominik.fleischmann@canonical.com>
David Garcia [Wed, 15 Jul 2020 14:01:17 +0000 (16:01 +0200)]
Pin libjuju version to 2.8.2
This fixes bug 1144
Change-Id: I72580c2a2c4614bad2847b436d376ad9b4636031
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Thu, 2 Jul 2020 11:56:58 +0000 (13:56 +0200)]
Implement get_service and get_services methods for K8sJujuConnector
- Add a new class (n2vc.kubectl.Kubectl) for managing the Kubectl commands
- Add unit tests
- Add get_config_file() method for getting the path of the kubeconfig in K8sJujuConnector
- Implement get_service() and get_services() methods in K8sJujuConnector
Change-Id: I883ec21dad519c2dc65cb9bd601e539685336756
Signed-off-by: David Garcia <david.garcia@canonical.com>
Dominik Fleischmann [Tue, 7 Jul 2020 11:11:19 +0000 (13:11 +0200)]
Add unit tests to N2VC refactor
This commit adds unit tests for the following
modules:
juju_watcher.py 96% coverage
libjuju.py 72% coverage
utils.py 100% coverage
Minor libjuju.py fixes found with unit testing
Fix testing with tox
Change-Id: I9f23ce2f18aac6765edfa955ed200802c27d9047
Signed-off-by: Dominik Fleischmann <dominik.fleischmann@canonical.com>
tierno [Tue, 14 Jul 2020 10:29:00 +0000 (10:29 +0000)]
fix bugs 1117 and 1142 at deleting k8scluster helm-chart
bug 1142: When helm is not going to be uninstalled, do not check for kdu releases
bug 1117: When helm is going to be unistalled with kdu releases, just warn and
skip uninstall helm. This happens because kdu release has been installed
outside the scope of OSM. NBI already checks that there is not OSM kdu
deployments upon k8scluster deletion, denying the operation if any.
Change-Id: Icee2125b790c562130e13dd8c619d1c94c64c0fe
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
lloretgalleg [Mon, 29 Jun 2020 14:18:30 +0000 (14:18 +0000)]
Added new functionaliyty to obtain services data
Change-Id: I140dafb29f7636e4b8e481b865faa414d7fb1136
Signed-off-by: lloretgalleg <illoret@indra.es>
tierno [Wed, 24 Jun 2020 13:57:10 +0000 (13:57 +0000)]
allow starts N2VCJujuConnector without the parameter api_proxy
Change-Id: I7506f10b89c6837ce019e6db447748de3c811d61
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
tierno [Thu, 25 Jun 2020 15:48:52 +0000 (15:48 +0000)]
fix 1108 enhancement in helm installation and removing
it allows old versions of k8s by creating a serviceaccount
In addition it stores the namespace used for helm instalation,
to use it at deletion. For that a 'namespace.cluster_id' is used
Change-Id: I8333cbd02bc681908c4341b592746b144f8a0acd
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
David Garcia [Wed, 1 Jul 2020 18:25:30 +0000 (20:25 +0200)]
Update database with api_endpoints of VCA on initialization
Change-Id: Id5666d8c93d357632efde93e8e60abafdad56e35
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Tue, 30 Jun 2020 06:39:26 +0000 (08:39 +0200)]
Fix missing await
Change-Id: I64babbb51193d47122e34498f11b6d380b44a174
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Thu, 25 Jun 2020 15:18:31 +0000 (17:18 +0200)]
Fix model deletion
- Model deletion is failing with Juju 2.8
Change-Id: I6d7fc85ac9166a4eb7ff5851c231490400d64787
Signed-off-by: David Garcia <david.garcia@canonical.com>
Dominik Fleischmann [Mon, 29 Jun 2020 14:16:28 +0000 (16:16 +0200)]
Write to DB when creating K8s Proxy Charm
This commit adds a call to _write_ee_id_db so
that the DB is updated the same way as in LXD
Proxy Charms.
Change-Id: I7ecd815b1a5fbbb0b0222300da39ca99cb6ae584
Signed-off-by: Dominik Fleischmann <dominik.fleischmann@canonical.com>
Dominik Fleischmann [Tue, 9 Jun 2020 09:57:14 +0000 (11:57 +0200)]
8716 - K8s Proxy Charms
This commit enables the possibility to deploy
Proxy Charms on Kubernetes.
It depends on a new LCM environment variable
called `k8s_cloud` which will state the k8s name
in VCA that will be used for deploying the proxy
charms.
It will also check the k8s model for status
and delete the k8s model if it exists.
Finally it will now retry the verify ssh
credential action when the action fails, instead
of only retrying when a excpetion is launched.
Change-Id: I09510dcec00f747da945f88d54c2e25c1402d56c
Signed-off-by: Dominik Fleischmann <dominik.fleischmann@canonical.com>
David Garcia [Wed, 25 Mar 2020 17:19:02 +0000 (18:19 +0100)]
Feature 8720: Add scale support
Change-Id: Ie94521fb6a1ce0a765f9558de749f4f438cf8b93
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Fri, 19 Jun 2020 09:40:18 +0000 (11:40 +0200)]
Feature 8681: Add VCA HA capabilities
- juju watcher: fix exception handling when websocket is closed
- libjuju.py:
- Get vca endpoints from database (if exists)
- Update vca endpoints in database
- Get controller per operation (remove controller from class attribute)
- Add health check: Every 5 minutes the connection to the controller will be tested.
- Dockerfile: update it to 18.04
Change-Id: Ifa0a3a705d48fd736a9634b0722bdc914003b497
Signed-off-by: David Garcia <david.garcia@canonical.com>
beierlm [Wed, 24 Jun 2020 20:21:29 +0000 (22:21 +0200)]
Revert "Tox doesn't like -"
This reverts commit
d87303d18767a9c1d9d44357d1be392f41c3b723.
Reason for revert: This does not fix the problem. Underlying root cause still unknown.
Change-Id: I1f012bcf03c63cd12c24e1ede18620834a81c0a5
Signed-off-by: beierlm <mark.beierl@canonical.com>
Felipe Vicens [Thu, 25 Jun 2020 06:24:19 +0000 (08:24 +0200)]
Adding python3-pip stage2 dependency
Change-Id: I39e5e196fb598570ddd7376a0b280379546fa271
Signed-off-by: Felipe Vicens <felipe.vicens@atos.net>
beierlm [Wed, 24 Jun 2020 17:27:39 +0000 (13:27 -0400)]
Tox doesn't like -
Removing the - character from the pylinttests environment as the
version of tox available via the build process does not work with
that character.
Change-Id: I46cffef33f07b474598b2c0badf508ee3ea7fd45
Signed-off-by: beierlm <mark.beierl@canonical.com>
Dominik Fleischmann [Thu, 28 May 2020 12:33:22 +0000 (14:33 +0200)]
Use default Previous Work Dir if there is none
When the folder where the working dir was is deleted
an Exception is thrown. In that case a new default
directory is defined.
Change-Id: Ic0b3eb63625fc6cf6e90e9a77891c9958b6a9aee
Signed-off-by: Dominik Fleischmann <dominik.fleischmann@canonical.com>
(cherry picked from commit
cbf4b78798f1c6535fa7a7caaaa9235fb9dc8e8a)
tierno [Tue, 21 Apr 2020 13:22:26 +0000 (13:22 +0000)]
fix issue storing status of k8s_helm_conn
Change-Id: Iab7d4b7d1cc944fe4d23fb1455823d0eb6798b33
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
David Garcia [Wed, 13 May 2020 10:18:38 +0000 (12:18 +0200)]
Initial refactor of N2VC
- Add libjuju.py to encapsulate all code related with the communication using libjuju
- Replace juju_observer with juju_watcher
- Add utils with some utilities like EntityType, FinalStatus, and JujuStatusToOSM
Change-Id: I5d46ad65d6ed37b49bf2504209bfdd46d1b5a7e4
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Tue, 26 May 2020 17:27:03 +0000 (19:27 +0200)]
Install iptables-persistent if it doesn't exist
Change-Id: I7535e7ff3b74236cd3c7e752244252481582d557
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Tue, 26 May 2020 15:28:59 +0000 (17:28 +0200)]
Pin juju version to 2.8.1
Change-Id: Id40b3eeb698939131faf56fe008be335e6398cef
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Mon, 25 May 2020 14:23:20 +0000 (16:23 +0200)]
Get series from machine
Currently the series when deploying a charm is hardcoded to xenial, when it should be retrieved from the machine.
Change-Id: I2784290dde803e276a77775ee57879897b1c523c
Signed-off-by: David Garcia <david.garcia@canonical.com>
Dominik Fleischmann [Thu, 21 May 2020 11:55:19 +0000 (13:55 +0200)]
Ommit public_key argument if None
With newer Juju versions the authorized-keys
argument is expected to not be None, therefore it
now has to be ommited as an argument if thats the
case.
Change-Id: I0adeda2ce71df5505cfaaab98ec237611918d9e7
Signed-off-by: Dominik Fleischmann <dominik.fleischmann@canonical.com>
beierlm [Tue, 12 May 2020 19:26:37 +0000 (15:26 -0400)]
Change to sane default timeout
Changes the default timeout from ~28 hours to 1 hour.
Fixed syntax errors in two log messages.
Adds unit tests for timeouts.
Adds nose config to create Junit style output.
Fixes bug 1014
Change-Id: I7d1c2d28b397adc3ac638aa2366925dc744eade3
Signed-off-by: beierlm <mark.beierl@canonical.com>
David Garcia [Thu, 7 May 2020 10:28:05 +0000 (12:28 +0200)]
Fix credential_name
Change-Id: I7eeed36b2f4d4cc47e8b2de56abcecaee24706f3
Signed-off-by: David Garcia <david.garcia@canonical.com>
beierlm [Wed, 6 May 2020 16:05:16 +0000 (12:05 -0400)]
Adds skipdist back
The merge has been failing, probably due to unmaintained distribution
code for debian packages that are no longer needed. This patch
reinstates the skipdist step to tox.ini
Change-Id: Ia4134222f85075fda9e9a535493eb77ceabb855f
Signed-off-by: beierlm <mark.beierl@canonical.com>
David Garcia [Mon, 6 Apr 2020 10:42:26 +0000 (12:42 +0200)]
Fix bug 1050: Make provisioner asynchronous
Change-Id: I19a47abbea81deff64698a16715f5fd7c9e6e8e4
Signed-off-by: David Garcia <david.garcia@canonical.com>
beierlm [Tue, 5 May 2020 18:55:19 +0000 (14:55 -0400)]
Fix missing import
Import was removed for flake8 compliance, but it was
needed at runtime.
Change-Id: I2c1fce7b681582382c3c8f74267c3010bfcd97d6
Signed-off-by: beierlm <mark.beierl@canonical.com>
beierlm [Tue, 21 Apr 2020 20:36:35 +0000 (16:36 -0400)]
Enable lint, flake8 and unit tests
Cleans up non pep compliant code.
Adds a simple unit test.
Formats according to black.
Tox automatically runs lint, flake8 and unit test suite
with coverage. To run each individually, execute:
tox -e pylint
tox -e black
tox -e flake8
tox -e cover
Note that these are all run for each patch via Jenkins. The full
tox suite should be run locally before any commit to ensure it
will not fail in Jenkins.
Change-Id: I2f87abe3d5086d6d65ac33a27780c498fc7b1cd3
Signed-off-by: beierlm <mark.beierl@canonical.com>
David Garcia [Wed, 29 Apr 2020 10:34:23 +0000 (12:34 +0200)]
Check if cloud is built-in cloud when adding a model
Change-Id: Iad5f8e8f614898b2be38c6c40f97d6bbe97964cd
Signed-off-by: David Garcia <david.garcia@canonical.com>
Dominik Fleischmann [Mon, 6 Apr 2020 12:51:00 +0000 (14:51 +0200)]
K8s action support
This commit enables k8s actions by executing them the
same way as any other ns-action. It needs a mandatory
parameter which is application-name.
This commit depends on another commit in LCM.
https://osm.etsi.org/gerrit/#/c/osm/LCM/+/8767/
Change-Id: I375fb93d55f1255d425f229fe1a88968b19ae3d0
Signed-off-by: Dominik Fleischmann <dominik.fleischmann@canonical.com>
tierno [Tue, 7 Apr 2020 11:08:16 +0000 (11:08 +0000)]
adding optional namespace to K8s install
Change-Id: Ib433aff72f68f56359917a8a3716e6b798ea330b
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
tierno [Thu, 26 Mar 2020 09:51:11 +0000 (09:51 +0000)]
fix 1040 report error on failing delete_namespace
Do not capture asyncio.CancelledError
remove unneeded loging. e.g. certificates
Change-Id: Ia4f8c19bf693b689aeaaaeb76b006cd25c7295e1
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
David Garcia [Wed, 8 Apr 2020 11:23:07 +0000 (13:23 +0200)]
Raise N2VCNotFound exception in delete_namespace
Change-Id: I57d8ab115b4efdee65af2ca1e951463359ef81de
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Wed, 8 Apr 2020 07:48:21 +0000 (09:48 +0200)]
Add N2VCNotFound exception
Change-Id: I83702862086996adaefbfb9721f08f40bc943a44
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Wed, 1 Apr 2020 14:06:39 +0000 (16:06 +0200)]
Fix bug 1039: Add config to install_configuration_sw
Change-Id: I6545d0d425f6cd0f20c0cba049b6c828128ab66a
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Mon, 6 Apr 2020 10:55:23 +0000 (12:55 +0200)]
Fix bug 1049: Raise exception if model does not exist when destroying a model
Change-Id: I7bc64f296d6cff695511be77a5445241a1175d8a
Signed-off-by: David Garcia <david.garcia@canonical.com>
David Garcia [Mon, 6 Apr 2020 09:02:42 +0000 (11:02 +0200)]
Fix bug 1018
- Only destroy manually provisioned machines
- Fix in the observer: check if entity is not dead
- Destroy applications
Change-Id: I2b79585775572ed99aaa7ad7fe053bb33424163f
Signed-off-by: David Garcia <david.garcia@canonical.com>
Dominik Fleischmann [Thu, 26 Mar 2020 11:21:42 +0000 (12:21 +0100)]
Add local k8s charms support
This adds the support to deploy Kuberentes Charm
Bundles that are available locally (directly
inside the vnf descriptor).
Change-Id: Ib2e191df5f905ba909f935f2005347d2cf83da74
Signed-off-by: Dominik Fleischmann <dominik.fleischmann@canonical.com>