{ "info": { "author": "cdrage", "author_email": "cdrage@redhat.com", "bugtrack_url": null, "classifiers": [], "description": "# Kubeshift\n[![Build Status](https://travis-ci.org/cdrage/kubeshift.svg?branch=master)](https://travis-ci.org/cdrage/kubeshift)\n[![Coverage Status](https://coveralls.io/repos/github/cdrage/kubeshift/badge.svg?branch=master)](https://coveralls.io/github/cdrage/kubeshift?branch=master)\n\n## Introduction\n\n_Kubeshift_ is a multi-provider Python library for Kubernetes (Kube) and Openshift (shift). We connect and communicate with each container orchestator 100% through their TLS (if available) HTTP API.\n\n__Features:__\n\n - 100% HTTP API\n - Auto-parsing of `~/.kube/config`\n - `.kube/config` generation\n - TLS authentication\n - 100% test coverage with functional and integration tests\n\n## Library installation\n\n#### Pip\n```\nsudo pip install kubeshift\n```\n\n#### Manual / development\n```\ngit clone https://github.com/cdrage/kubeshift && cd kubeshift\nmake install\n```\n\n## Python requirements\n\n```sh\n\u25b6 cat requirements.txt \nanymarkup\nrequests\n```\n\n## Methods and examples\n\n#### Configuration import\n\nThe configuration file used with the provider must be an _object_. Currently we support the import and generation of Kubernetes and OpenShift configuration files .\n\n```python\nimport kubeshift\n\n# Import the configuration, this can be either from a file\nconfig = kubeshift.Config.from_file(\"/home/user/.kube/config\")\nclient = kubeshift.Client(config, \"kubernetes\")\n\n# Or generated via a set of parameters\nconfig_params = kubeshift.Config.from_params(api=\"https://localhost:8080\", auth=\"foobar\", ca=\"/home/user/.kube/ca.cert\", verify=True)\nclient = kubeshift.Client(config_params, \"kubernetes\")\n```\n\n#### Implemented methods\n\n**The main methods for each provider are:**\n```\n.create(object)\n.delete(object)\n.scale(object, namespace=\"default\", replicas=0)\n```\n\nAPI calls are also available via their corresponding method. Each call returns a dictionary object container all information. These methods are created from the list of calls at `http://localhost:8080/apis`. Some calls *require* namespace to be provided. Otherwise, 'default' will be used.\n\n**API call methods:**\n```\n.componentstatuses\n.namespaces\n.nodes\n.persistentvolumes\n.thirdpartyresources\n```\n\n**Namespaced API call methods:**\n```\n.configmaps(namespace=\"default\")\n.endpoints(namespace=\"default\")\n.events(namespace=\"default\")\n.limitranges(namespace=\"default\")\n.persistentvolumeclaims(namespace=\"default\")\n.pods(namespace=\"default\")\n.podtemplates(namespace=\"default\")\n.resourcequotas(namespace=\"default\")\n.secrets(namespace=\"default\")\n.serviceaccounts(namespace=\"default\")\n.services(namespace=\"default\")\n.daemonsets(namespace=\"default\")\n.deployments(namespace=\"default\")\n.horizontalpodautoscalers(namespace=\"default\")\n.ingresses(namespace=\"default\")\n.jobs(namespace=\"default\")\n.networkpolicies(namespace=\"default\")\n.replicasets(namespace=\"default\")\n.petsets(namespace=\"default\")\n.poddisruptionbudgets(namespace=\"default\")\n```\n\n**These API calls can further be filtered via these methods:**\n```\n.filter(namespace=\"foo\", status=\"Running\")\n.all()\n.metadata()\n.items()\n```\n\n**Full example:**\n```python\nimport kubeshift\nimport getpass\n\n# Example k8s object\nk8s_object = {\"apiVersion\": \"v1\", \"kind\": \"Pod\", \"metadata\": {\"labels\": {\"app\": \"helloapache\"}, \"name\": \"helloapache\"}, \"spec\": {\n \"containers\": [{\"image\": \"nginx\", \"name\": \"helloapache\", \"ports\": [{\"containerPort\": 80, \"hostPort\": 80, \"protocol\": \"TCP\"}]}]}}\n\n# Client configuration\nuser = getpass.getuser()\nconfig = kubeshift.Config.from_file(\"/home/%s/.kube/config\" % user)\nclient = kubeshift.Client(config, \"kubernetes\")\n\n# Main methods\nclient.create(k8s_object) # Creates the k8s object\n# client.scale(k8s_object, replicas=3) # Scales the k8s object (if it's a service)\nclient.delete(k8s_object) # Deletes the k8s object\n\n# API calls\n\n# Namespaces\nclient.namespaces()\n\n# Pods\nclient.pods().all()\nclient.pods().filter(namespace=\"default\", status=\"Running\")\nclient.pods().metadata()\nclient.pods().items()\n```\n", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/cdrage/kubeshift", "keywords": "kubernetes,kubeshift,openshift,docker", "license": "LGPL3", "maintainer": null, "maintainer_email": null, "name": "kubeshift", "package_url": "https://pypi.org/project/kubeshift/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/kubeshift/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/cdrage/kubeshift" }, "release_url": "https://pypi.org/project/kubeshift/0.0.4/", "requires_dist": null, "requires_python": null, "summary": "A universal python library for container orchestrators", "version": "0.0.4" }, "last_serial": 2351483, "releases": { "0.0.1": [], "0.0.2": [ { "comment_text": "", "digests": { "md5": "3f57130007f7fbda7d648a03f0bcaa0d", "sha256": "749aca6ed025f17e66b6e11b3016f4c882990352852d5431e7210e60f478c3f1" }, "downloads": -1, "filename": "kubeshift-0.0.2.tar.gz", "has_sig": false, "md5_digest": "3f57130007f7fbda7d648a03f0bcaa0d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18070, "upload_time": "2016-08-29T18:18:53", "url": "https://files.pythonhosted.org/packages/1d/33/a597f96630051104ac437c6af5325320ad47527f51662f2052d9731cfabd/kubeshift-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "8743c681597a757b76c5637bfe039fcf", "sha256": "29688bc07a1de43e68c6e03bd3a71a46c7d72b200fc7db7ba5ce52a2486a4d41" }, "downloads": -1, "filename": "kubeshift-0.0.3.tar.gz", "has_sig": false, "md5_digest": "8743c681597a757b76c5637bfe039fcf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14354, "upload_time": "2016-09-07T22:05:34", "url": "https://files.pythonhosted.org/packages/ac/76/a451ae6a80de51ffce106408304c455d3428ef5cc1ca448027d7465af2bd/kubeshift-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "d21d106ad2717e9b26609e1f65f62078", "sha256": "25d3f491dc4e92e1f1532369af4433685c38ea30d4e002651a6f06d0a958d4a8" }, "downloads": -1, "filename": "kubeshift-0.0.4.tar.gz", "has_sig": false, "md5_digest": "d21d106ad2717e9b26609e1f65f62078", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13839, "upload_time": "2016-09-19T19:13:27", "url": "https://files.pythonhosted.org/packages/ed/eb/b4f5ed503e8ac2b523280ed294bd07e6c0d85640874610eedef47a6d17fa/kubeshift-0.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d21d106ad2717e9b26609e1f65f62078", "sha256": "25d3f491dc4e92e1f1532369af4433685c38ea30d4e002651a6f06d0a958d4a8" }, "downloads": -1, "filename": "kubeshift-0.0.4.tar.gz", "has_sig": false, "md5_digest": "d21d106ad2717e9b26609e1f65f62078", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13839, "upload_time": "2016-09-19T19:13:27", "url": "https://files.pythonhosted.org/packages/ed/eb/b4f5ed503e8ac2b523280ed294bd07e6c0d85640874610eedef47a6d17fa/kubeshift-0.0.4.tar.gz" } ] }