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 10:57:35 +05:30
parent 350b18c651
commit daf9d6408c
12 changed files with 122 additions and 5417 deletions

View File

@@ -1,4 +1,4 @@
# sunbeam-nova-operator
# nova-k8s
## Developing
@@ -10,21 +10,29 @@ 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).
nova-k8s charm uses the ops_sunbeam library and extends
OSBaseOperatorAPICharm from the library.
nova-k8s charm consumes shared-db relation to connect to database,
identity-service to register the service endpoints to keystone
and ingress-internal/ingress-public relation to get exposed over
internal and public networks.
nova-k8s charm brings up nova-api, nova-scheduler, nova-conductor
services by creating separate peblle handlers for each service which
in turn creates separate container within same pod.
## Intended use case
TEMPLATE-TODO:
Why were these decisions made? What's the scope of your charm?
nova-k8s charm deploys and configures OpenStack Nova 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 +40,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 nova
juju deploy ./nova-k8s_ubuntu-20.04-amd64.charm --resource nova-api-image=kolla/ubuntu-binary-nova-api:xena --resource nova-scheduler-image=kolla/ubuntu-binary-nova-scheduler:xena nova-conductor-image=kolla/ubuntu-binary-nova-condcutor:xena
<!-- LINKS -->
[sunbeam-docs]: https://github.com/openstack-charmers/advanced-sunbeam-openstack/blob/main/README.rst

View File

@@ -1,24 +1,69 @@
# sunbeam-nova-operator
# nova-k8s
## Description
TODO: Describe your charm in a few paragraphs of Markdown
The nova-k8s is an operator to manage the nova control services
on a kubernetes based environment.
## Usage
TODO: Provide high-level usage, such as required config or relations
### Deployment
nova-k8s is deployed using below command:
juju deploy nova-k8s nova --trust
Now connect the nova application to an existing database,
amqp and keystone identity.
juju relate mysql:database nova:shared-db
juju relate rabbitmq:amqp nova:amqp
juju relate keystone:identity-service nova:identity-service
### 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 nova`. If the charm is not
deployed then see file `actions.yaml`.
## Relations
TODO: Provide any relations which are provided or required by your charm
nova-k8s requires the following relations:
`shared-db`: To connect to the database
`amqp`: To connect to rabbitmq
`identity-service`: To register endpoints in keystone
`ingress-internal`: To expose service on underlying internal network
`ingress-public`: To expose service on public network
## OCI Images
TODO: Include a link to the default image your charm uses
The charm by default uses following images:
`docker.io/kolla/ubuntu-binary-nova-api:xena`
`docker.io/kolla/ubuntu-binary-nova-scheduler:xena`
`docker.io/kolla/ubuntu-binary-nova-conductor:xena`
## Contributing
Please see the [Juju SDK docs](https://juju.is/docs/sdk) for guidelines
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-nova-k8s].
<!-- LINKS -->
[contributors-guide]: https://github.com/openstack-charmers/charm-nova-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-nova-k8s]: https://bugs.launchpad.net/charm-nova-k8s/+filebug

10
fetch-libs.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/bash
echo "INFO: Fetching libs from charmhub."
charmcraft fetch-lib charms.nginx_ingress_integrator.v0.ingress
charmcraft fetch-lib charms.sunbeam_mysql_k8s.v0.mysql
charmcraft fetch-lib charms.sunbeam_keystone_operator.v0.identity_service
charmcraft fetch-lib charms.sunbeam_rabbitmq_operator.v0.amqp
charmcraft fetch-lib charms.observability_libs.v0.kubernetes_service_patch
charmcraft fetch-lib charms.traefik_k8s.v0.ingress
charmcraft fetch-lib charms.sunbeam_nova_compute_operator.v0.cloud_compute

View File

@@ -26,7 +26,7 @@ Two events are also available to respond to:
A basic example showing the usage of this relation follows:
```
from charms.sunbeam_sunbeam_identity_service_operator.v0.identity_service import IdentityServiceRequires
from charms.sunbeam_keystone_operator.v0.identity_service import IdentityServiceRequires
class IdentityServiceClientCharm(CharmBase):
def __init__(self, *args):

View File

@@ -1,4 +1,4 @@
name: sunbeam-nova-operator
name: nova-k8s
summary: OpenStack Compute - Nova cloud controller service
maintainer: OpenStack Charmers <openstack-charmers@lists.ubuntu.com>
description: |

View File

@@ -3,10 +3,10 @@ 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-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#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 2021 Canonical Ltd.
# See LICENSE file for licensing details.
if [ -z "$VIRTUAL_ENV" -a -d venv/ ]; then

View File

@@ -13,11 +13,11 @@ import ops.framework
from ops.main import main
from ops.pebble import ExecError
import advanced_sunbeam_openstack.charm as sunbeam_charm
import advanced_sunbeam_openstack.core as sunbeam_core
import advanced_sunbeam_openstack.container_handlers as sunbeam_chandlers
import advanced_sunbeam_openstack.relation_handlers as sunbeam_rhandlers
import advanced_sunbeam_openstack.config_contexts as sunbeam_ctxts
import ops_sunbeam.charm as sunbeam_charm
import ops_sunbeam.core as sunbeam_core
import ops_sunbeam.container_handlers as sunbeam_chandlers
import ops_sunbeam.relation_handlers as sunbeam_rhandlers
import ops_sunbeam.config_contexts as sunbeam_ctxts
import charms.sunbeam_nova_compute_operator.v0.cloud_compute as cloud_compute

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,3 @@
[keystone_authtoken]
{% if identity_service.internal_auth_url -%}
www_authenticate_uri = {{ identity_service.internal_auth_url }}
auth_url = {{ identity_service.internal_auth_url }}
@@ -12,3 +11,6 @@ user_domain_name = {{ identity_service.service_domain_name }}
project_name = {{ identity_service.service_project_name }}
username = {{ identity_service.service_user_name }}
password = {{ identity_service.service_password }}
# XXX Region should come from the id relation here
region_name = {{ options.region }}

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
@@ -88,6 +94,7 @@ omit =
.tox/*
*/charmhelpers/*
unit_tests/*
src/templates/*
[testenv:venv]
basepython = python3

View File

@@ -21,7 +21,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 _NovaXenaOperatorCharm(charm.NovaXenaOperatorCharm):