Skip to main content

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.

Files for zabel-fabric, version 0.16.1
Filename, size File type Python version Upload date Hashes
Filename, size zabel_fabric-0.16.1-py3-none-any.whl (29.4 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page