load-environ-typed-kubernetes
Extends load-environ-typed to get info right from Kubernetes API
Getting started
from typing import Dict
from load_environ_typed import load
from load_environ_typed_kubernetes.loaders import KubernetesLoader
from dataclasses import dataclass
@dataclass
class MyEnviron:
my_config_map: Dict[str, str]
my_secret: Dict[str, str]
kubernetes = KubernetesLoader(in_cluster=True)
environ = load(MyEnviron, loaders={
'my_config_map': kubernetes.load_config_map,
'my_secret': kubernetes.load_secret,
})
Contributing
Make sure you have kubectl installed via https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/.
Install a local kubernetes cluster, for example using https://kind.sigs.k8s.io/.
kind create cluster --name load-environ-typed-kubernetes
kubectl create namespace load-environ-typed-kubernetes-test
# Create the configmap and secrets
kubectl --namespace load-environ-typed-kubernetes-test apply -f tests/configmap.yaml
kubectl --namespace load-environ-typed-kubernetes-test apply -f tests/secret.yaml
# Create a role that can access the configmap and secrets
kubectl --namespace load-environ-typed-kubernetes-test apply -f tests/serviceaccount.yaml
kubectl --namespace load-environ-typed-kubernetes-test apply -f tests/role.yaml
kubectl --namespace load-environ-typed-kubernetes-test apply -f tests/rolebinding.yaml
Check out this repo, and then use the following steps to test it:
python3 -m venv venv
venv/bin/pip install .
venv/bin/pip install -r requirements-dev.txt
make test
Run a test container on Kubernetes:
docker build -f tests/docker/Dockerfile . -t load-environ-typed-kubernetes-test:0.0.1
kind load docker-image --name load-environ-typed-kubernetes load-environ-typed-kubernetes-test:0.0.1
kubectl --namespace load-environ-typed-kubernetes-test apply -f tests/pod.yaml
Alternatively:
make reload-pod-on-kind
Deploying
First, update pyproject.toml with the new version number, and commit that.
Then:
rm -f dist/* # Clean old build files
venv/bin/python -m build
venv/bin/python -m twine upload dist/*
Metadata
Release files for load-environ-typed-kubernetes 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| load_environ_typed_kubernetes-0.0.1.tar.gz | 4.9 kB | Without provenance | Details for load_environ_typed_kubernetes-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| load_environ_typed_kubernetes-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for load_environ_typed_kubernetes-0.0.1-py3-none-any.whl |
Total release size: 9.6 kB
Release files / load_environ_typed_kubernetes-0.0.1.tar.gz
| Download URL | load_environ_typed_kubernetes-0.0.1.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4816962e4d8543a5bd34cffced2ac0afa2185c3ad52320e575d0b067f9662ca9
|
|
BLAKE2b-256 checksum How to use checksums |
d7c14001519f582d4cc68d5dfcefb5e189dd03ec37efa564e04a80f9bfc2f093
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Release files / load_environ_typed_kubernetes-0.0.1-py3-none-any.whl
| Download URL | load_environ_typed_kubernetes-0.0.1-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4b7282e4b4aba8d57f100ead63dd60f2e428150fa781cfde3975f7b55f69c8eb
|
|
BLAKE2b-256 checksum How to use checksums |
8fe61518ff5dd59b32b07494037932a8b79a48a71fd0fc7d4716c51b5f8b6110
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Security for load-environ-typed-kubernetes 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.