Browse Source

Upstream charm

Bring charm into alignment with other OpenStack charms.
Updates to requirements, tox, README and zuul.yaml.

Change-Id: I31565983ad8ede264f69997668b194c6f320689c
changes/46/689046/3
David Ames 2 years ago
parent
commit
e15346f46a
  1. 4
      .gitreview
  2. 5
      .zuul.yaml
  3. 7
      requirements.txt
  4. 2
      src/HACKING.md
  5. 62
      src/README.md
  6. 0
      src/files/.gitkeep
  7. 2
      src/layer.yaml
  8. 7
      src/test-requirements.txt
  9. 2
      src/tests/bundles/eoan.yaml
  10. 19
      src/tox.ini
  11. 16
      test-requirements.txt
  12. 27
      tox.ini
  13. 16
      unit_tests/test_lib_charm_openstack_mysql_router.py

4
.gitreview

@ -0,0 +1,4 @@
[gerrit]
host=review.opendev.org
port=29418
project=openstack/charm-mysql-router.git

5
.zuul.yaml

@ -0,0 +1,5 @@
- project:
templates:
- python35-charm-jobs
- openstack-python3-train-jobs
- openstack-cover-jobs

7
requirements.txt

@ -1,6 +1,7 @@
# This file is managed centrally. If you find the need to modify this as a
# one-off, please don't. Intead, consult #openstack-charms and ask about
# requirements management in charms via bot-control. Thank you.
# This file is managed centrally by release-tools and should not be modified
# within individual charm repos. See the 'global' dir contents for available
# choices of *requirements.txt files for OpenStack Charms:
# https://github.com/openstack-charmers/release-tools
#
# Build requirements
charm-tools>=2.4.4

2
src/HACKING.md

@ -4,7 +4,7 @@ This charm is developed as part of the OpenStack Charms project, and as such you
should refer to the [OpenStack Charm Development Guide](https://github.com/openstack/charm-guide) for details on how
to contribute to this charm.
You can find its source code here: <https://github.com/openstack-charmers/charm-mysql-router>.
You can find its source code here: <https://opendev.org/openstack/charm-mysql-router>
# To Do

62
src/README.md

@ -0,0 +1,62 @@
# Overview
This charm provides a MySQL 8 Router. The charm proxies database requests from
the principle application charm to a MySQL 8 InnoDB Cluster. MySQL Router
handles cluster communication and understands the cluster schema.
Ubuntu 19.10 or above is required.
# Usage
The charm is intended to be deployed as a subordinate charm on the
application server and related to the mysql-innodb-cluster charm.
## Cluster deployment
```
juju deploy mysql-router
```
The charm is related to a principle application charm via the
[shared-db relation](https://github.com/openstack/charm-interface-mysql-shared):
```
juju add-relation keystone:shared-db mysql-router:shared-db
```
The charm is then related to the [MySQL 8 InnoDB cluster charm](https://github.com/openstack-charmers/charm-mysql-innodb-cluster) via the
[db-router relation](https://github.com/openstack-charmers/charm-interface-mysql-router):
```
juju add-relation msyql-router:db-router mysql-innodb-cluster:db-router
```
## Scale out Usage
Scale out is accomplished by adding units to the principle charm:
```
juju add-unit keystone
```
## Known Limitations and Issues
> **Warning**: This charm is in preview state.
The charm is under active development and is not yet production ready. Its
current intended use is for validation of MySQL 8 InnoDB cluster for use with
OpenStack.
# Contact Information
OpenStack Charmers <openstack-charmers@lists.ubuntu.com>
## Upstream MySQL
- [Upstream documentation](https://dev.mysql.com/doc/mysql-router/8.0/en/)
# Bugs
Please report bugs on [Launchpad](https://bugs.launchpad.net/charm-mysql-router/+filebug).
For general questions please refer to the OpenStack [Charm Guide](https://docs.openstack.org/charm-guide/latest/).

0
src/files/.gitkeep

2
src/layer.yaml

@ -6,7 +6,7 @@ options:
basic:
use_venv: True
packages: [ 'libmysqlclient-dev']
repo: https://github.com/openstack-charmers/charm-mysql-router
repo: https://opendev.org/openstack/charm-mysql-router
config:
deletes:
- verbose

7
src/test-requirements.txt

@ -1,3 +1,8 @@
# zaza
# This file is managed centrally by release-tools and should not be modified
# within individual charm repos. See the 'global' dir contents for available
# choices of *requirements.txt files for OpenStack Charms:
# https://github.com/openstack-charmers/release-tools
#
# Functional Test Requirements (let Zaza's dependencies solve all dependencies here!)
git+https://github.com/openstack-charmers/zaza.git#egg=zaza
git+https://github.com/openstack-charmers/zaza-openstack-tests.git#egg=zaza.openstack

2
src/tests/bundles/eoan.yaml

@ -7,7 +7,7 @@ applications:
charm: ../../../mysql-router
mysql-innodb-cluster:
series: eoan
charm: cs:~thedac/mysql-innodb-cluster
charm: cs:~openstack-charmers-next/mysql-innodb-cluster
num_units: 3
options:
source: distro-proposed

19
src/tox.ini

@ -1,12 +1,22 @@
# Source charm (with zaza): ./src/tox.ini
# This file is managed centrally by release-tools and should not be modified
# within individual charm repos. See the 'global' dir contents for available
# choices of tox.ini for OpenStack Charms:
# https://github.com/openstack-charmers/release-tools
[tox]
envlist = pep8
skipsdist = True
# NOTE: Avoid build/test env pollution by not enabling sitepackages.
sitepackages = False
# NOTE: Avoid false positives by not skipping missing interpreters.
skip_missing_interpreters = False
[testenv]
setenv = VIRTUAL_ENV={envdir}
PYTHONHASHSEED=0
whitelist_externals = juju
passenv = HOME TERM CS_API_* OS_* AMULET_*
passenv = HOME TERM CS_* OS_* TEST_*
deps = -r{toxinidir}/test-requirements.txt
install_command =
pip install {opts} {packages}
@ -19,7 +29,7 @@ commands = charm-proof
[testenv:func-noop]
basepython = python3
commands =
true
functest-run-suite --help
[testenv:func]
basepython = python3
@ -31,5 +41,10 @@ basepython = python3
commands =
functest-run-suite --keep-model --smoke
[testenv:func-target]
basepython = python3
commands =
functest-run-suite --keep-model --bundle {posargs}
[testenv:venv]
commands = {posargs}

16
test-requirements.txt

@ -1,6 +1,7 @@
# This file is managed centrally. If you find the need to modify this as a
# one-off, please don't. Intead, consult #openstack-charms and ask about
# requirements management in charms via bot-control. Thank you.
# This file is managed centrally by release-tools and should not be modified
# within individual charm repos. See the 'global' dir contents for available
# choices of *requirements.txt files for OpenStack Charms:
# https://github.com/openstack-charmers/release-tools
#
# Lint and unit test requirements
flake8>=2.2.4,<=2.4.1
@ -11,3 +12,12 @@ mock>=1.2
nose>=1.3.7
coverage>=3.6
git+https://github.com/openstack/charms.openstack.git#egg=charms.openstack
#
# Revisit for removal / mock improvement:
netifaces # vault
psycopg2-binary # vault
tenacity # vault
pbr # vault
cryptography # vault, keystone-saml-mellon
lxml # keystone-saml-mellon
hvac # vault, barbican-vault

27
tox.ini

@ -1,18 +1,25 @@
# Source charm: ./tox.ini
# This file is managed centrally by release-tools and should not be modified
# within individual charm repos.
# within individual charm repos. See the 'global' dir contents for available
# choices of tox.ini for OpenStack Charms:
# https://github.com/openstack-charmers/release-tools
[tox]
skipsdist = True
envlist = pep8,py3
# NOTE: Avoid build/test env pollution by not enabling sitepackages.
sitepackages = False
# NOTE: Avoid false positives by not skipping missing interpreters.
skip_missing_interpreters = False
[testenv]
setenv = VIRTUAL_ENV={envdir}
PYTHONHASHSEED=0
TERM=linux
CHARM_LAYER_PATH={toxinidir}/layers
CHARM_INTERFACES_DIR={toxinidir}/interfaces
LAYER_PATH={toxinidir}/layers
INTERFACE_PATH={toxinidir}/interfaces
JUJU_REPOSITORY={toxinidir}/build
passenv = http_proxy https_proxy OS_*
passenv = http_proxy https_proxy INTERFACE_PATH LAYER_PATH JUJU_REPOSITORY
install_command =
pip install {opts} {packages}
deps =
@ -26,22 +33,22 @@ commands =
[testenv:py3]
basepython = python3
deps = -r{toxinidir}/test-requirements.txt
commands = stestr run {posargs}
commands = stestr run --slowest {posargs}
[testenv:py35]
basepython = python3.5
deps = -r{toxinidir}/test-requirements.txt
commands = stestr run {posargs}
commands = stestr run --slowest {posargs}
[testenv:py36]
basepython = python3.6
deps = -r{toxinidir}/test-requirements.txt
commands = stestr run {posargs}
commands = stestr run --slowest {posargs}
[testenv:py37]
basepython = python3.7
deps = -r{toxinidir}/test-requirements.txt
commands = stestr run {posargs}
commands = stestr run --slowest {posargs}
[testenv:pep8]
basepython = python3
@ -59,7 +66,7 @@ setenv =
PYTHON=coverage run
commands =
coverage erase
stestr run {posargs}
stestr run --slowest {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
@ -82,4 +89,4 @@ commands = {posargs}
[flake8]
# E402 ignore necessary for path append before sys module import in actions
ignore = E402
ignore = E402,W504

16
unit_tests/test_lib_charm_openstack_mysql_router.py

@ -420,10 +420,9 @@ class TestMySQLRouterCharm(test_utils.PatchHelper):
def test_proxy_db_and_user_requests_no_prefix(self):
mrc = mysql_router.MySQLRouterCharm()
mrc.proxy_db_and_user_requests(self.keystone_shared_db, self.db_router)
_calls = [mock.call('keystone', 'keystone',
self.keystone_unit_ip,
prefix=mrc._unprefixed)]
self.db_router.configure_proxy_db.assert_has_calls(_calls)
self.db_router.configure_proxy_db.assert_called_once_with(
'keystone', 'keystone', self.keystone_unit_ip,
prefix=mrc._unprefixed)
def test_proxy_db_and_user_requests_prefixed(self):
mrc = mysql_router.MySQLRouterCharm()
@ -434,7 +433,8 @@ class TestMySQLRouterCharm(test_utils.PatchHelper):
prefix="novaapi"),
mock.call('nova_cell0', 'nova', self.nova_unit_ip,
prefix="novacell0")]
self.db_router.configure_proxy_db.assert_has_calls(_calls)
self.db_router.configure_proxy_db.assert_has_calls(
_calls, any_order=True)
def test_proxy_db_and_user_responses_unprefixed(self):
_json_pass = '"pass"'
@ -499,7 +499,8 @@ class TestMySQLRouterCharm(test_utils.PatchHelper):
self.nova_shared_db.relation_id, mrc.shared_db_address, _pass,
None, prefix=_novacell0),
]
self.nova_shared_db.set_db_connection_info.assert_has_calls(_calls)
self.nova_shared_db.set_db_connection_info.assert_has_calls(
_calls, any_order=True)
# Allowed Units set correctly
self.nova_shared_db.set_db_connection_info.reset_mock()
@ -518,7 +519,8 @@ class TestMySQLRouterCharm(test_utils.PatchHelper):
self.nova_shared_db.relation_id, mrc.shared_db_address, _pass,
self.nova_unit_name, prefix=_novacell0),
]
self.nova_shared_db.set_db_connection_info.assert_has_calls(_calls)
self.nova_shared_db.set_db_connection_info.assert_has_calls(
_calls, any_order=True)
# Confirm msyqlrouter credentials are not sent over the shared-db
# relation

Loading…
Cancel
Save