Commit Graph

46 Commits

Author SHA1 Message Date
Samuel Walladge d8d8963667 Wait for management interface IP to be assigned
There can be a delay between the interface being created,
and an IP address getting assigned,
which previously caused a race condition where
the config could be rendered before the IP address was ready
resulting in the health manager bind_ip to be empty.

This ensures that the IP address will be ready before continuing,
which will ensure that the config rendering will not happen until ready,
and the configure-resources action will only return once it's all done.

Closes-Bug: #1961088
Change-Id: I2cae5f0e307c8cd14f1831f3416d890ad604b705
2023-09-28 08:39:14 +09:30
Edward Hope-Morley f326ef267a Ensure mgmt network mtu
This will ensure that mtu is set whenever setup_hm_port()
is called regardless of if the port has just been created
or not. Also checks mtu in update-status hook.

Change-Id: I80b5cea812becd1724fcfe2a8a232253eac76735
Closes-Bug: #2018998
2023-06-09 17:01:08 +01:00
Corey Bryant e237d6621e Ensure upgrades are executed
Prior to this change, big bang upgrades were not being run
when openstack-origin was updated to a new release.

Closes-Bug: #1979553
Change-Id: I5cda72d55b7aba51d087bababa94435e53c2201b
2022-10-04 13:14:42 +00:00
David Ames dbee693a16 Add NRPE Check for Octavia Certificates
Change-Id: Ie4718b2c145e977fd11fff06ed3e854d41715eb8
Closes-Bug: 1885815
2022-04-04 09:51:24 +02:00
Alex Kavanagh 736e243bb9 Update to build using charmcraft
Due to a build problem with the reactive plugin, this change falls back
on overriding the steps and doing a manual build, but it also ensures
the CI system builds the charm using charmcraft.  Changes:

- add a build-requirements.txt
- modify charmcraft.yaml
- modify osci.yaml
    -> indicate build with charmcraft
- modify tox.ini
    -> tox -e build does charmcraft build/rename
    -> tox -e build-reactive does the reactive build
- modify bundles to use the <charm>.charm artifact in tests.
  and fix deprecation warning re: prefix
- tox inception to enable tox -e func-test in the CI
- Unit test fix

Depends-On: https://review.opendev.org/c/openstack/charm-keystone/+/830986
Depends-On: https://review.opendev.org/c/openstack/charm-interface-keystone/+/830988
Change-Id: Iadd11634d1fe44731ecf0a6104561b4aeebff23f
Co-authored-by: Aurelien Lourot <aurelien.lourot@canonical.com>
2022-04-02 12:03:51 +01:00
Hervé Beraud 49b7a2348f Use unittest.mock instead of mock
The mock third party library was needed for mock support in py2
runtimes. Since we now only support py36 and later, we can use the
standard lib unittest.mock module instead.

Note that https://github.com/openstack/charms.openstack is used during tests
and he need `mock`, unfortunatelly it doesn't declare `mock` in its
requirements so it retrieve mock from other charm project (cross dependency).
So we depend on charms.openstack first and when
Ib1ed5b598a52375e29e247db9ab4786df5b6d142 will be merged then CI
will pass without errors.

Depends-On: Ib1ed5b598a52375e29e247db9ab4786df5b6d142
Change-Id: Ib9cd965d84654a4ff3a5c24814d8a171865b2db1
2021-12-16 09:12:41 +00:00
Zhang Hua cc292d72e2 Delete hm port on unit removal
JUJU_DEPARTING_UNIT will be set in leader unit as well when removing one
unit, so update_controller_ip_port_list can use it to delete hm port and
update neutron ip list. Besides, cluster.{connected,available} will be
set by interface-openstack-ha when relation-{broken,departed} is changed,
so update_controller_ip_port_list will also have a change to run.
In other words, as long as update_controller_ip_port_list is triggered
for various reasons, the cleanup will be completed.

and pin cffi to 1.14.6 and pyparsing<3.0.0 for python < 3.6

Closes-Bug: 1915512
Func-Test-Pr: https://github.com/openstack-charmers/zaza-openstack-tests/pull/600
Change-Id: I88c61b8d2d0b573df7df071ed7978e83b6803c5c
2021-11-09 09:28:39 +08:00
Billy Olsen 07b5dc8ea8 Handle create_router when network and subnet exist
Subnets were not assigned if they already existed and were not created,
but the router creation code for the configure-resources depends on the
subnets variable for iteration. Initialize the subnets from the query
for the subnets for the case of existing subnets.

Additionally, the octavia charm uses a service user which can see other
subnets that are tagged 'charm-octavia'. Narrow the scope of the subnet
listing to the network being used by the charm.

Closes-Bug: #1866126
Change-Id: Id88a68a398a50532e11daff33fb774caf65a0c0a
Co-authored-by: Aurelien Lourot <aurelien.lourot@canonical.com>
2021-09-09 16:31:41 +02:00
Frode Nordahl 1dfabe091b Make Amphora provider driver optional
Octavia supports multiple provider drivers. The reference Amphora
provider driver is distributed as part of the Octavia software,
and is enabled by default.

Add a configuration option which allows to not enable the Amphora
provider driver. This is useful for use cases where a different
driver is desired, and removes the checks for Amphora related
mandatory configuration options.

Change-Id: I4d14056bf901d813ac53fde9ccd4e8bdb56e3c55
2021-07-06 10:30:07 +02:00
Frode Nordahl 762bfc6b29 Confirm operational status of mgmt port
Put charm into a blocked state if the unit local port to mgmt.
network does not come up.

Add workaround in functional test that allows to re-enable
bionic-ussuri gate. Drop proposed from bionic-ussuri
bundles.

Closes-Bug: #1893446
Change-Id: I098e449723bce128e8c2efda1e9fafc9156a71e5
2021-06-03 16:15:34 +02:00
Frode Nordahl d5b9859741
Enable OVN L4 provider from Victoria onward
The driver is unreliable at Ussuri.

Also ensure we restart the ovn-driver-agent when configuration is
written to disk.

Ensure Port Security is enabled as this is a requirement for
reliable operation of the Amphora driver also exercised by the
functional tests.

Enable focal/groovy-victoria gates and re-enable Ussuri OVS gate.

Closes-Bug: #1927960
Closes-Bug: #1927962
Related-Bug: #1927959
Change-Id: I1bafd9eecb83aefb425bc5286f23d47c0885ac8e
2021-06-02 17:19:09 +02:00
Zuul 307da842f4 Merge "Move lookup of per-unit Neutron port to common helper" 2021-03-08 18:01:47 +00:00
Frode Nordahl a00bb7ab0d Move lookup of per-unit Neutron port to common helper
Change-Id: Iba22bc9f4aa8f9c231f606ebb9b40d79272a95e8
2021-03-08 14:54:59 +00:00
Alex Kavanagh 22f4ae5d02 Ensure octavia-driver-agents gets installed
Due to a 'quirk' being fixed, the octavia-driver-agents don't get
installed if the ovsdb-subordinate  relation is the last to be made.
This is due to the update-status hook gating the reactive handler from
running which 'fixed' the issue.  Looking deeper, if the handler isn't
the first to run, then the charm's packages won't get initialised
properly.

This patch fixes that by using the dynamic properties 'all_packages' and
'full_service_list' available in charms.openstack core for the Charm
class.  This means that it doesn't matter when the flag is set, as long
as it is before the property is accessed.  Looking at the handler, this
will be in the right place for the install.

func-test-pr: https://github.com/openstack-charmers/zaza-openstack-tests/pull/514

Change-Id: I5fd75c9d371390bca402d6a3a264421a44fd092a
Closes-Bug: #1916764
2021-03-08 14:20:58 +00:00
Edward Hope-Morley 6e8468a896 Fix o-hm0 port creation from action
Defer hm port setup to main charm code instead of
doing it as part of action. This means we get to
avoid the error prone action method of creating
the port.

Closes-Bug: #1902765

Change-Id: Ieab07308103c791f899ec9cb8066283540f9d96e
2020-11-05 12:06:54 +00:00
Alex Kavanagh 4779fe5d7a Gate reactive handlers on update-status
This patch gates many of the 'active' handlers when the update-status
hook is running.  This is to prevent the charm from making changes to
services, re-rendering configs, or updating relations (or attempting to
act on them) during an update-status hook.  This also speeds up the
update status so that it only does checking.  The related bug is an
example of what can happen if handlers are not masked during
update-status.

Change-Id: Ibabc74f9cd8c0130bcea76c455c179af31bc96a7
Related-Bug: #1895628
2020-09-15 10:37:02 +01:00
Zuul a8f1bc774a Merge "Stop to use the __future__ module." 2020-07-13 05:45:40 +00:00
Facundo Ciccioli 8e08c56935 Clear Nagios' related config.changed flags after handling
The docs says that those flags are currently being cleared by the
framework but that this behavior might change in the future. Hence,
clear the flags to allow for changing those configs several times.

Change-Id: Ia3d40cf128a0a5e7f59b1644cbb4f318b398720e
2020-06-11 11:19:02 +02:00
FaQ 283521f62a Add basic, running services only, NRPE support to the charm
Change-Id: Ib4b0dc8c47b77ec80845bd8987ebba11388604ab
Closes-Bug: #1871655
2020-06-10 15:11:50 +02:00
Hervé Beraud 6755b83c8c Stop to use the __future__ module.
The __future__ module [1] was used in this context to ensure compatibility
between python 2 and python 3.

We previously dropped the support of python 2.7 [2] and now we only support
python 3 so we don't need to continue to use this module and the imports
listed below.

Imports commonly used and their related PEPs:
- `division` is related to PEP 238 [3]
- `print_function` is related to PEP 3105 [4]
- `unicode_literals` is related to PEP 3112 [5]
- `with_statement` is related to PEP 343 [6]
- `absolute_import` is related to PEP 328 [7]

[1] https://docs.python.org/3/library/__future__.html
[2] https://governance.openstack.org/tc/goals/selected/ussuri/drop-py27.html
[3] https://www.python.org/dev/peps/pep-0238
[4] https://www.python.org/dev/peps/pep-3105
[5] https://www.python.org/dev/peps/pep-3112
[6] https://www.python.org/dev/peps/pep-0343
[7] https://www.python.org/dev/peps/pep-0328

Change-Id: I851d79d6a2df0ba82fd0e42e8c13f95238451934
2020-06-02 20:02:30 +02:00
Frode Nordahl 167d7d9cd0
Consume ovn-octavia-provider package on Ussuri and Focal
Remove tactical workarounds for missing binary packages that are
now present in both Ussuri UCA and Focal.

Update test-requirements and improve mocking, unpin flake8 to
allow lint to run on Python 3.8 systems.

Change-Id: I195c8c796a52eadf288f0927f2f41166a5768640
2020-04-18 10:57:57 +02:00
Frode Nordahl ab22820503
Point API clients at internal endpoints when configured
At present the ``use-internal-endpoints`` configuration option
have no effect.

Change-Id: Ia85609f70819b27241e43de27614624697622370
Closes-Bug: #1869463
2020-03-31 08:32:32 +02:00
Frode Nordahl 5127093946
Add Octavia OVN provider driver support
For use cases that do not require TLS termination or load balancing
based on higher layer characteristics, there is a Octavia OVN provider
driver that delegates load balancing to the network itself and does
not require VMs to handle the traffic.

Use the common ``parts/section-keystone-authtoken`` for keystone
auth in templates.

Change-Id: I1b9704c9e040eef821cef1e4f16faa0b18dce85e
2020-02-19 14:35:35 +01:00
Frode Nordahl c1e86dcb4a
Enable use of OVN for plumbing to octavia units
Depends-On: Ia304cd25dbdd130338837f149a79efe59681f794
Change-Id: I9ef24e5256ad32e7593a601fb9b79a04747d0a2e
2020-02-19 11:55:38 +01:00
Frode Nordahl a7c57aa732
Remove reference to deprecated novaclient.exception
The ``ConnectionRefused`` exception was removed from
``python-novaclient`` in the following commit:
81ec72ecf8c32b409afedc60e013f9b4c47d5bae

Change-Id: I3c7540e53f6ddbf4dcc9736bae72e27b7d6fdd27
Closes-Bug: #1863071
2020-02-13 11:08:42 +01:00
Edward Hope-Morley cbc8841661 Add support for setting amphora ssh key
Allows a public key to be added to Amphora instances
to allow ssh access for e.g. debug purposes.

Without the ability to have amphora vms allow ssh access,
it can be impossible to debug issues that occur inside
the vm since it is not possible to modify an existing
image or vm without the vm being recreated. Adding
support for providing a key allows admins to have the
option to access amphora vms should something go
wrong. The default remains to not provide access.

Change-Id: I1d91741eeec9b20b80bbb907a8aeb9166831acbe
Closes-Bug: #1843625
2020-01-10 10:16:15 +00:00
Thobias Salazar Trevisan 3e63d79199 Add support to openstack multi region configuration
When using Octavia with more than one Openstack Region, it does not found
resources (network, neutron port and ip). It is necessary to specify the
region it should search for network and other resources with tag
charm-octavia.

This patch add support to specify region to search for tagged resources.

Change-Id: I33d362840efc8fe2f64e41678a1790557ed268dd
Closes-Bug: #1854365
2019-11-29 12:57:24 -03:00
Andrew McLeod 0b31603894 Add legacy configure_ssl
Add legacy configure_ssl to octavia_handlers
Pin pyparsing to 2.4.2 in wheelhouse.txt
Update render unit test

Closes-Bug: 1851487
Change-Id: I4dd055d43e62556692dca3f58f255769dab95287
2019-11-06 17:35:51 +01:00
Frode Nordahl 901df0e1f1 Use hostname from ovs relation when available
When creating a Neutron port the value of ``binding:host_id`` needs
to match the host identity of the Neutron OpenvSwitch subordinate.

Depends-On: I3b11eec3f1c4b8a673ccb6f9e6320d79dbde8f7a
Change-Id: I6bec4c5a5dade1295414ff8eefc070e2e8127f37
Closes-Bug: #1845303
2019-10-02 18:15:22 +02:00
Frode Nordahl afd84ccbc0 Use a centralized network for the management network
Change-Id: Iafdc810ac403243aaf2ae2380003d79fb6d96a40
Related-Bug: #1843557
2019-10-02 18:15:22 +02:00
Frode Nordahl 2b67e790a7
Enable default certificates handler
Previously the default ``certificates.available`` handler was
enabled without the charm authors intervention, this was changed
in I12f45236632b608e07fdd35d31b90b84ca92eb1f.

Change-Id: I4c1c7f6ba64c55cdceed52bb2c8c882190b96a91
2019-09-03 10:24:07 +02:00
Frode Nordahl 52af8d8d6d
Fix use of Neutron port ``device_owner`` field
Adapt functional test bundles to test with DVR.

Closes-Bug: #1813931
Change-Id: I61466dceb22d4dc769716a4ab1a738525ce67518
2019-07-19 14:26:16 +02:00
Frode Nordahl 35dcc3dd86
Enable bionic/stein functional tests
Add missing default ``upgrade-charm`` reactive handler.

Change-Id: I735741c5ad9b62a8ed182bce9a3b39b2a2e062cd
2019-04-10 12:00:24 +02:00
Frode Nordahl d011c6b1eb Use hostname of machine for ``binding_host_id``
The current implementation relies on DNS to resolve the hostname
associated with the ``private-address`` IP of the unit.

This does not always provide a reliable result.

Change-Id: I3a3a3cddd35354944196a155ca0b239e680333d3
Closes-Bug: #1823000
2019-04-03 15:15:59 +02:00
Frode Nordahl 69dfed11ac
Use system CA Certificate bundle when configuring resources
The charm bundles its dependencies to avoid the boundary
violation of the charm being dependent on the software it
manages.

As a side effect the charm will not use the distro packaged
version of ``python3-certifi`` which contains a patch [0] to
make consumers load the system wide CA Certificate bundle.

As a workaround we explicitly point our OpenStack client
operations to the system wide bundle.

0: https://git.launchpad.net/ubuntu/+source/python-certifi/tree/debian/patches/0001-Use-Debian-provided-etc-ssl-certs-ca-certificates.cr.patch

Change-Id: Iad466c7ff6cf680f74168852afea4a67815d0249
Closes-Bug: #1819205
2019-03-12 10:28:41 +01:00
Frode Nordahl f06a3fc78f
Request roles from Keystone on endpoint registration
Change-Id: Ic876a09b046a49b7dedc5e41f831eabd73bb0cde
Closes-Bug: #1813602
Depends-On: https://review.openstack.org/#/c/633532/
2019-01-28 16:54:43 +01:00
James Page cc464bc38c Add pooling support for Amphorae
Add configuration option and associated template updates to
support pooling of spare Amphorae to reduce load balancer
service creation time.

Change-Id: Idb49b632c5728c2bbace4124897fde7369cb803e
2018-12-05 10:05:43 +00:00
Frode Nordahl a562b391bd
Add action for configuring mgmt network for comms with lb instances
End user is expected to run the `configure-resources` action
after the deployment is complete and the cloud APIs are
reliably available.

The end user may rely on our defaults or may create the
required resources themselves.  The same action is used to
prompt configuration of the Octavia service and whether it
does creation or just discovery depends on the setting of
`create-mgmt-network` and `custom-amp-flavor-id` configuration
options.

Switch to using the more recent ``section-database`` part
for database configuration.

Change-Id: I9529a8a633ef0ba696c22570ec388991ba408ac4
2018-12-04 16:11:53 +01:00
Frode Nordahl 3f1480e8c9 Add Nova flavor management
Manage the Nova flavor Octavia should use when launching its instances.

The end user may choose to override this by manually creating the
flavor and configure it through the ``custom-amp-flavor-id``
configuration option.

Change-Id: Id2cbbc2936996c689fb5a2221a9d22ecf93f510e
2018-12-03 13:44:36 +01:00
Frode Nordahl d2d01a7f76
Add ``neutron-load-balancer`` interface
Send name and URL down the relation to make ``neutron-api``
configure and point the ``lbaasv2-proxy`` service at us.

Change-Id: Ib013afdd7a0b635ab65de8d1cd2f5e83512a6a2a
2018-10-31 11:51:21 +01:00
Frode Nordahl 5c4553e641
Add custom property for ``heartbeat_key``
Change-Id: Icd328e0b75cfb712b1519a6e2184b8ca0b6b137f
2018-10-25 14:43:58 +02:00
Frode Nordahl dbf447025c
Configure HA resources when HA-relation complete
Also add some missing unit tests
2018-10-10 08:14:59 +02:00
Frode Nordahl 87b96027c4
Fix failing TestRegisteredHooks.test_hooks unit test 2018-10-10 07:01:44 +02:00
Frode Nordahl 975e80d99f
Remove non-existent optional interface from unit test 2018-10-09 15:54:36 +02:00
Frode Nordahl e019403088
Add basic charm implementation
Remove ``.zuul.yaml`` awaiting import
2018-10-09 15:46:29 +02:00
Frode Nordahl 9d835f1ae2
Initial commit of charm skeleton 2018-10-09 14:35:45 +02:00