Skip to main content

An adapter to use the lab orchestrator lib in django projects.

Project description

Status Version License Issues Downloads Dependencies Docs

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.

Github
PyPi
Read The Docs

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 run kubectl proxy: localhost)
  • KUBERNETES_SERVICE_PORT (int): Port of your Kubernetes API (if you run kubectl 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lab-orchestrator-lib-django-adapter-1.0.0.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file lab-orchestrator-lib-django-adapter-1.0.0.tar.gz.

File metadata

  • Download URL: lab-orchestrator-lib-django-adapter-1.0.0.tar.gz
  • Upload date:
  • Size: 16.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.8.10

File hashes

Hashes for lab-orchestrator-lib-django-adapter-1.0.0.tar.gz
Algorithm Hash digest
SHA256 6d14fa76e693c23b7d0667b2f67cdc3bb424593a685bad2036d72dbc9b7afa42
MD5 b25d5a525e2be3a5079146f0ec08f2f5
BLAKE2b-256 a4ac1773d14d61882638d431463b6f4948b62f23ffaf9a35e21939438a284038

See more details on using hashes here.

File details

Details for the file lab_orchestrator_lib_django_adapter-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: lab_orchestrator_lib_django_adapter-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 19.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.8.10

File hashes

Hashes for lab_orchestrator_lib_django_adapter-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 01ea624afff301446f6722235deb5562fb8739c437cde1a1ab045a758acc43a2
MD5 e8d04140f755d1fedae9d260da0eceec
BLAKE2b-256 dedda7150d96b61306ffca0d5057a70ceb92d4b74a95f639a60a45eea1ed2ed3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page