The Zabel Fabric
Project description
zabel-fabric
Overview
Please note that this library is not feature-complete yet.
This is part of the Zabel platform. The zabel-fabric package defines fabrics.
A fabric is what host a Zabel platform. A given fabric can host more than one Zabel platform, and it can also host other applications.
A fabric provides foundations for the applications and platforms it hosts to build upon. Those foundations include isolation, access control, secret management, as well as deployments, persistence, and discovery services.
Zabel's fabrics are not the first attempt to offer such foundations for applications. They will not be the last either.
What fabrics do is that they (try to) provide a (very) small, coherent subset of what Kubernetes clusters offer.
An application that can be deployed on a fabric can be deployed as-is on a Kubernetes cluster, if the images it uses are converted to proper containers and they preserve encapsulation.
Images, in Zabel, are plain classes with a constructor matching a known signature
and a run
method, so they can easily be converted to containers.
It does not mean any Python application can be automagically converted to a cloud-native application, and it of course does not imply that you can deploy your existing Kubernetes applications on a Zabel fabric.
What it means is that if your Python application has been designed to work on a Zabel fabric, it can be deployed on a full-fledged Kubernetes cluster, should the need arise.
What it also means is that you can use existing tools (such as kubectl
or your favorite
editor extension) to explore or change the state of a running fabric or to deploy new
resources.
Example
Here is a simple Hello World example.
Assuming the following class in a hello.py
file:
import os
from time import sleep
from zabel.commons.interfaces import Image
class HelloWorld(Image):
def __init__(self):
self.name = os.environ.get('NAME', 'World')
def run(self):
print(f'hello {self.name}')
sleep(15)
print('good bye')
And the following pod.yaml
manifest:
apiVersion: v1
kind: Pod
metadata:
name: hello
spec:
restartPolicy: Never
containers:
- name: Hello
image: hello/HelloWorld
env:
- name: NAME
value: 'Alice'
We can deploy it as follow:
kubectl apply -f pod.yaml
On your Zabel fabric console, the following should be displayed:
hello Alice
...
good bye
Resources
The following resources are available, at least partially, on fabrics:
- v1/Events
- v1/Namespace
- v1/Pod
- v1/Secret
- v1/Service
- v1/ServiceAccount
- v1.apiextensions.k8s.io/CustomResourceDefinition
- v1.apps/Deployment
- v1.rbac.authorization.k8s.io/ClusterRole
- v1.rbac.authorization.k8s.io/ClusterRoleBinding
- v1.rbac.authorization.k8s.io/Role
- v1.rbac.authorization.k8s.io/RoleBinding
- v1beta1.networking.k8s.io/Ingress
License
Copyright (c) 2019-2020 Martin Lafaix (martin.lafaix@external.engie.com) and others
This program and the accompanying materials are made
available under the terms of the Eclipse Public License 2.0
which is available at https://www.eclipse.org/legal/epl-2.0/
SPDX-License-Identifier: EPL-2.0
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file zabel_fabric-0.16.1-py3-none-any.whl
.
File metadata
- Download URL: zabel_fabric-0.16.1-py3-none-any.whl
- Upload date:
- Size: 29.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c327ab265863e1f545f5de6ba70b392eca37b93e606f5734d5c06b80498632d |
|
MD5 | d1a7c97101ac0c0578563618a71af61b |
|
BLAKE2b-256 | 1451f2b12826a01c030bab8c0686c559d656663c7bec6505f9116e4b894b90fe |