An adapter to use the lab orchestrator lib in django projects.
Project description
Lab Orchestrator Lib Django Adapter
This package implements the adapters to use the lab orchestrator library in django projects. That means that some data of the lab orchestrator library will be saved in the django database.
Setup
Installation
Install this library with: pip install lab-orchestrator-lib-django-adapter
.
Project setup
Assuming you have a django application, first define the following variables in your settings.py
:
DEVELOPMENT
(bool): If this is true the development mode is activated. This means, that no cacert is used and insecure certs are allowed. If false this assumes you are running this inside a Kubernetes cluster.SECRET_KEY
(str): This key is used to create jwt tokens. Create a random key for this and keep this key safe.
After that add lab_orchestrator_lib_django_adapter
to the INSTALLED_APPS
variable in your settings.py
.
Environment Variables
The library makes use of some environment variables that you need to set:
KUBERNETES_SERVICE_HOST
(str): Host of your Kubernetes API (if you runkubectl proxy
:localhost
)KUBERNETES_SERVICE_PORT
(int): Port of your Kubernetes API (if you runkubectl proxy
:8001
)DEVELOPMENT
(bool): If this is true the development mode is activated. This means, that no cacert is used and insecure certs are allowed. If false this assumes you are running this inside a Kubernetes cluster.
Usage
You have three Model classes:
DockerImageModel
LabModel
LabInstanceModel
Those three models are used to save data from the library in the django database and those can all be used safely in
read only view sets. The DockerImageModel
and LabModel
can also be used safely in a delete, update and create view
sets. To create and delete a LabInstanceModel
you need to use the lab instance controller. Updating a
LabInstanceModel
is not allowed.
To get extra information from Kubernetes resources you need to use the controllers.
A default ControllerCollection
can be got with the get_default_cc
method in
lab_orchestrator_lib_django_adapter.controller_collection
module. The controllers are part of the lab orchestrator lib
and there you can find documentation about how to use this.
An example on how to use this library in ViewSets
can be found in the
views.py.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for lab-orchestrator-lib-django-adapter-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d14fa76e693c23b7d0667b2f67cdc3bb424593a685bad2036d72dbc9b7afa42 |
|
MD5 | b25d5a525e2be3a5079146f0ec08f2f5 |
|
BLAKE2b-256 | a4ac1773d14d61882638d431463b6f4948b62f23ffaf9a35e21939438a284038 |
Hashes for lab_orchestrator_lib_django_adapter-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01ea624afff301446f6722235deb5562fb8739c437cde1a1ab045a758acc43a2 |
|
MD5 | e8d04140f755d1fedae9d260da0eceec |
|
BLAKE2b-256 | dedda7150d96b61306ffca0d5057a70ceb92d4b74a95f639a60a45eea1ed2ed3 |