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
)
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-0.0.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 426107d4c5bb73edc77eb6df3dc3a04cfd14749118e6a4c8a040d8005bee91de |
|
MD5 | 4874f4922f8576a6a71c410d0e66658a |
|
BLAKE2b-256 | 6354f1ef0899bcf55974d0b390672b6697641c791903ad6259fc9c2724dc1f1e |
Hashes for lab_orchestrator_lib_django_adapter-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | efa10d748fc50829b877ce691eeb973492c93d6ceb7a1175ade374b1361b14d2 |
|
MD5 | 91fe7260dac1bb037f16dde840904c94 |
|
BLAKE2b-256 | 081d4bf9507bf14a265bddbc802cb60479de4fd96039fce324c7a45889e3bfac |