.. _implementaton: Implementation =============== The ODA can be thought of as 3 separate components: 1. The database that stores the OSO entities. 2. A Python library used by OSO applications to interact with the database. 3. A DEPRECATED deployable FastAPI service that uses the library to perform CRUD operations on the database. .. figure:: ../diagrams/oso-oda.jpg :align: center The repository also defines a client library for the FastAPI service. Database Layer ------------------ The ``ska-db-oda`` chart contains a ``ConfigMap`` that is loaded with DDL scripts for the ODA. For production deployments, it is expected that integration teams/Services can take this to apply to a managed Postgres instance. The chart also contains an optional ``Job`` that will execute the DDL scripts against a Postgres instance given standard ``PG_`` environment variables. The ``ska-db-oda-umbrella`` chart will deploy a ``PGDBInstance`` CRD that will provision a Postgres database (given the Stackgres operator requirements in the Kubernetes cluster). For more info see :doc:`../deployment/deployment_to_kubernetes`. The provisioning of the Postgres instance is in the umbrella chart as it is intended to be used for testing scenarios, with the production database being managed externally. However if an AIV team for example needs a database to be deployed, they are free to use the umbrella chart. Python Library --------------- ``ska-db-oda`` is published as a Python wheel that can be used as a dependency in other applications. It essentially provides an ORM to interact with Postgres via a Repository interface. For more info see :doc:`../internal/repository_and_uow/repository_and_uow`. FastAPI Service ---------------- .. note:: As of PI28, this service is deprecated and will be removed from OSO in the coming PIs. Please contact #help-oso if this will break any workflows. The ``ska-db-oda`` Python wheel can also be deployed as a standalone application that provides a RESTful API. Currently this provides read and write resources for all the entities, but it is expected that this will be reduced depending on use cases in the future. It is expected that OSO applications will not need to use the API directly. For more info see :doc:`../external/rest_api`. Within the same wheel is also a client library for the FastAPI service which can be used as a CLI. For more info see :doc:`../external/cli`. .. note:: The ORM library, service and client library all being part of the same wheel is both inefficient dependency management and a source of confusion, but is just a result of how the use of the ODA has evolved and the lack of appetite for managing more repositories within OSO. Once the architecture is more settled, we can investigate publishing separate wheels.