rename package names and code cleanup
Following changes are done as part of this patch * Rename package name to ops_sunbeam * Rename shared_code/aso_charm to shared_code/sunbeam_charm * Modify rest of scripts as per above changes * Code cleanup
This commit is contained in:
parent
1f594b67a6
commit
1866f094fb
@ -1,23 +1,23 @@
|
||||
========================================
|
||||
Advanced Sunbeam OpenStack Documentation
|
||||
========================================
|
||||
===============================
|
||||
Sunbeam OpenStack Documentation
|
||||
===============================
|
||||
|
||||
Tutorials
|
||||
#########
|
||||
|
||||
`Writing an OpenStack API charm with ASO <writing-OS-API-charm.rst>`_.
|
||||
`Writing an OpenStack API charm with Sunbeam <doc/writing-OS-API-charm.rst>`_.
|
||||
|
||||
How-Tos
|
||||
#######
|
||||
|
||||
|
||||
`How-To write a pebble handler <howto-pebble-handler.rst>`_.
|
||||
`How-To write a pebble handler <doc/howto-pebble-handler.rst>`_.
|
||||
|
||||
`How-To write a relation handler <howto-relation-handler.rst>`_.
|
||||
`How-To write a relation handler <doc/howto-relation-handler.rst>`_.
|
||||
|
||||
`How-To write a charm context <howto-config-context.rst>`_.
|
||||
`How-To write a charm context <doc/howto-config-context.rst>`_.
|
||||
|
||||
`How-To expose services outside of K8S <howto-expose-services.rst>`_.
|
||||
`How-To expose services outside of K8S <doc/howto-expose-services.rst>`_.
|
||||
|
||||
|
||||
Reference
|
||||
@ -29,4 +29,4 @@ Concepts
|
||||
########
|
||||
|
||||
|
||||
`ASO Concepts <concepts.rst>`_.
|
||||
`Sunbeam Concepts <doc/concepts.rst>`_.
|
||||
|
@ -1,18 +1,18 @@
|
||||
============================================
|
||||
Advanced Sunbeam OpenStack OPS Charm Anatomy
|
||||
============================================
|
||||
===================================
|
||||
Sunbeam OpenStack OPS Charm Anatomy
|
||||
===================================
|
||||
|
||||
Overview
|
||||
--------
|
||||
|
||||
Advanced Sunbeam OpenStack is designed to help with writing charms that
|
||||
use the `Charmed Operator Framework <https://juju.is/docs/sdk>`__ and are
|
||||
Sunbeam OpenStack is designed to help with writing charms that use the
|
||||
`Charmed Operator Framework <https://juju.is/docs/sdk>`__ and are
|
||||
deployed on Kubernetes. For the rest of this document when a charm is referred
|
||||
to it is implied that it is a Charmed Operator framework charm on Kubernetes.
|
||||
|
||||
It general a charm interacts with relations, renders configuration files and manages
|
||||
services. ASO gives a charm a consistent way of doing this by implementing
|
||||
Container handlers and Relation handlers.
|
||||
It general a charm interacts with relations, renders configuration files and
|
||||
manages services. Sunbeam Ops gives a charm a consistent way of doing this by
|
||||
implementing Container handlers and Relation handlers.
|
||||
|
||||
Relation Handlers
|
||||
-----------------
|
@ -43,6 +43,8 @@ The charm can append the new context onto those provided by the base class.
|
||||
|
||||
.. code:: python
|
||||
|
||||
import ops_sunbeam.charm as sunbeam_charm
|
||||
|
||||
class MyCharm(sunbeam_charm.OSBaseOperatorAPICharm):
|
||||
"""Charm the service."""
|
||||
|
@ -16,11 +16,10 @@ is required to the API endpoints from outside of Kubernetes - this
|
||||
is used by both end-users of the cloud as well as from machine
|
||||
based charms supporting OpenStack Hypervisors.
|
||||
|
||||
Operator charms for API or other web services written using Advanced
|
||||
Sunbeam OpenStack will automatically patch the Juju created service
|
||||
entry to be of type LoadBalancer, enabling Kubernetes to expose the
|
||||
service to the outside world using a suitable Load Balancer
|
||||
implementation.
|
||||
Operator charms for API or other web services written using Sunbeam
|
||||
OpenStack will automatically patch the Juju created service entry to
|
||||
be of type LoadBalancer, enabling Kubernetes to expose the service to
|
||||
the outside world using a suitable Load Balancer implementation.
|
||||
|
||||
++++++++
|
||||
MicroK8S
|
@ -20,9 +20,9 @@ other container) then `PebbleHandler` should be used.
|
||||
|
||||
.. code:: python
|
||||
|
||||
import container_handlers
|
||||
import ops_sunbeam.container_handlers as sunbeam_chandlers
|
||||
|
||||
class MyServicePebbleHandler(container_handlers.ServicePebbleHandler):
|
||||
class MyServicePebbleHandler(sunbeam_chandlers.ServicePebbleHandler):
|
||||
"""Manage MyService Container."""
|
||||
|
||||
The handlers can create directories in the container once the pebble is
|
@ -25,8 +25,8 @@ Add ASO common files to new charm. The script will ask a few basic questions:
|
||||
.. code:: bash
|
||||
|
||||
git clone https://github.com/openstack-charmers/advanced-sunbeam-openstack
|
||||
cd advanced-sunbeam-openstack/shared_code
|
||||
./aso-charm-init.sh ~/branches/charm-ironic-operator
|
||||
cd advanced-sunbeam-openstack
|
||||
./sunbeam-charm-init.sh ~/branches/charm-ironic-operator
|
||||
|
||||
This tool is designed to be used after 'charmcraft init' was initially run
|
||||
service_name [ironic]: ironic
|
||||
@ -151,4 +151,4 @@ preset. Then check the ironic api service is reponding.
|
||||
"version": "1.72"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -15,19 +15,18 @@
|
||||
"""Base classes for defining a charm using the Operator framework.
|
||||
|
||||
This library provided OSBaseOperatorCharm and OSBaseOperatorAPICharm. The
|
||||
charm classes use advanced_sunbeam_openstack.relation_handlers.RelationHandler
|
||||
objects to interact with relations. These objects also provide contexts which
|
||||
charm classes use ops_sunbeam.relation_handlers.RelationHandler objects
|
||||
to interact with relations. These objects also provide contexts which
|
||||
can be used when defining templates.
|
||||
|
||||
In addition to the Relation handlers the charm class can also use
|
||||
advanced_sunbeam_openstack.config_contexts.ConfigContext objects which
|
||||
can be used when rendering templates, these are not specific to a relation.
|
||||
ops_sunbeam.config_contexts.ConfigContext objects which can be
|
||||
used when rendering templates, these are not specific to a relation.
|
||||
|
||||
The charm class interacts with the containers it is managing via
|
||||
advanced_sunbeam_openstack.container_handlers.PebbleHandler. The
|
||||
PebbleHandler defines the pebble layers, manages pushing
|
||||
configuration to the containers and managing the service running
|
||||
in the container.
|
||||
ops_sunbeam.container_handlers.PebbleHandler. The PebbleHandler
|
||||
defines the pebble layers, manages pushing configuration to the
|
||||
containers and managing the service running in the container.
|
||||
"""
|
||||
|
||||
import ipaddress
|
||||
@ -42,10 +41,10 @@ import ops.pebble
|
||||
from lightkube import Client
|
||||
from lightkube.resources.core_v1 import Service
|
||||
|
||||
import advanced_sunbeam_openstack.config_contexts as sunbeam_config_contexts
|
||||
import advanced_sunbeam_openstack.container_handlers as sunbeam_chandlers
|
||||
import advanced_sunbeam_openstack.core as sunbeam_core
|
||||
import advanced_sunbeam_openstack.relation_handlers as sunbeam_rhandlers
|
||||
import ops_sunbeam.config_contexts as sunbeam_config_contexts
|
||||
import ops_sunbeam.container_handlers as sunbeam_chandlers
|
||||
import ops_sunbeam.core as sunbeam_core
|
||||
import ops_sunbeam.relation_handlers as sunbeam_rhandlers
|
||||
|
||||
import charms.observability_libs.v0.kubernetes_service_patch as kube_svc_patch
|
||||
|
@ -24,7 +24,7 @@ import logging
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
import advanced_sunbeam_openstack.charm
|
||||
import ops_sunbeam.charm
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -38,7 +38,7 @@ class ConfigContext:
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
charm: "advanced_sunbeam_openstack.charm.OSBaseOperatorCharm",
|
||||
charm: "ops_sunbeam.charm.OSBaseOperatorCharm",
|
||||
namespace: str,
|
||||
) -> None:
|
||||
"""Run constructor."""
|
@ -22,8 +22,8 @@ in the container.
|
||||
import collections
|
||||
import logging
|
||||
|
||||
import advanced_sunbeam_openstack.core as sunbeam_core
|
||||
import advanced_sunbeam_openstack.templating as sunbeam_templating
|
||||
import ops_sunbeam.core as sunbeam_core
|
||||
import ops_sunbeam.templating as sunbeam_templating
|
||||
import ops.charm
|
||||
import ops.pebble
|
||||
|
@ -18,9 +18,9 @@ import collections
|
||||
from typing import Generator, List, TYPE_CHECKING, Tuple, Union
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from advanced_sunbeam_openstack.charm import OSBaseOperatorCharm
|
||||
from advanced_sunbeam_openstack.config_contexts import ConfigContext
|
||||
from advanced_sunbeam_openstack.relation_handlers import RelationHandler
|
||||
from ops_sunbeam.charm import OSBaseOperatorCharm
|
||||
from ops_sunbeam.config_contexts import ConfigContext
|
||||
from ops_sunbeam.relation_handlers import RelationHandler
|
||||
|
||||
ContainerConfigFile = collections.namedtuple(
|
||||
"ContainerConfigFile",
|
@ -23,7 +23,7 @@ from urllib.parse import urlparse
|
||||
import ops.charm
|
||||
import ops.framework
|
||||
|
||||
import advanced_sunbeam_openstack.interfaces as sunbeam_interfaces
|
||||
import ops_sunbeam.interfaces as sunbeam_interfaces
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -20,7 +20,7 @@ from pathlib import Path
|
||||
from typing import List, TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
import advanced_sunbeam_openstack.core as sunbeam_core
|
||||
import ops_sunbeam.core as sunbeam_core
|
||||
import ops.model
|
||||
|
||||
from charmhelpers.contrib.openstack.templating import get_loader
|
@ -3,7 +3,6 @@ jinja2
|
||||
kubernetes
|
||||
ops
|
||||
python-keystoneclient
|
||||
git+https://opendev.org/openstack/charm-ops-openstack#egg=ops_openstack
|
||||
git+https://github.com/openstack/charm-ops-interface-ceph-client#egg=interface_ceph_client
|
||||
lightkube
|
||||
lightkube-models
|
||||
|
@ -1,5 +1,5 @@
|
||||
[metadata]
|
||||
name = advanced_sunbeam_openstack
|
||||
name = ops_sunbeam
|
||||
summary = Charm lib for OpenStack Charms using operator framework
|
||||
version = 0.0.1.dev1
|
||||
description-file =
|
||||
|
@ -14,7 +14,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""Module used to setup the advanced_sunbeam_openstack framework."""
|
||||
"""Module used to setup the ops_sunbeam framework."""
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
|
@ -17,7 +17,7 @@ def start_msg():
|
||||
|
||||
def cookie(output_dir, extra_context):
|
||||
cookiecutter(
|
||||
'aso_charm/',
|
||||
'sunbeam_charm/',
|
||||
extra_context=extra_context,
|
||||
output_dir=output_dir)
|
||||
|
@ -1,7 +1,6 @@
|
||||
ops
|
||||
jinja2
|
||||
git+https://opendev.org/openstack/charm-ops-openstack#egg=ops_openstack
|
||||
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
|
||||
# These are only needeed if the charm relates to ceph
|
||||
git+https://github.com/openstack/charm-ops-interface-ceph-client#egg=interface_ceph_client
|
@ -9,7 +9,7 @@ import logging
|
||||
from ops.framework import StoredState
|
||||
from ops.main import main
|
||||
|
||||
import advanced_sunbeam_openstack.charm as sunbeam_charm
|
||||
import ops_sunbeam.charm as sunbeam_charm
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -2,4 +2,4 @@
|
||||
|
||||
[ -e .tox/cookie/bin/activate ] || tox -e cookie
|
||||
source .tox/cookie/bin/activate
|
||||
shared_code/aso-charm-init.py $@
|
||||
shared_code/sunbeam-charm-init.py $@
|
@ -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}
|
||||
@ -71,7 +71,22 @@ deps = -r{toxinidir}/requirements.txt
|
||||
basepython = python3
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
commands = flake8 {posargs} src unit_tests tests advanced_sunbeam_openstack --exclude unit_tests/lib
|
||||
commands = flake8 {posargs} src unit_tests tests ops_sunbeam --exclude unit_tests/lib
|
||||
|
||||
[testenv:cover]
|
||||
basepython = python3
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
setenv =
|
||||
{[testenv]setenv}
|
||||
PYTHON=coverage run
|
||||
commands =
|
||||
coverage erase
|
||||
stestr run --slowest {posargs}
|
||||
coverage combine
|
||||
coverage html -d cover
|
||||
coverage xml -o cover/coverage.xml
|
||||
coverage report
|
||||
|
||||
[coverage:run]
|
||||
branch = True
|
||||
@ -81,7 +96,6 @@ source =
|
||||
.
|
||||
omit =
|
||||
.tox/*
|
||||
*/charmhelpers/*
|
||||
unit_tests/*
|
||||
|
||||
[testenv:venv]
|
||||
|
@ -28,7 +28,7 @@ if TYPE_CHECKING:
|
||||
sys.path.append("unit_tests/lib") # noqa
|
||||
sys.path.append("src") # noqa
|
||||
|
||||
import advanced_sunbeam_openstack.charm as sunbeam_charm
|
||||
import ops_sunbeam.charm as sunbeam_charm
|
||||
|
||||
CHARM_CONFIG = """
|
||||
options:
|
||||
|
@ -21,8 +21,8 @@ import sys
|
||||
sys.path.append('lib') # noqa
|
||||
sys.path.append('src') # noqa
|
||||
|
||||
import advanced_sunbeam_openstack.charm as sunbeam_charm
|
||||
import advanced_sunbeam_openstack.test_utils as test_utils
|
||||
import ops_sunbeam.charm as sunbeam_charm
|
||||
import ops_sunbeam.test_utils as test_utils
|
||||
from . import test_charms
|
||||
|
||||
|
||||
@ -218,7 +218,7 @@ class TestOSBaseOperatorAPICharm(test_utils.CharmTestCase):
|
||||
self.harness.charm.public_url,
|
||||
'http://public-url')
|
||||
|
||||
@mock.patch('advanced_sunbeam_openstack.charm.Client')
|
||||
@mock.patch('ops_sunbeam.charm.Client')
|
||||
def test_endpoint_urls_no_ingress(self, mock_client: mock.patch) -> None:
|
||||
"""Test public_url and internal_url with no ingress defined."""
|
||||
class mock_service:
|
||||
|
Loading…
x
Reference in New Issue
Block a user