Skip to main content

A universal python library for container orchestrators

Project description

# Kubeshift
[![Build Status](https://travis-ci.org/cdrage/kubeshift.svg?branch=master)](https://travis-ci.org/cdrage/kubeshift)
[![Coverage Status](https://coveralls.io/repos/github/cdrage/kubeshift/badge.svg?branch=master)](https://coveralls.io/github/cdrage/kubeshift?branch=master)

## Introduction

_Kubeshift_ is a multi-provider Python library for container orchestrators. We connect and communicate with each container orchestator 100% through their TLS (if available) HTTP API.

__Features:__

- 100% HTTP API
- Auto-parsing of `~/.kube/config`
- `.kube/config` generation
- TLS/Websocket authentication
- High test coverage

## Providers

At the moment we support:

- Kubernetes
- OpenShift
- Mesos (soon!)

## Library installation

#### Pip
```
sudo pip install kubeshift
```

#### Manual / development
```
git clone https://github.com/cdrage/kubeshift && cd kubeshift
make install
```

## Python requirements

```sh
▶ cat requirements.txt
anymarkup
jsonpointer
requests
websocket-client
```

## Methods and examples

#### Configuration import

The configuration file used with the provider must be an _object_. Currently we support the import and generation of Kubernetes and OpenShift configuration files .

```python
import kubeshift

# Import the configuration, this can be either from file
config = kubeshift.Config.from_file("/home/user/.kube/config")

# Or generated via a set of parameters
config_params = kubeshift.Config.from_params(api="https://localhost:8080", auth="foobar", ca="/home/user/.kube/ca.cert", verify=True)

a = kubeshift.Client(config, "kubernetes")
a.namespaces()
```

#### Implemented methods

The current methods implement for each provider are:
- .namespaces()
- .create(object)
- .delete(object)

```python
import kubeshift

config = kubeshift.Config.from_file("/home/user/.kube/config")

a = kubeshift.Client(config, "kubernetes")

a.namespaces() # Returns a dict of all available namespaces

k8s_object = {"apiVersion": "v1", "kind": "Pod", "metadata": {"labels": {"app": "helloapache"}, "name": "helloapache"}, "spec": {"containers": [{"image": "nginx", "name": "helloapache", "ports": [{"containerPort": 80, "hostPort": 80, "protocol": "TCP"}]}]}}

a.create(k8s_object) # Creates the k8s object

a.delete(k8s_object) # Deletes the k8s object
```

## TODO

- Additional providers other than Kubernetes and OpenShift

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

kubeshift-0.0.3.tar.gz (14.4 kB view details)

Uploaded Source

File details

Details for the file kubeshift-0.0.3.tar.gz.

File metadata

  • Download URL: kubeshift-0.0.3.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for kubeshift-0.0.3.tar.gz
Algorithm Hash digest
SHA256 29688bc07a1de43e68c6e03bd3a71a46c7d72b200fc7db7ba5ce52a2486a4d41
MD5 8743c681597a757b76c5637bfe039fcf
BLAKE2b-256 ac76a451ae6a80de51ffce106408304c455d3428ef5cc1ca448027d7465af2bd

See more details on using hashes here.

Supported by

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