Python API for Kubernetes
Go to file
Flavio Percoco 1d23ed2071 Update README to use git.openstack.org
Replaced an ocurrence of github.com and replaced with the appropriate
git.openstack.org url.

Change-Id: I9bf934ab7f5ec4c406ae0fc584bb817fda1c0d46
2016-09-19 14:30:50 +02:00
doc/source Add Cookie cutter generated files for OpenStack 2016-04-01 14:16:11 -04:00
k8sclient Deserialize Labels properly 2016-09-07 14:56:37 -04:00
tools Log info about K8S environment 2016-05-27 17:23:04 -04:00
.gitignore Add More tests from Magnum 2016-04-24 06:52:09 -04:00
.gitreview Add default config for git-review 2016-04-19 17:16:25 +02:00
.testr.conf Get tests working 2016-04-01 14:27:35 -04:00
babel.cfg Add Cookie cutter generated files for OpenStack 2016-04-01 14:16:11 -04:00
CONTRIBUTING.rst Add Cookie cutter generated files for OpenStack 2016-04-01 14:16:11 -04:00
HACKING.rst Add Cookie cutter generated files for OpenStack 2016-04-01 14:16:11 -04:00
LICENSE Add Cookie cutter generated files for OpenStack 2016-04-01 14:16:11 -04:00
MANIFEST.in Add Cookie cutter generated files for OpenStack 2016-04-01 14:16:11 -04:00
README.rst Update README to use git.openstack.org 2016-09-19 14:30:50 +02:00
requirements.txt Run swagger codegen for latest Kubernetes API 2016-04-22 13:33:25 -04:00
setup.cfg Add Python 3.5 classifier and venv 2016-07-14 19:15:09 +08:00
setup.py Add Cookie cutter generated files for OpenStack 2016-04-01 14:16:11 -04:00
test-requirements.txt Add Cookie cutter generated files for OpenStack 2016-04-01 14:16:11 -04:00
tox.ini Add Python 3.5 classifier and venv 2016-07-14 19:15:09 +08:00

python-k8sclient - Kubernetes API client code

Overview

This is Kubernetes API python client code. This code is generated by swagger-codegen. Kubernetes provide swagger-spec to generate client code for different versions. The specs live in Kubernetes repo.

See also

Prerequisites

You need to install required packages for swagger codegen. Please refer to https://github.com/swagger-api/swagger-codegen#prerequisites

Steps to generate API client code

Steps to generate Kubernetes client code for v1:

  • Clone the python-k8sclient repo:

    git clone https://git.openstack.org/openstack/python-k8sclient
* Clone the swagger-codegen repo. It is recommended to checkout a release

(e.g. v2.1.3) instead of using the master branch:

git clone https://github.com/swagger-api/swagger-codegen.git
cd swagger-codegen/
git checkout tags/v2.1.3
  • Build swagger-codegen:

    mvn package
  • Update the v1.json from latest Kubernetes release:: curl -o ./k8sclient/templates/v1.json https://raw.githubusercontent.com/kubernetes/kubernetes/v1.2.2/api/swagger-spec/v1.json

  • Run below command to generate the API client code for Kubernetes:

    cd ..
    java -jar ./swagger-codegen/modules/swagger-codegen-cli/target/swagger-codegen-cli.jar \
        generate \
        -i ./k8sclient/templates/v1.json \
        -l python -o ./KubernetesClientCode

Now you can check the code at location ./KubernetesClientCode.