Middleware for Kubernetes probes and Django management commands for Kubernetes jobs.
Project description
Django Kubernetes
Middleware and Views for Kubernetes liveness and readiness probes and Django management commands for Kubernetes jobs such as waiting for the database to be ready or ensuring an admin user exists or is created from environment variables.
Let's face it; running a Django app on a Kubernetes cluster is a bit difficult - Django was built by folks who were running it on virtual machines or even bare metal hardware! They expected a shell environment available to them to be able to run management commands and influence how Django started up when in production.
When Django is orchestrated, we somehow have to manage these commands in our clusters; either by manually running the commands or creating init containers or Jobs that our deployments depend on. Moreover, once the pods are up and running, we need to ensure that the Kubernetes control layer can manipulate them as needed.
That's where this package comes in, it provides the following helpers to make your Django deployments on Kubernetes easier:
Readiness Probes
DatabaseProbe: Checks that a connection can be established to the databaseMemcachedProbe: Checks that the cache nodes are available and ready
Views
LivenessView: responds Ok to/livezand/healthzpath requestsReadinessView: respond Ok if readiness probes are fine, else 503
Middleware
ProbeMiddleware: performs/livez,/healthz, and/readyzchecks with readiness probes before any middleware or views might interact with those services and raise a 500 error or some other error.
Management Commands
./manage.py probe: a CLI version of the probes with--live,--health, and--readychecks that can be used by Kubernetes probeexeccommands../manage.py wait4db: sleeps until the database is ready and available./manage.py ensureadmin: reads environment variables for an admin user and creates that super user if the record does not already exist in the database../manage.py lockedmigrate: uses a postgres advisory lock to ensure migration safety across multiple processes; useful for a multi-replica deployment with a migrate init container.
See the documentation for more on how to get started and use this app in your Django project.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_kubernetes-1.1.0.tar.gz.
File metadata
- Download URL: django_kubernetes-1.1.0.tar.gz
- Upload date:
- Size: 24.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ca3e3b85c8cd7c11057156398d74398c585a7d782ad585a65463e749d2d86ed
|
|
| MD5 |
35497be73bcacae385b3402845a9cc5f
|
|
| BLAKE2b-256 |
636c3a5bf9a360e14612dfa581d055cc27e78e35954b0edf17cb02c22f3ca154
|
Provenance
The following attestation bundles were made for django_kubernetes-1.1.0.tar.gz:
Publisher:
release.yaml on rotationalio/django-kubernetes
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_kubernetes-1.1.0.tar.gz -
Subject digest:
6ca3e3b85c8cd7c11057156398d74398c585a7d782ad585a65463e749d2d86ed - Sigstore transparency entry: 243202081
- Sigstore integration time:
-
Permalink:
rotationalio/django-kubernetes@99cf965e06fe2bbecf205960e795d2884baeda50 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/rotationalio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@99cf965e06fe2bbecf205960e795d2884baeda50 -
Trigger Event:
release
-
Statement type:
File details
Details for the file django_kubernetes-1.1.0-py3-none-any.whl.
File metadata
- Download URL: django_kubernetes-1.1.0-py3-none-any.whl
- Upload date:
- Size: 13.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
068cca992a6b3f8030774618ce23ee22cf68b565a35faa46bb6ccd97f034c029
|
|
| MD5 |
2c38d42ebfc8da962cdfb56ba6d0e49b
|
|
| BLAKE2b-256 |
fdd014e763857e44fc8d846f786527c777d6b85d649e5d990e29cf2b468a91d9
|
Provenance
The following attestation bundles were made for django_kubernetes-1.1.0-py3-none-any.whl:
Publisher:
release.yaml on rotationalio/django-kubernetes
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_kubernetes-1.1.0-py3-none-any.whl -
Subject digest:
068cca992a6b3f8030774618ce23ee22cf68b565a35faa46bb6ccd97f034c029 - Sigstore transparency entry: 243202085
- Sigstore integration time:
-
Permalink:
rotationalio/django-kubernetes@99cf965e06fe2bbecf205960e795d2884baeda50 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/rotationalio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@99cf965e06fe2bbecf205960e795d2884baeda50 -
Trigger Event:
release
-
Statement type: