No project description provided
Project description
Gybe
Transpile Kubernetes manifests with your simple values.yaml files using python type-hints. Gybe is a simple, declarative, and more pythonic alternative to helm that makes it easier to develop modest kubernetes deployments.
Reqiurements
Python 3.10+
Install
pip install gybe
Example
Create a values.yaml
file:
image: python:3
command:
- python
- -m
- http.server
Create a chart.py
file:
import gybe
def create_standard_container(image: str, command: list[str]):
return gybe.k8s.Container(image=image, command=command, name='my-python-server')
@gybe.transpiler
def two_pods(image: str, command: list[str]) -> gybe.Manifest:
pod_spec = gybe.k8s.PodSpec(
containers=[create_standard_container(image=image, command=command)],
)
return [
gybe.k8s.Pod(
kind='Pod',
apiVersion='v1',
metadata=gybe.k8s.ObjectMeta(name='pod-1'),
spec=pod_spec,
),
gybe.k8s.Pod(
kind='Pod',
apiVersion='v1',
metadata=gybe.k8s.ObjectMeta(name='pod-2'),
spec=pod_spec,
),
]
if __name__ == '__main__':
two_pods()
Now run your transpiler with your values file:
python chart.py values.yaml
apiVersion: v1
kind: Pod
metadata:
name: pod-1
spec:
containers:
- command:
- python
- -m
- http.server
image: python:3
name: my-python-server
---
apiVersion: v1
kind: Pod
metadata:
name: pod-2
spec:
containers:
- command:
- python
- -m
- http.server
image: python:3
name: my-python-server
If you're feeling lucky, you can pipe that into kubectl
:
python chart.py values.yaml | kubectl apply -f -
pod/pod-1 created
pod/pod-2 created
kubectl get pods
NAME READY STATUS RESTARTS AGE
pod-1 1/1 Running 0 5s
pod-2 1/1 Running 0 5s
python chart.py values.yaml | kubectl delete -f -
pod "pod-1" deleted
pod "pod-2" deleted
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
gybe-0.6.0.tar.gz
(45.6 MB
view details)
Built Distribution
gybe-0.6.0-py3-none-any.whl
(855.5 kB
view details)
File details
Details for the file gybe-0.6.0.tar.gz
.
File metadata
- Download URL: gybe-0.6.0.tar.gz
- Upload date:
- Size: 45.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.28.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
798150587fec831f964c822939df4b8e400f7398151d0217300db23f1f45a3f0
|
|
MD5 |
4248a49c4f00b13126a7d5bd69a035de
|
|
BLAKE2b-256 |
a82de3ebc5ae78e83bd73ae6adc42ed6b239c45aa0a4581e40970f7733895a5d
|
File details
Details for the file gybe-0.6.0-py3-none-any.whl
.
File metadata
- Download URL: gybe-0.6.0-py3-none-any.whl
- Upload date:
- Size: 855.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.28.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
e8742c026d9aa2a0f622f313b8fb7d5634068a1fe1fb4e44a61f90656948579a
|
|
MD5 |
73a53e93fbd6fda74a373e63ab4317d7
|
|
BLAKE2b-256 |
bff6f08e23ef4afa5368a1b1e46e3a8f302a22bb506bc23d749047ef4bc09034
|