Skip to main content

No project description provided

Project description

Gybe

PyPI Package

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


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.4.0.tar.gz (39.4 MB view details)

Uploaded Source

Built Distribution

gybe-0.4.0-py3-none-any.whl (785.6 kB view details)

Uploaded Python 3

File details

Details for the file gybe-0.4.0.tar.gz.

File metadata

  • Download URL: gybe-0.4.0.tar.gz
  • Upload date:
  • Size: 39.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.27.0

File hashes

Hashes for gybe-0.4.0.tar.gz
Algorithm Hash digest
SHA256 475b788e8af30e4487f488f0d242f33e488a9804b87de10af797a42ba9028ce1
MD5 35ede59afc75663bdf1b40a7dc89f0c7
BLAKE2b-256 59d6d7ce73545a2c155fcadcecc6e4447fdadaccf57e39d8e3a2cbb303181150

See more details on using hashes here.

File details

Details for the file gybe-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: gybe-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 785.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.27.0

File hashes

Hashes for gybe-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a5036f691f340cbcc609b35fd3ea248bb0bac8f3940d6b9ea7c2c0f038162ea8
MD5 6e1fff91939a9441322e40b1715e8c01
BLAKE2b-256 baad1e32ed6cf1449eec50b9e00fb1d314bb4cd6f0949f9b52960680b2296c31

See more details on using hashes here.

Supported by

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