charm cleanup

Following changes are done as part of this patch:

rename sunbeam import library to ops_sunbeam
update documentation
add fetch-libs in tox.ini
This commit is contained in:
Hemanth Nakkina 2022-07-19 13:59:21 +05:30
parent d690335b0e
commit a0343c3ca5
10 changed files with 122 additions and 39 deletions

View File

@ -1,4 +1,4 @@
# sunbeam-ovn-relay-operator
# ovn-relay-k8s
## Developing
@ -10,21 +10,24 @@ Create and activate a virtualenv with the development requirements:
## Code overview
TEMPLATE-TODO:
One of the most important things a consumer of your charm (or library)
needs to know is what set of functionality it provides. Which categories
does it fit into? Which events do you listen to? Which libraries do you
consume? Which ones do you export and how are they used?
Get familiarise with [Charmed Operator Framework](https://juju.is/docs/sdk)
and [Sunbeam documentation](sunbeam-docs).
ovn-relay-k8s charm uses the ops_sunbeam library and extends
OSBaseOVNOperatorCharm from the library.
ovn-relay-k8s charm consumes certificates to get generated
certificates from vault and ovsdb-cms relation to get
ovn-central endpoints.
## Intended use case
TEMPLATE-TODO:
Why were these decisions made? What's the scope of your charm?
ovn-relay-k8s charm deploys and configures OVN OVSDB relay service
on a kubernetes based environment.
## Roadmap
If this Charm doesn't fulfill all of the initial functionality you were
hoping for or planning on, please add a Roadmap or TODO here
TODO
## Testing
@ -32,3 +35,20 @@ The Python operator framework includes a very nice harness for testing
operator behaviour without full deployment. Just `run_tests`:
./run_tests
## Deployment
This project uses tox for building and managing. To build the charm
run:
tox -e build
To deploy the local test instance:
tox -e build
juju add-model ovn-relay
juju deploy ./ovn-relay-k8s_ubuntu-20.04-amd64.charm --resource ovn-sb-db-server-image=registry.jujucharms.com/charm/kau2b145zhaeuj5ly4w4m30qiq8qzspf93tnd/ovn-sb-db-server-image
<!-- LINKS -->
[sunbeam-docs]: https://github.com/openstack-charmers/advanced-sunbeam-openstack/blob/main/README.rst

View File

@ -1,24 +1,61 @@
# sunbeam-ovn-relay-operator
# ovn-relay-k8s
## Description
TODO: Describe your charm in a few paragraphs of Markdown
The ovn-relay-k8s is an operator to manage the OVN ovsdb
relay service on a kubernetes based environment.
## Usage
TODO: Provide high-level usage, such as required config or relations
### Deployment
ovn-relay-k8s is deployed using below command:
juju deploy ovn-relay-k8s ovn-relay
Now connect the ovn-relay application to vault to generate
certificates.
juju relate vault:certificates ovn-relay:certificates
### Configuration
This section covers common and/or important configuration options. See file
`config.yaml` for the full list of options, along with their descriptions and
default values. See the [Juju documentation][juju-docs-config-apps] for details
on configuring applications.
### Actions
This section covers Juju [actions][juju-docs-actions] supported by the charm.
Actions allow specific operations to be performed on a per-unit basis. To
display action descriptions run `juju actions ovn-relay`. If the charm is not
deployed then see file `actions.yaml`.
## Relations
TODO: Provide any relations which are provided or required by your charm
ovn-relay-k8s requires the following relations:
`certificates`: To retrieve generated certificates from vault
`ovsdb-cms`: To retrieve ovn-central IPs from ovn-central
## OCI Images
TODO: Include a link to the default image your charm uses
The charm by default uses `registry.jujucharms.com/charm/kau2b145zhaeuj5ly4w4m30qiq8qzspf93tnd/ovn-sb-db-server-image` image.
## Contributing
Please see the [Juju SDK docs](https://juju.is/docs/sdk) for guidelines
on enhancements to this charm following best practice guidelines, and
`CONTRIBUTING.md` for developer guidance.
[CONTRIBUTING.md](contributors-guide) for developer guidance.
## Bugs
Please report bugs on [Launchpad][lp-bugs-charm-ovn-relay-k8s].
<!-- LINKS -->
[contributors-guide]: https://github.com/openstack-charmers/charm-ovn-relay-operator/blob/main/CONTRIBUTING.md
[juju-docs-actions]: https://jaas.ai/docs/actions
[juju-docs-config-apps]: https://juju.is/docs/configuring-applications
[lp-bugs-charm-ovn-relay-k8s]: https://bugs.launchpad.net/charm-ovn-relay-k8s/+filebug

View File

@ -1,4 +1,4 @@
# Copyright 2022 liam
# Copyright 2022 Canonical Ltd.
# See LICENSE file for licensing details.
#

5
fetch-libs.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
echo "INFO: Fetching libs from charmhub."
charmcraft fetch-lib charms.observability_libs.v0.kubernetes_service_patch
charmcraft fetch-lib charms.sunbeam_ovn_central_operator.v0.ovsdb

View File

@ -1,8 +1,12 @@
name: sunbeam-ovn-relay-operator
name: ovn-relay-k8s
summary: Relay for Open Virtual Network for Open vSwitch
maintainer: OpenStack Charmers <openstack-charmers@lists.ubuntu.com>
description: |
In sert description
The charm that deploys OVSDB Relay service.
The OVSDB Relay handles all read-only requests and forwards
transactions that requires database modifications to ovsdb
server.
tags:
- networking

View File

@ -3,10 +3,9 @@ jinja2
# Get resources from github until cacerts issue is charmbuild image is fixed.
# git+https://opendev.org/openstack/charm-ops-openstack#egg=ops_openstack
# git+https://opendev.org/openstack/charm-ops-interface-tls-certificates#egg=interface_tls_certificates
git+https://github.com/openstack/charm-ops-openstack#egg=ops_openstack
git+https://github.com/openstack/charm-ops-interface-tls-certificates#egg=interface_tls_certificates
git+https://github.com/openstack-charmers/advanced-sunbeam-openstack@v0.1#egg=advanced_sunbeam_openstack
git+https://github.com/openstack-charmers/advanced-sunbeam-openstack#egg=ops_sunbeam
lightkube
lightkube-models
cryptography < 3.4

View File

@ -1,5 +1,5 @@
#!/bin/sh -e
# Copyright 2022 liam
# Copyright 2022 Canonical Ltd.
# See LICENSE file for licensing details.
if [ -z "$VIRTUAL_ENV" -a -d venv/ ]; then

View File

@ -1,6 +1,18 @@
#!/usr/bin/env python3
# Copyright 2022 liam
# See LICENSE file for licensing details.
#
# Copyright 2022 Canonical Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Learn more at: https://juju.is/docs/sdk
@ -18,10 +30,10 @@ from typing import List
from ops.framework import StoredState
from ops.main import main
import advanced_sunbeam_openstack.config_contexts as sunbeam_ctxts
import advanced_sunbeam_openstack.ovn.container_handlers as ovn_chandlers
import advanced_sunbeam_openstack.ovn.config_contexts as ovn_ctxts
import advanced_sunbeam_openstack.ovn.charm as ovn_charm
import ops_sunbeam.config_contexts as sunbeam_ctxts
import ops_sunbeam.ovn.container_handlers as ovn_chandlers
import ops_sunbeam.ovn.config_contexts as ovn_ctxts
import ops_sunbeam.ovn.charm as ovn_charm
logger = logging.getLogger(__name__)

View File

@ -18,7 +18,7 @@ skip_missing_interpreters = False
requires = pip < 20.3
virtualenv < 20.0
# NOTE: https://wiki.canonical.com/engineering/OpenStack/InstallLatestToxOnOsci
minversion = 3.2.0
minversion = 3.18.0
[testenv]
setenv = VIRTUAL_ENV={envdir}
@ -35,6 +35,12 @@ whitelist_externals =
passenv = HOME TERM CS_* OS_* TEST_*
deps = -r{toxinidir}/test-requirements.txt
[testenv:fetch]
basepython = python3
deps =
commands =
./fetch-libs.sh
[testenv:py3.8]
basepython = python3.8
deps = -r{toxinidir}/requirements.txt
@ -83,6 +89,7 @@ omit =
.tox/*
*/charmhelpers/*
unit_tests/*
src/templates/*
[testenv:venv]
basepython = python3

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python3
# Copyright 2021 Canonical Ltd.
# Copyright 2022 Canonical Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -20,7 +20,7 @@ sys.path.append('lib') # noqa
sys.path.append('src') # noqa
import charm
import advanced_sunbeam_openstack.test_utils as test_utils
import ops_sunbeam.test_utils as test_utils
class _OVNRelayXenaOperatorCharm(charm.OVNRelayXenaOperatorCharm):
@ -59,11 +59,10 @@ class TestOVNRelayXenaOperatorCharm(test_utils.CharmTestCase):
self.assertEqual(self.harness.charm.seen_events, [])
test_utils.set_all_pebbles_ready(self.harness)
test_utils.add_all_relations(self.harness)
self.assertEqual(
sorted(list(set(
self.container_calls.updated_files('ovsdb-server')))),
[
'/etc/ovn/cert_host',
'/etc/ovn/key_host',
'/etc/ovn/ovn-central.crt',
'/root/ovn-relay-wrapper.sh'])
ovsdb_config_files = [
'/etc/ovn/cert_host',
'/etc/ovn/key_host',
'/etc/ovn/ovn-central.crt',
'/root/ovn-relay-wrapper.sh']
for f in ovsdb_config_files:
self.check_file('ovsdb-server', f)