Submit jobs using API Client Library for Python?

1/3/2016

Does API Client Library for Python support creation and deletion of pods and jobs on google container engine?

-- Harshal Patil
google-api-python-client
google-container-registry
google-kubernetes-engine

2 Answers

1/4/2016

Given that Kubernetes comes with a Swagger spec (1.2, not the latest version), you can use swagger-codegen to generate an Python API client for it.

Here is an example to generate Python API client using https://generator.swagger.io:

curl -X POST -H "content-type:application/json" -d '{"swaggerUrl":"https://raw.githubusercontent.com/kubernetes/kubernetes/master/api/swagger-spec/v1.json"}' https://generator.swagger.io/api/gen/clients/python

which returns a JSON with an URL to download the zipped Python API client.

Ref: https://github.com/swagger-api/swagger-codegen#online-generators

If you need help with swagger codegen or the Python API client, please open a ticket via https://github.com/swagger-api/swagger-codegen/issues

-- William Cheng
Source: StackOverflow

1/3/2016

No. The client library for python contains functions for interacting with the Google Container Engine API but not the Kubernetes API. The Kubernetes API uses a standard swagger specification, so it should be possible to generate a python client library. There is also pykube if you want to experiment with a existing client library.

-- Robert Bailey
Source: StackOverflow